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

Not quite defaced #35

Open
soichih opened this issue Jun 24, 2020 · 5 comments
Open

Not quite defaced #35

soichih opened this issue Jun 24, 2020 · 5 comments

Comments

@soichih
Copy link

soichih commented Jun 24, 2020

Hello.

I've run pydeface (2.0.0) on a test image, but the App is not quite completely defacing.

image

I see that I can set template / facemask, etc.. parameters with pydeface, but I am not sure which knobs to tweak to get it properly defaced in this case. Do you have any suggestions?

@ofgulban
Copy link
Collaborator

ofgulban commented Jun 24, 2020

Hi @soichih , thank you for this question. You can try different cost options. One question though, is this the ‘Visible Male’ CT image? If it is, you should try an MRI T1-weighted image as your input instead of a CT image. If not, can you give some details of your input test image?

@soichih
Copy link
Author

soichih commented Jun 24, 2020

I will rerun with all different cost functions and see which one works the best.

I am feeding a normal t1w anatomy.(It's my brain image that I've taken recently at our imaging center). The scanner is a siemens 3T prisma.

Here is the mrinfo for the image I am running.

hayashis@xps13:~/Downloads $ mrinfo t1.nii.gz 
************************************************
Image name:          "t1.nii.gz"
************************************************
  Dimensions:        176 x 248 x 256
  Voxel size:        1 x 1 x 1
  Data strides:      [ 1 2 3 ]
  Format:            NIfTI-1.1 (GZip compressed)
  Data type:         signed 16 bit integer (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:                    1           0           0       -87.5
                                0           1           0      -104.7
                                0           0           1      -114.1
  comments:          TE=3;Time=102319.417;phase=1

I am running pydeface with a command like this

singularity exec -e docker://brainlife/pydeface:2.0 pydeface $t1 --force --cost $cost --outfile output/t1.nii.gz --verbose

Thank you!

@ofgulban
Copy link
Collaborator

Thanks for the details. Try different datasets too. It is always possible to stumble upon specific cases where the default parameters will fail. I see that the volume is cut-off near the superior part of the head, which leads me to think that maybe your coverage is positioned more inferiorly than usual (e.g. including more of the neck). This might explain why registration to the default template is suboptimal which causes the masked region missing the eyes.

If defacing fails consistently the same way, use custom templates and facemasks tweaked for your imaging center’s standards.

@soichih
Copy link
Author

soichih commented Jun 25, 2020

I've ran with all 7 --cost algorithms but outputs were (suspiciously) similar.. I hope I've set it up correctly, but I believe changing --cost function doesn't fix it.

I see that the volume is cut-off near the superior part of the head, which leads me to think that maybe your coverage is positioned more inferiorly than usual

Yeah, this might be the case... although I'd like to argue that pydeface should be able to handle that? I can give you the test data if you are interested.

image

@ofgulban
Copy link
Collaborator

ofgulban commented Jun 26, 2020

@soichih if you argue that pydeface should do better and if you think you can improve it, feel free to send a pull request and report exactly how you propose to improve it. This is an open source project build and improved with the help of volunteers.

Having said these, you can still create your own template and mask to deface to your liking.

Feel free to try the alternatives too. E.g. AFNI refacer:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/tutorials/refacer/refacer_run.html

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