ANTsX / ANTs

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

antsRegistration failed with the 4 hierarchical steps #704

Closed shrimpj closed 5 years ago

shrimpj commented 5 years ago

Dear ANTS experts,

I tried to run antsRegistration to align DTI b0 to t1 image with initial image matrix and nonlinear SyN. It runs properly with 1 level of convergence, shrink factors and smoothing-stigma (showing below).

antsRegistration -d 3 -o [b02brainmask.nii.gz, b02brainmask_wrap.nii.gz] \ -r [b02brainmask.tfm,1] \ -t SyN[0.1,3,0] –m CC[brainmask.nii.gz, b0.nii.gz,1,4] \ -c [20,1e-6,10] -f 1 -s 0

If more than one level of parameters are presented, the whole process was failed (showing below). There was no error message, the script completed without output images in the folder.

antsRegistration -d 3 -o [b02brainmask.nii.gz, b02brainmask_wrap.nii.gz] \ -r [b02brainmask.tfm,1] \ -t SyN[0.1,3,0] –m CC[brainmask.nii.gz, b0.nii.gz,1,4] \ -c [100x70x50x20,1e-6,10] -f 8x4x2x1 -s 3x2x1x0

Another question is that it seems affine registration results is identical to the rigid body results in our case. I wonder how can I check affine is running properly? Three is a "GenericAffine.mat" file generated after the process, but it's unknow type. Is this correct?

Thank you in advance!

ntustison commented 5 years ago

What is the actual error message that you get?

Also, you're only allowing for a translation transform with the command call above. You might want to check out the scripts antsRegistrationSyNQuick.sh and antsRegistrationSyN.sh for a simpler interface.

cookpa commented 5 years ago

Try running with the verbose option -v 1, and then sharing the output.

Another question is that it seems affine registration results is identical to the rigid body results in our case. I wonder how can I check affine is running properly? Three is a "GenericAffine.mat" file generated after the process, but it's unknow type. Is this correct?

Affine transforms or any subset of affine transforms (rigid, translation) are written to a GenericAffine.mat file. You can apply this with antsApplyTransforms and you can use antsTransformInfo to see the parameters.

https://github.com/ANTsX/ANTs/wiki/Forward-and-inverse-warps-for-warping-images,-pointsets-and-Jacobians#applying-affine-transforms-only

Rigid and affine may well produce very similar results if the ground truth warp does not contain global scaling or shearing. You are aligning a DWI to the T1 of the same brain. Motion can be corrected with a rigid transform and most of the EPI distortions are nonlinear. So there may not be much for the affine part to do.

shrimpj commented 5 years ago

4 hierarchical steps process is working now. And thank you so much for the suggestions applying affine matrix using antsApplyTransforms. I have one last question that I tried restrict deformation with nonlinear registration, where three independent parameters “-g 1x0x0, -g 0x1x0 and -g 0x0x1” indicated x, y, z axis respectively. I want to see which direction would fix the b0 imaging distortion on the forehead better. I assume x or y axis are better than z axis, but three parameters gave me identical results. Any reasons why? Thank you!

cookpa commented 5 years ago

The restrict deformation option is a rather crude tool, it applies post-hoc anisotropic scaling to the deformation field gradient (see correction below). You probably don't want to use "0x1x0" etc, too strong of a constraint may lead to convergence issues. Try something like "0.2x1x0.2".

If you need more detailed help you should share the data.

stnava commented 5 years ago

i believe what it does is this:

gradRestricted = grad \times restriction

where \times indicates element-wise multiplication

so the deformation field is not scaled. the gradient is. this is also the case for rigid, affine, etc. cases.

brian

On Tue, Jan 29, 2019 at 10:48 AM Philip Cook notifications@github.com wrote:

The restrict deformation option is a rather crude tool, it applies post-hoc anisotropic scaling to the deformation field. You probably don't want to use "0x1x0" etc, too strong of a constraint may lead to convergence issues. Try something like "0.2x1x0.2".

If you need more detailed help you should share the data.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTs/issues/704#issuecomment-458590993, or mute the thread https://github.com/notifications/unsubscribe-auth/AATyfkNZb19ZlzkaS8jDjCa5nwP0yeatks5vIG1JgaJpZM4aVS-B .

shrimpj commented 5 years ago

Thank you so very much for all suggestions, The parameters you mentioned has been extremely helpful. Thanks in tons!