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

John Drescher drescherjm at gmail.com
Tue May 19 17:13:48 EDT 2009


On Tue, May 19, 2009 at 4:48 PM, kent williams
<nkwmailinglists at gmail.com> wrote:
> 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.
>
I know but that seems to work while the correct way fails..

>
> It sounds like you're using DICOM files, but you don't say so
> explicitly.

Yes.

>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
>
I initially did that, but vtk had the Coronal and Sagittal views
upside down. Having vtk flip the output lead to problems because the
display code is doing computations like the following:

origin[axis] + slice * spacing[axis];

>
> 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.
>

I want the images loaded this way because I pass the image on to 2
different libraries (c array based) that requires this orientation for
their processing. I could have let itk read the images in
PatientPosition and flipped but I plan to eventually display the
result so I wanted to keep the volume and the result in memory the
same orientation..

John


More information about the Insight-users mailing list