[vtkusers] [Insight-users] Negative spacing. Is that going to get me into trouble?

kent williams nkwmailinglists at gmail.com
Tue May 19 16:48:10 EDT 2009


Not to get all LOLCats on you or anything but UR DOING IT RONG.

The spacing is a size in centimeters -- usually.  A negative size
won't do what you want.

It sounds like you're using DICOM files, but you don't say so
explicitly.  ITK will try and recover the proper orientation in
anatomical space from DICOM files.

The way to handle this properly would be to change the ITK Direction
Cosines for the image.  It's perfectly reasonable for the slices to be
ordered in the negative image direction, but you have to clue in ITK
and VTK how it's oriented.

The easiest way is to load the file with ITK, and then set the
Direction Cosines to reflect the actual orientation of the image in 3D
space.  In this case you'd probably specify

1 0 0
0 1 0
0 0 -1

as the direction cosines. Then use the itk::OrientImageFilter to set
its orientation to identity, which according to
itk::OrientImageFilter's nomenclature is RAI.

The other solution would be to read the slices in reverse order -- the
itk::ImageSeriesReader allows you to customize the ordering -- you
could read all the names into a std::list and then reverse the list
before  having the Series Reader do it's thing.

On Tue, May 19, 2009 at 2:59 PM, John Drescher <drescherjm at gmail.com> wrote:
> I have a set of CT data where I need to load the images by ImageNumber
> instead of the default by PatientPosition. As a result the volume is
> loaded with increasing image z axis mapping to a decreasing world z
> axis. Loading the series with itk does not set the Direction or the
> Spacing of the z axes to be negative so I am setting it myself.
>
> I emailed the list a few months back about bad world coordinates:
> http://www.nabble.com/Transforming-image-to-world-coordinates-with-negative-z-axis-td22453066.html
>
> Initially I tried to fix this by setting the direction of the z axes
> to be -1 but it appears that vtk does not handle that however it
> appears that negative spacing in vtk is quite fine. With -2.5 for my z
> spacing instead of 2.5 the views are not upside down.
>
> --
> John M. Drescher
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>



More information about the vtkusers mailing list