ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.22k stars 381 forks source link

Immediate Segmentation Fault when running antsRegistration #1266

Closed pmn1113 closed 3 years ago

pmn1113 commented 3 years ago

Describe the problem

I am trying to register two masked/skullstripped images of the brain. One is the T1W image (brain.mgz, converted to .nii) from freesurfer. Another is a fractional anisotropy image (fa.nii) with the mask produced by FSL bet2.

To Reproduce

antsRegistration --dimensionality 3 --float 0 --output [$DataDir/fa_,$DataDir/fa_Warped.nii.gz] --interpolation Linear --winsorize-image-intensities [0.005,0.995] --use-histogram-matching 0 --initial-moving-transform [$DataDir/brain.nii,$DataDir/fa.nii,1] --transform Rigid[0.1] --metric MI[$DataDir/brain.nii,$DataDir/fa.nii,1,32,Regular,0.25] --convergence [1000x500x250x100,1e-6,10] --shrink-factors 8x4x2x1 --smoothing-sigmas 3x2x1x0vox --transform Affine[0.1] --metric MI[$DataDir/brain.nii,$DataDir/fa.nii,1,32,Regular,0.25] —convergence [1000x500x250x100,1e-6,10] --shrink-factors 8x4x2x1 --smoothing-sigmas 3x2x1x0vox --transform SyN[0.1,3,0] --metric CC[$DataDir/brain.nii,$DataDir/fa.nii,1,4] --convergence [100x70x50x20,1e-6,10] --shrink-factors 8x4x2x1 --smoothing-sigmas 3x2x1x0vox --verbose

image

System information (please complete the following information)

ANTs version information

Additional information

gdevenyi commented 3 years ago

Hi,

You're going to need to share the data for this bug report to be meaningful at all.

pmn1113 commented 3 years ago

Hi @gdevenyi, I've emailed my supervisor to ask whether I can share the data. In the meantime, are there general problems with the data/command that would cause an immediate segmentation fault that I can look for on my end? Thank you for your help!

cookpa commented 3 years ago

Can you try antsRegistrationSyNQuick.sh and see what that does?

pmn1113 commented 3 years ago

@cookpa antsRegistrationSyNQuick.sh ran just fine! Is that preferred to using antsRegistration? I am a total newbie.

cookpa commented 3 years ago

It's a good starting point. It will print out an ANTs command that you can modify. See also antsRegistrationSyN.sh. If that works, your data is probably OK, and there might be a syntax error buried in your other call.

It might also be a multi-threading issue. The wrapper scripts handle this for you. If running ANTs directly, you may need to export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=N to use no more than N cores.

zqsha commented 1 year ago

Hi experts, I agree that it might be a multi-threading issue. However, even though I set it by "export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=10", the issue remains. When I run the following command line, it only showed "Segmentation fault (core dumped)".

antsRegistration \ --dimensionality 3 \ --float 0 \ --collapse-output-transforms 1 \ --interpolation BSpline[5] \ --output [registered1mask,registered1_Warped_mask.nii,registered1_InverseWarped_mask.nii] \ --use-histogram-matching 0 \ --winsorize-image-intensities [0.005,0.995] \ --initial-moving-transform initial_matrix.txt \ --transform Rigid[0.1] \ --metric MI[EPI.nii,ANAT.nii,1,32,Regular,0.25] \ --convergence [1000x500x250x100,1e-6,10] \ --shrink-factors 12x8x4x2 \ --smoothing-sigmas 4x3x2x1vox \ --transform Affine[0.1] \ --metric MI[EPI.nii,ANAT.nii,1,32,Regular,0.25] \ --convergence [1000x500x250x100,1e-6,10] \ --shrink-factors 12x8x4x2 \ --transform SyN[0.1,3,0] \ --metric CC[EPI.nii,ANAT.nii,1,4] \ --convergence [50x50x70x50x20,1e-6,10] \ --shrink-factors 10x6x4x2x1 \ --smoothing-sigmas 5x3x2x1x0vox

Do you have any thoughts about fixing this issue?