Issue with pydeface on linux VM

Hi all,

We’re running into issues de-facing anatomical files on our lab’s linux VM. Please note that this issue does not arise when running pydeface on a mac. Here’s the error we get when running pydeface:

Defacing…
sub-014_ses-1_T1w.nii.gz
Traceback (most recent call last):
File “/PathLocalToMyComputer/anaconda3/bin/pydeface”, line 8, in
sys.exit(main())
File “/PathLocalToMyComputer/anaconda3/lib/python3.9/site-packages/pydeface/main.py”, line 95, in main
pdu.deface_image(**vars(args))
File “/PathLocalToMyComputer/anaconda3/lib/python3.9/site-packages/pydeface/utils.py”, line 124, in deface_image
masked_brain = Nifti1Image(outdata, infile_img.get_affine(),
File “/PathLocalToMyComputer/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

Has anyone encountered a similar issue?

Thanks,
Frank

Hello,

Can you try making sure that pydeface dependencies are at the tested versions?
image

Or try the docker container: Docker Hub

Best,
Steven

Hi Steven,

Thanks for providing details. It’s strange because I’ve got those programs installed within my conda environment. Here’s my yaml file I use to create the environment.

channels:

  • conda-forge
    dependencies:
  • pip
  • dcm2niix
  • dcm2bids
  • joblib
  • nibabel
  • numpy
  • pandas
  • nipype
  • python>=3.7
  • scipy
  • fslpy
  • pip:
    • bidsify
    • cmake
    • fmriprep-docker
    • bids-validator
    • pydeface

I’m still getting the issue “nibabel.deprecator.ExpiredDeprecationError: get_affine method is deprecated.
Please use the img.affine property instead.”

Anything seem out of the ordinary from your point of view?

Thanks again,
FG

Are these packages at those specific versions?

Great question! I checked this by ensuring that the versions I downloaded were set to the tested version.

name: garcealabvm_pydeface_py37_env
channels:

  • conda-forge
    dependencies:
  • pip
  • dcm2niix
  • dcm2bids
  • joblib
  • nibabel==2.5.1
  • numpy==1.17.1
  • pandas
  • nipype==1.3.0
  • python>=3.7
  • scipy
  • fslpy
  • pip:
    • jq
    • bidsify
    • cmake
    • fmriprep-docker
    • bids-validator
    • pydeface

When I did that I couldn’t not get pydeface to run. It crashed immediately (here’s the log file: Dropbox - PydefaceLog.rtf - Simplify your life)).

This was very different than my experience described above. In that case, pydeface will run for about 5 mins to run before it throws me the “img.affine” issue (described above). I’m not sure what’s going on.

FG

Hmm, sounds frustrating :confused: can you try using the docker container?

Hey Steven,

There is now a new version of pydeface (2.0.2) that addresses the issue I documented above. After updating pydeface the issue went away!

Thanks again for your input.

FG

1 Like