[vtkusers] vtkImagePlaneWidget and image orientation

Marco Sambin m.sambin at gmail.com
Mon Jan 16 12:48:02 EST 2012


Hi all.

I think I've made some progresses on this issue (and I will share them
here), but I I still need some help.

Basically, I've read more carefully the documentation about the
SetResliceTransform() method of the vtkImageReslice class, and I
learnt that the 4x4 matrix that I shall set here is the INVERSE of the
DICOM transformation matrix, since this reslice transform is applied
to the resampling grid before acquisition of the volume data.

Everything works fine now as far as this transform is concerned, but
the vtkImagePlaneWidget does not seem to be particularly conscious
about this transform. In fact:

1 - If I simply call "PlaceWidget()", the bounds of the widget remain
the ones of the original un-rotated volume (as if the reslice
transform hadn't been applied). On the other side, if I call
PlaceWidget(double[] bounds) with the correct bounds of my volume in
the final world coordinates (detected programmatically by me from my
own custom data source), I can correctly see my volume, with the
appropriate orientation.

2 - Pressing the left mouse button in order to detect the data
coordinates on the plane widget leads to a "Off Image" text overlay,
even though what I can see in the 3D scene is that I am on the image.

3 - If I set RestrictPlaneToVolumeOn() on my vtkImagePlaneWidget(), it
prevents me from moving on visible parts of my volume, since it seems
to always restrict to the bounds of the original un-rotated input
volume.

Overall, the vtkImagePlaneWidget seems NOT to be conscious about the
reslice transform. Is this possible?

Do you have some suggestions / workarounds in order to make this
widget work better when a reslice transform is applied?

Thanks in advance and best regards,

Marco Sambin



-----Original Message-----
From: Marco Sambin
Subject: [vtkusers] vtkImagePlaneWidget and image orientation

Hi all.

I am developing a MPR (Multi-Planar Reformat) medical application through
VTK. I am working in Java.

I am using 3 vtkImagePlaneWidget's to display the axial, coronal and
sagittal views in a 3D scene.

I am loading DICOM images through custom DICOM decoding code (hence, not
using VTK nor ITK image readers), and I am building a vtkImageData input
object from my own custom DICOM decoded data.
I obviously know all details about the slices I am loading into the
vtkImageData data set, including pixel spacing, origin, orientation.

I've read several posts in this mailing list about this topic, and I have
followed the quite-common suggestion of leaving the vtkImageData at (0,0,0)
origin. Also, as known, no orientation information can be associated with
vtkImageData.
Hence, basically my vtkImageData is a set of slices, each one parallel to
the XY plane in the data coordinate system, with appropriate x, y, and z
pixel spacing.

Now, my main issue is orientation. In fact, of course there are several
DICOM data sets where the input slices are not axial (i.e., not parallel to
the XY plane), hence I need to account for the orientation when displaying
my volume in the 3D scene.

My plan would be to define "somewhere" a data-to-world transformation
matrix which would allow me to display my volume with the correct
orientation in the 3D scene. But my problem is: where to define this
transform when working with vtkImagePlaneWidget? Basically, the volume
would need to be "oriented" before being provided to
the vtkImagePlaneWidget as an input, in my opinion.

I have tried creating a vtkTransform starting from my vtkMatrix4x4 (built
from X, Y, Z direction cosines of my data set and from image origin in
patient coord system), and then calling "SetResliceTransform()" on the
vtkImageReslice object behind my vtkImagePlaneWidget, but this produces
strange results: nothing is visible inside my vtkImagePlaneWidget's after
this transform. I think I haven't exactly understood what
the "SetResliceTranform()" method does, and whether it is appropriate for
my purposes...

Do you have any suggestions about how/where I should account for image
orientation when working with vtkImagePlaneWidget?

Thanks in advance,

Marco



More information about the vtkusers mailing list