poldracklab / pydeface

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

Additional flags used to deface 7T data #15

Closed ofgulban closed 6 years ago

ofgulban commented 6 years ago

Hi again,

I have made somewhat extensive changes to the interface, these are:

I have needed these options to deface images with several contrasts acquired at 7T. First example is a set of MPRAGE data:

Original images:

01_orig Stuff outside the head (in the posterior region) is a dielectric pad.

After using the default pydeface:

pydeface PDw.nii.gz
pydeface T1w.nii.gz
pydeface SI_T1w.nii.gz
pydeface T2*w.nii.gz

02_mutualinfo It can be seen that the defacing fails with certain contrasts (T1w, SI-T1w, T2*w). Even in PDw image where it mostly succeeds it removes a small chunk from the frontal lobe.

After changing the cost function to normalized mutual information:

pydeface PDw.nii.gz --cost normmi
pydeface T1w.nii.gz --cost normmi
pydeface SI_T1w.nii.gz --cost normmi
pydeface T2*w.nii.gz --cost normmi

03_normmi It can be seen that the defacing still fails with certain contrasts however succeeds with proton density weighted image.

After using --applyto argument:

pydeface PDw.nii.gz --cost normmi --applyto T1w.nii.gz SI_T1w.nii.gz T2*w.nii.gz

04_applyto Defacing mask based on the proton density weighted image applied to other contrasts gives the best result.


Second example to show the new additional arguments is a set of MP2RAGE data:

Original images:

11_orig

After using the default pydeface:

pydeface T1.nii.gz
pydeface UNI.nii.gz
pydeface INV1.nii.gz
pydeface INV2.nii.gz

12_mutualinfo It can be seen that defacing fails in all images,

After changing the cost function to normalized mutual information:

pydeface T1.nii.gz --cost normmi
pydeface UNI.nii.gz --cost normmi
pydeface INV1.nii.gz --cost normmi
pydeface INV2.nii.gz --cost normmi

13_normmi Defacing was successful in T1 and UNI images.

After using --applyto argument:

pydeface T1.nii.gz --cost normmi --applyto UNI.nii.gz INV1.nii.gz INV2.nii.gz

14_applyto Defacing mask based on the T1 (or UNI) image applied to other contrasts gives the best result.


I have tested the new command line interface with several 3T-7T data, it seems that everything works as it was (including exceptions etc.) so the previous users should see no difference other than making the command line call as pydeface instead of pydeface.py.

If you decide to merge this, I would recommend to first release the current version (pydeface 1.1) and then merge this PR in case if people still want to conveniently find the old version.

Also, let me know if you have any suggestions about the interface.

chrisgorgo commented 6 years ago

Looks great! Thank you for the contribution!

ofgulban commented 6 years ago

Thanks :)