Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nibabel.deprecator.ExpiredDeprecationError #46

Closed
asadmalik85 opened this issue Jul 4, 2022 · 2 comments
Closed

nibabel.deprecator.ExpiredDeprecationError #46

asadmalik85 opened this issue Jul 4, 2022 · 2 comments

Comments

@asadmalik85
Copy link

asadmalik85 commented Jul 4, 2022

Hi,

I get the following exception when I deface, and issue appears to be line 124 in utils.py where get_affine() is used, which is deprecated. Has anyone addressed this issue? Thanks!

pydeface 2.0.0
--------------
Temporary files:
  /tmp/tmp_c45u0hf.mat
  /tmp/tmp9_yxyidm.nii.gz
Defacing...
  /mnt/c/data/temp/PRISM2_NL-98-9998_V1_Struc.nii.gz
Traceback (most recent call last):
  File "/home/amalik/anaconda3/bin/pydeface", line 8, in <module>
    sys.exit(main())
  File "/home/amalik/anaconda3/lib/python3.9/site-packages/pydeface/__main__.py", line 95, in main
    pdu.deface_image(**vars(args))
  File "/home/amalik/anaconda3/lib/python3.9/site-packages/pydeface/utils.py", line 124, in deface_image
    masked_brain = Nifti1Image(outdata, infile_img.get_affine(),
  File "/home/amalik/anaconda3/lib/python3.9/site-packages/nibabel/deprecator.py", line 181, in deprecated_func
    raise error_class(message)
nibabel.deprecator.ExpiredDeprecationError: get_affine method is deprecated.
Please use the ``img.affine`` property instead.

* deprecated from version: 2.1
* Raises <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 4.0
@asadmalik85
Copy link
Author

asadmalik85 commented Jul 5, 2022

Hi. This is resolved now. Just needed to update line 124 in utils.py to use the affine and header properties of img instead of img.get_affine() and img.get_header().

@ofgulban
Copy link
Collaborator

Thanks @asadmalik85 , I have fixed the lines you mentioned and a few others too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants