poldracklab / pydeface

defacing utility for MRI images
MIT License
110 stars 42 forks source link

Reduce time needed for defacing #34

Closed dlevitas closed 4 years ago

dlevitas commented 4 years ago

Hello,

I'm defacing my anatomical data using version 2.0, and have noticed on different datasets that the defacing can take anywhere from 2-3 minutes for some anatomical images, to 8-10 minutes for others. Other than potential data quality issues, such as motion artifacts and/or poor CNR, are there other factors that can increase the time, such as slow HPC I/O? I'm trying to see if there is anything I can do to reduce the time.

Thanks!

ofgulban commented 4 years ago

Hi @dlevitas , Thanks for opening this issue and offering your help. Pydeface uses FLIRT from FSL to linearly register input images to a template image. I think this step takes the most amount of time during defacing. I can think of the following to speed it up:

  1. Use a lower resolution template image (e.g. 2mm isotropic resolution) which gives comparable results. You can quickly try downsampling the default template and facemask to pass it to pydeface using --template and --facemask flags.
  2. Try other --cost options.
  3. Use something other/faster than fsl-flirt for registration. I like using Greedy for registering unusual data.

These being said, I think speeding up pydeface is not a high priority issue as long as it is accurate enough and fast enough at the same time (e.g. not taking a day for defacing one image) while staying easy to install.

dlevitas commented 4 years ago

Thanks @ofgulban. I'll look into these options but try to avoid deviating too far from pydeface's defaults, which have worked extremely well for me in the past.