ANTs icon indicating copy to clipboard operation
ANTs copied to clipboard

Incorrect Warped file output from antsRegistration when initial warp field is provided

Open gdevenyi opened this issue 7 years ago • 2 comments

(Running GIT HEAD)

If I initialize antsRegistration like this:

antsRegistration .... \
--initial-moving-transform Warp_from_previous_registration.nii.gz \
--initial-moving-transform GenericAffine_from_previous_registration.mat \

And ask for an output like:

--output [test,inputfile.Warped.nii.gz]

Everything runs smoothly, however, inputfile.Warped.nii.gz is not what I would expect after completion.

A quick bit of testing with antsApplyTransforms on the outputs shows that the transforms produced were correct as:

antsApplyTransforms -d 3 -i origfile.nii.gz -t test2Warp.nii.gz -t Warp_from_previous_registration.nii.gz -t GenericAffine_from_previous_registration.mat -o newwarp.nii.gz -r target.ni.gz

Gives the expected output.

Further testing found that antsRegistration is producing its output with the equivalent antsApplyTransform call:

antsApplyTransforms -d 3 -i origfile.nii.gz -t test2Warp.nii.gz -t test0GenericAffine.mat -o newwarp.nii.gz -r target.ni.gz

Where the initial warp file doesn't get pushed into the transform stack.

gdevenyi avatar Mar 23 '18 15:03 gdevenyi

Hi @gdevenyi ,

Please put a small example together including data and command line calls illustrating the problem and I'll take a look when I get a chance.

Nick

ntustison avatar Mar 23 '18 16:03 ntustison

Here's an example which runs on your r16 and r64 2D slice example data.

antsRegistrationSyN.sh  -d 2 -f r64slice.nii.gz -m r16slice.nii.gz -o stage1

antsRegistration -d 2 \
--output [badresult,badresult.nii.gz] \
--initial-moving-transform stage11Warp.nii.gz \
--initial-moving-transform stage10GenericAffine.mat \
--transform SyN[0.1,3,0] \
--metric CC[r64slice.nii.gz,r16slice.nii.gz,1,4] \
--convergence [1,1e-6,10] \
--shrink-factors 1 \
--smoothing-sigmas 0

The badresult.nii.gz will not have the stage11Warp.nii.gz applied to it even though internally it was used for the initialization.

gdevenyi avatar Jul 05 '18 16:07 gdevenyi