ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.19k stars 380 forks source link

Inquiry Regarding Suboptimal Results in Macaque T1 Image Segmentation Using antsbrainextraction.sh #1638

Closed AnastasiaWen closed 8 months ago

AnastasiaWen commented 10 months ago

Describe the problem

Hello,

I hope this message finds you well. I've been using antsbrainextraction.sh for the segmentation of Macaque T1 images. However, the results have not been satisfactory as I can only see a partial representation of the brain, despite using individual images registered to the NMT template and masks. Could you please provide guidance on where I might have gone wrong in my process? Additionally, are there any recommended adjustments or steps I can take to improve the quality of my results?

Thank you for your assistance.

Best regards, Anne wen

To Reproduce

I used this command line: $ANTSPATH/antsBrainExtraction.sh -d 3 -a ${name}_N4.nii.gz -e ${name}_NMT_prior.nii.gz -m ${name}_NMT_brainmask_probprior.nii.gz -o ${name} -f ${name}_NMT_brainmask_prior.nii.gz

and the results like this:

image

System information (please complete the following information)

ANTs version information

Additional information

ntustison commented 10 months ago

Can you upload the full input dataset so that we can reproduce the issue on our end?

AnastasiaWen commented 10 months ago

Can you upload the full input dataset so that we can reproduce the issue on our end?

Thanks a bunch for your help. Unfortunately, the file size was too large to upload directly to GitHub,so I've uploaded the files to Google Drive. You can download them using the following link: https://drive.google.com/drive/folders/1yf8d0uEasbpz0alxk70H-SM4pMIMQmqa?usp=sharing

Here's the command I used (note:name=vic): $ANTSPATH/antsBrainExtraction.sh -d 3 -a ${name}_N4.nii.gz -e ${name}_NMT_prior.nii.gz -m ${name}_NMT_brainmask_prob_prior.nii.gz -o ${name}_ -f ${name}_NMT_brainmask_prior.nii.gz

Additionally, my goal is to perform segmentation and utilize the results to generate surfaces in FreeSurfer, following the workflow outlined below: https://prime-re.github.io/structural/surfaces_and_flatmaps_notebook/Surfaces_and_Flatmaps.html

Thank you for your time and assistance.

cookpa commented 10 months ago

I expect it's because of antsAI downsampling the images too much. I can work on a fix, but in the interim, you could try getting an initial transform with

antsRegistrationSyNQuick.sh -f vic_ants/vic_NMT_prior.nii.gz -m vic_ants/vic_N4.nii.gz -t r -o vicToNMT_Affine

and then adding

-r vicToNMT_Affine0GenericAffine.mat

to the antsBrainExtraction.sh command.

cookpa commented 10 months ago

Initial affine worked for me, BTW

image
AnastasiaWen commented 10 months ago

Thanks for your effective help! It works well :D

YCHuang0610 commented 10 months ago

I expect it's because of antsAI downsampling the images too much. I can work on a fix, but in the interim, you could try getting an initial transform with

antsRegistrationSyNQuick.sh -f vic_ants/vic_NMT_prior.nii.gz -m vic_ants/vic_N4.nii.gz -t r -o vicToNMT_Affine

and then adding

-r vicToNMT_Affine0GenericAffine.mat

to the antsBrainExtraction.sh command.

Dear cookpa I have met the same problem when using antsBrainExtraction.sh and antsCorticalThickness.sh to deal with monkey brains. I tried your solution and It works when using antsBrainExtraction.sh. But I didn't find the same argument (antsBrainExtraction.sh -r to do the Initial moving transform) in antsCorticalThickness.sh. Since antsCorticalThickness.sh calls antsBrainExtraction.sh , I am wondering whether the same argument to do the Initial moving transform should be added to _antsCorticalThickness.sh pipeline as well? Besides, when I am doing antsRegistrationSyNQuick.sh to get an initial transform, if I have to add the "-t r" argument to specifiy the "rigid" transform type? Since some T1 imgs can't be well registered only by using rigid transform.

cookpa commented 9 months ago

The -t r is just to do a fast initial transform. It's only a starting point for the rest of the registration, so it's OK if it's not a very good alignment. You can switch to -t a if you like.

Regarding antsCorticalThickness.sh, it doesn't support an initial transform but it will find an existing brain mask. So if you run it with -o myOutput_ and there exists myOutput_BrainExtractionMask.nii.gz, it will not re-run the brain extraction and will carry on from the next step.