[ITK-users] Resampling after SetDirection() and SetOrigin()

Mathew Guilfoyle mrguilfoyle at gmail.com
Sat Jun 28 21:55:47 EDT 2014


If I change an image's direction and origin using SetDirection() and
SetOrigin() methods and then write the image back to a file, the volume
stack viewed in (e.g.) ImageJ is unchanged.  This is the behaviour I would
expect as changing the direction and origin shouldn't alter the array of
image pixels, just its location and orientation in 'world space'?

However, if I take the same image, adjust the origin and direction as
before, and then input it to ResampleImageFilter with an identity transform
(and set spacing, origin, direction, and size to those of the input image)
the output is a translated and rotated image.

It seems the difference between the original and adjusted origin and
direction are applied as a translation and rotation during resampling, even
though GetOrigin() and GetDirection() on the input image to the resampler
return the adjusted parameters.

Is this the expected behaviour? Is there another image parameter that needs
to be changed to correctly alter origin and direction?

(ChangeInformationImageFilter is not wrapped for float images so I can't
use it for my application)

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20140629/8db571f7/attachment.html>


More information about the Insight-users mailing list