[Insight-developers] Image filters and direction cosines

Peter Cech pcech at vision.ee.ethz.ch
Tue Aug 23 13:12:01 EDT 2005


Hi!

Having direction cosines together with an image is great, but some image
filters are throwing this information away (you get identity matrix
instead of proper direction cosines on the output). So far I found three
of them (see bug #2177 and patches at
http://www.vision.ee.ethz.ch/~pcech/bugreports/ITK-20050822/ ),
but there might be some more.

If you happen to write a filter that overrides
GenereateOutputInformation() and does not call
Superclass::GenereateOutputInformation(), please check whether you set
output's direction cosines.

Another problem is updating the origin of an image. Usual formula
origin[i] = origin[i] + spacing[i] * index[i];
does not yield correct results for oriented images. My attempt to fix
RegionOfInterestImageFilter is located at
http://www.vision.ee.ethz.ch/~pcech/bugreports/ITK-20050822/itkRegionOfInterestImageFilter-correct_origin.patch
The filter chooses between computing correct origin via
TransformContinuousIndexToPhysicalPoint (for Image and OrientedImage)
and the old formula for other types of image. If you have comments or
suggestions, I'll be glad to hear them.

itkMetaImageIO.cxx (line 875) should be also updated, but I do not know
how to find out type of saved image, so most likely the same way of
updating origin will be performed for all image types. If you want a
testcase, ExtractImageFilter can produce an image with non-zero index of
largest possible region.

Regards,
Peter Cech


More information about the Insight-developers mailing list