[vtkusers] Displaying planes from a volume

John Wilson jpw at creare.com
Mon Apr 30 14:15:05 EDT 2001


In my Tcl program I read in a series of TIFF image slices, create a volume,
and then display three orthogonal cut planes through the data.  Here is a
piece of code that I use to extract a Z slice in the XY plane.  I present 2
different options for extracting the slice:

----------------------------------------

if { 1 } {
      #
	# Option 1: Use a plane source to extract data of interest
      #
    vtkExtractVOI xySection
        xySection SetVOI $x_sliceMin $x_sliceMax $y_sliceMin $y_sliceMax
$z_sliceNumber $z_sliceNumber
        xySection SetInput [reader GetOutput]
    # This vtkTexture provides the color mapping for displaying the data
    vtkTexture xyTexture
        xyTexture SetInput [xySection GetOutput]
        xyTexture InterpolateOn
        xyTexture SetLookupTable bwLut
        xyTexture MapColorScalarsThroughLookupTableOn
    vtkPlaneSource xyPlane
        xyPlane SetXResolution 1
        xyPlane SetYResolution 1
	    xyPlane SetOrigin $x_sliceMin.0 $y_sliceMin.0 $z_sliceNumber.0
        xyPlane SetPoint1 $x_sliceMin.0 $y_sliceMax.0 $z_sliceNumber.0
        xyPlane SetPoint2 $x_sliceMax.0 $y_sliceMin.0 $z_sliceNumber.0
    vtkPolyDataMapper xyMapper
        xyMapper SetInput [xyPlane GetOutput]
        xyMapper ImmediateModeRenderingOn
    vtkActor xyActor
        xyActor SetMapper xyMapper
        xyActor SetTexture xyTexture
} else {
      #
	# Option 2: Use a geometry filter to extract data of interest
      #
	vtkStructuredPointsGeometryFilter xyPlaneData
        xyPlaneData SetInput [reader GetOutput]
	    xyPlaneData SetExtent $x_sliceMin $x_sliceMax $y_sliceMin $y_sliceMax
$z_sliceNumber $z_sliceNumber
    vtkPolyDataMapper xyMapper
        xyMapper SetInput [xyPlaneData GetOutput]
        xyMapper ImmediateModeRenderingOn
    vtkActor xyActor
        xyActor SetMapper xyMapper
}

--------------------------------------------

A couple questions about the 2 different options I use:

1. The data rendered using Option 2 (uses vtkStructuredPointsGeometryFilter)
is rotated 90 degress from that displayed with Option 1 (uses
vtkPlaneSource).  Does anyone know why?

2. Rendering is very speedy using Option 1 (uses vtkPlaneSource ) compared
to Option 2 (uses vtkStructuredPointsGeometryFilter).  Is this because
Option 2 uses ray tracing for rendering the plane?

Thanks -

John





More information about the vtkusers mailing list