[vtkusers] defining plane for vtkimagereslice

N.E Mackenzie-Mackay 9nem at qlink.queensu.ca
Fri May 21 17:12:00 EDT 2004


Hey,

	I am trying to define a plane to cut through a volume using 
vtkimagereslice.  I have already defined the plane and used vtkcutter 
to find the intersection of the plane to a model I have.  Right now 
that model is exactly aligned with a ct volume.  I wish to take a slice 
from that volume using vtkImageReslice or vtkImagePlaneWidget but am 
having diffuculties.

   	I have a normal, two points on the plane and a origin.  I tried 
using code I found on a previous message to generate a transformation 
for my image slice:
	http://public.kitware.com/pipermail/vtkusers/2003-April/017606.html

# axesTransform matrix to resample the volume
    #    based on the orientation of the sampling plane
    #
    # Homogonous(sic) matrix columns
    # |x axis vector|y axis vector|z axis vector |origin |

         #x axis column
         vtkMatrix4x4 axesTransform
         #Set inital state of matrix to identity
         axesTransform Identity
         #x axis column
         axesTransform SetElement 0 0 $v1_xn
         axesTransform SetElement 1 0 $v1_yn
         axesTransform SetElement 2 0 $v1_zn
         axesTransform SetElement 3 0 0.0
         #y axis column
         axesTransform SetElement 0 1 $v2_xn
         axesTransform SetElement 1 1 $v2_yn
         axesTransform SetElement 2 1 $v2_zn
         axesTransform SetElement 3 1 0.0
         #z axis column
         axesTransform SetElement 0 2 $norm_x
         axesTransform SetElement 1 2 $norm_y
         axesTransform SetElement 2 2 $norm_z
         axesTransform SetElement 3 2 0.0
         #origin column
         axesTransform SetElement 0 3 $origin_x
         axesTransform SetElement 1 3 $origin_y
         axesTransform SetElement 2 3 $origin_z
         axesTransform SetElement 3 3 1.0
		
		$slicer = vtkImageReslice
        $slicer SetResliceAxes AxesTransform
		$slicer SetInput [v16 GetOutput]	#v16 = ct volume
		$slice SetOutputExtent 0 512 0 512 0 0

I can't seem to use this to get it to work properly.  I have also tried 
using vtkImagePlaneWidget using the same information but with no 
success.  As of now I have image of pure red.

My questions are

	Does the two points and normal have to be normailized before using the 
above code?

	Has anyone got some sample code where - given a normal, origin, two 
points and a volume you can use vtkImageReslice to cut through a volume 
to produce a 2d image?

Thank you very much for you help,
Neilson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2516 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040521/b167ae77/attachment.bin>


More information about the vtkusers mailing list