Replies: 6 comments 7 replies
-
The warps are applied to point sets in physical space. The header transforms are only used when looking up intensities at the point's final location. For the purposes of transforms, it's all points in physical space. The most confusing aspect is that the transformation of points is the opposite to how the "moving" image is transformed. Thus, if applying the forward warps, we start with a point set on a regular grid in the fixed space. For a point p in the center of a voxel v in the fixed space, we apply the warp and then the affine transform to get to a continuous point in moving space. There, we interpolate a value that becomes the value of v in the output image. If the Warp is W and the affine A, we do A(W(p)). For inverse warps, we start with a point q at the center of voxel x in moving space, and need an interpolated value from the fixed space. We first apply the inverse affine A' to get approximately into the fixed space, and then find the interpolated inverse warp vector from W'. In other words, we do W'(A'(q)) to find the final position to interpolate for x in the output image. At least, that's my reading of the transform logic https://itk.org/Doxygen/html/classitk_1_1CompositeTransform.html |
Beta Was this translation helpful? Give feedback.
-
The's a good breakdown in SimpleITK's fundamental concepts, https://simpleitk.readthedocs.io/en/release/fundamentalConcepts.html |
Beta Was this translation helpful? Give feedback.
-
Hmmm... Even more confusing. Let's consider the forward warps then. Based on the documentation, it says that first the affine and then the warp is applied: W(A(p)). In the forward case I was thinking that in order to get a moving image warped to the fixed image, we take the grid points in the fixed space, we apply the affine registration which brings us to the moving space. If we interpolate at this point, we get an affine registered moving to the fixed image. To my understanding, since 1Warp.nii.gz is in the same space as the fixed image, it directly tells how each voxel of the fixed image is displaced, no? |
Beta Was this translation helpful? Give feedback.
-
My goal is to register the moving image to the fixed image and then apply the warps (inverse probably) to the fixed image only without the affine registration. I only want to see how the fixed image has displaced in its own space without reslicing to the moving space. Does it make any sense to |
Beta Was this translation helpful? Give feedback.
-
Ah, I see. I think I do understand now what's going 'under the hood'. The only concern I have now is with the following (just for curiosity): I only apply the warps to the points in the fixed space without the affine registration afterwards. The resulting image looks a bit weird and skewed but still fairly well interpolates the intensities of the moving image. I wonder what exactly happens at this particular case? We get W(p) but how does it relate to the moving image then without the affine transformation? |
Beta Was this translation helpful? Give feedback.
-
I see, it all makes sense now. Thanks a lot, @cookpa! |
Beta Was this translation helpful? Give feedback.
-
Hi. I'm trying to understand how ANTs internally manages to apply the inverse warp transformation. Say, I run SyN of two images: fixed and moving. I get the tx_0GenericAffine.mat, tx_1Warp.nii.gz and tx_1InverseWarp.nii.gz.
Now, both images - fixed and moving - are in different physical space (their RAS coordinates are different as well as dimensions). I want to apply tx_1InverseWarp.nii.gz and tx_0GenericAffine.mat to map the fixed image to the moving image space. I would do so by:
antsApplyTransforms -d 3 -r moving.nii.gz -i fixed.nii.gz -o fixed_warped.nii.gz -t [ tx_0GenericAffine.mat,1 ] -t tx_1InverseWarp.nii.gz
I found that RAS[fixed] = inverse_affine(inverse_warp(RAS[moving])). What I don't understand is how ANTs knows how to apply inverse warps to the RAS[moving] if inverse warps are in the fixed space and RAS[moving] corresponds to another space? I mean there is no voxel-wise correspondence between moving and 1InverseWarp.nii.gz neither their RAS coordinates are the same that it could interpolate. I feel like I'm missing something here...
Beta Was this translation helpful? Give feedback.
All reactions