Previous

Section

<<<

Isosurface Generation using VTK

Next

Section

>>>

VTK Basics

 

 

3.2.2.1. vtkContourFilter / vtkMarchingCubes Functions

 

The most important part to using this function is specifying an isovalue.  This involves trial and error depending on the dataset.  In the case of this tutorial which uses the Visible Woman dataset, different isovalues will represent different “tissues”.  For example, there is a range of isovalues that will display the skin, muscle, and bone.  To reveal other organs, more experimentation should be done to validate if the desired internal parts are being shown.

 

Also, it is possible to specify multiple isovalues with a function described below, but this will cause complications later when it is necessary to color or adjust the alpha level of a specific isosurface.  This is not completely impossible to do because it is likely that one could use vtkLookupTable to map appropriate colors to isosurfaces by defining an explicit color map in the lookup table.  However, this tutorial is focusing on more simple methods of changing the visual attributes of the isosurface through other means.

 

Below are functions that are very useful for creating an isosurface:

 

  • vtkContourFilter: void SetInput( vtkDataSet * input )

·     This is where the VTK pipeline begins.  With this function, the output from vtkExtractVOI should be obtained and passed as a parameter to this function.  This function originates in the superclass named vtkDataSetToPolyDataFilter.  It requests a object of type vtkDataSet.  Since the output from vtkExtractVOI is of type vtkImageData, this is not an immediate match.  Fortunately, vtkImageData has a superclass named vtkDataSet, so everything matches.

 

  • VtkMarchingCubes: void SetInput( vtkImageData * input )

·     As with vtkContourFilter, this is where the VTK pipeline begins.  With this function, the output from vtkExtractVOI should be obtained and passed as a parameter to this function.  This function originates in the superclass named vtkStructuredPointsToPolyDataFilter.  It requests a object of type vtkImageData.  Since the output from vtkExtractVOI is of type vtkImageData, this is an immediate perfect match.

 

  • void SetValue( int i, float value )

·     This function will allow the resampling of the data file.  Please note that all of these parameters are integers and must be 1 or greater (though if specified 1 for all parameters, that really would not be very useful).  According to the VTK documentation, if the sample rate parameters were 2,2,2, then the resulting volume would be 1/8th of its original size.  Remember though that a higher value for the sampling rate will reduce the resolution.  Also, it is acceptable to sample at one rate on one axis and another rate on another axis.  However, in order to maintain some sort of aspect ratio, it would be advisable to have the x- and y- axis sampling rates remain the same while varying the z-axis sampling rate.

 

  • void ComputeNormalsOn()

·     This function will improve the appearance of the model by performing a more realistic shading that takes into account normals.  As the VTK documentation indicates, the computation of normals is expensive, so it may be better to have a way to disable this feature if responsive time is not at a very interactive level.  The opposite of this function is ComputeNormalsOff().

 

  • vtkPolyData * GetOutput()

·     This function actually belongs to vtkPolyDataSource, which is a superclass of this class.  To allow the pipeline to continue, the output from this function is the geometry of the dataset that will be sent to a class named vtkPolyDataMapper.  More information on that class will be available in a later section in this chapter.

 

 

<<< Previous

vtkContourFilter / vtkMarchingCubes

 

Table of Contents

 

 

 

Next >>>

Mapper Objects