[Insight-users] itkResampleImageFilter and transformation matrix

Frank Miller frankmiller at jhmi.edu
Tue Nov 9 14:38:28 EST 2010


Alberto,

The 1st way, using a reference image, is the conceptually correct method
to accomplish what you want when both volumes occupy the same physical
location but have different origin, orientation, etc. You should note
that in this case you are using a transformation from volume 1 to volume
2, it just happens to be the identity.

The transformation will be non-identical when the two images don't
occupy the same physical location (or coordinate system), in which case
the transformation is the result of registration.

Its difficult to tell exactly what is wrong with the 2nd way without
seeing the code. The orientation *is* taken into account so it sounds
like you are on the right track. Remember that in itk, transformations
act on physical space not index space.

Good luck,

Frank

On Tue, 2010-11-09 at 14:24 +0000, Gomez, Alberto wrote:
> Hello all,
> 
> I am resampling one volume (1) into another (2) to compare them. They 
> have different origin, orientation, etc. I can think of two ways of 
> achieving this, but only one works for me and I wonder why, maybe you 
> can help me.
> 
> 1st way: Using itk::ResampleImageFIlter with no transformation, setting 
> useReferenceImageOn and using volume (2) as reference. This works fine.
> 
> 2nd way: Not using reference image, but instead using a transformation 
> from volume(1) to volume(2). For some reason this does not work.
> I obtain transformation matrix from the orientation and offset of each 
> image, and I am sure that both matrices (lets call them M1 and M2) are 
> correctly computed. What I do next is compute M = inv(M1)*M2
> and transform image 1 through M (actually through its inverse, since the 
> transform operates from output to input). In addition I fix the output 
> spacing, origin, startindex and size  to those of image (2) so that my 
> resulting transformed image is in the same space as the image (2) and i 
> can display both together.
> My guess is that this does not work because even if I set 
> useReferenceImageOff(), the input orientation is taken into account and 
> therefor my matrix is not the right one...
> 
> Anyone can give any advice on this??
> 
> Thank you,
> 
> Alberto
> 




More information about the Insight-users mailing list