[vtkusers] vtkImageReslice class

David Gobbi dgobbi at atamai.com
Fri May 11 15:46:27 EDT 2007


Hi Emmanouil,

The best example for what you are trying to do is probably this one:

VTK/Examples/ImageProcessing/Cxx/ImageSlicing.cxx

This example is only in the CVS version of VTK, it isn't in the VTK 5 
release.

What I do with tracking systems is use the coordinate/quaternion from 
the tracking system to create a vtkTransform, then I concatenate that 
transform with a vtkMatrix4x4 from the patient registration, and then 
feed the resulting transform to vtkImageReslice as the ResliceTransform.

If you have looked at the class page for vtkImageReslice, you will 
notice that there are two methods for setting orientations: 
SetResliceAxes() and SetResliceTransform().

For tracking, I always set ResliceTransform to the position/orientation 
of the tool (in patient coordinates), and then set the ResliceAxes 
according to how I want to orient the slice relative to orientation of 
the tool.  In that way, the ResliceAxes is used to choose the tool axes 
along which you will be extracting the slice.

The tricky thing with vtkImageReslice is getting the OutputOrigin, 
OutputSpacing, and OutputExtent set properly for your application.  
Together, these parameters can be used to describe an output slice plane 
with a particular pixel spacing.   So for example:

OutputOrigin =  (-127.5, -127.5, 0.0)
OutputSpacing = (1.0, 1.0, 1.0)
OutputExtent = (0, 255, 0, 255, 0, 0)

These describe a 256x256 output slice with 1mm pixel spacing.  The first 
pixel is at (-127.5,-127.5,0) in the "output coordinate system" of 
vtkImageReslice.  The centre of the slice is at (0,0,0) in the "output 
coordinate system" of vtkImageReslice.

Now, the original input volume is in the "input coordinate system" of 
vtkImageReslice.  We can call the input coordinate system "x" and the 
output coordinate system "x'".  The relationship between these 
coordinates is as follows:

x = T*M*x'    where "T" is ResliceTransform and "M" is ResliceMatrix

So this tells you that, if "M" is chosen to be a pure rotation matrix, 
and if "T" contains the position of the tool point in input image 
coordinates, then the point x' = (0,0,0), which is in the centre of our 
output plane, will correspond to the point x = tool_point.  So, we will 
be extracting a slice through the tool point position.

I know that is probably not the best description, let me know if things 
aren't quite clear.

 - David




Emmanouil Moschidis wrote:
> Hello
>
> I want to use the vtkImageReslice class for reading a series of slices 
> and exctracting one slice based on coordinates and quaternions 
> received from a tracking system.
>
> Is there any specific documentation and/or any working examples for 
> this class? It is very powerful yet the only usable information I have 
> found is the class reference webpage.
>
> Any hint about how to proceed towards the insight of it would be 
> highly appreciated
>
> thanks
>
> ------------------------------------------------------------------------
> Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge 
> <http://us.rd.yahoo.com/evt=47093/*http://tv.yahoo.com/collections/222>to 
> see what's on, when.
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   




More information about the vtkusers mailing list