Isosurface Generation using VTK




VTK Basics



3.2.2. vtkContourFilter / vtkMarchingCubes


This filter will allow data to be created in 2-D or 3-D depending on the input.  If the programmer was interested in just creating contour lines, using vtkContourFilter would be appropriate.  The output from this object would be isolines.  When the data is volumetric and vtkContourFilter is called, isosurfaces will be created.  This filter has some features that one can explore by viewing the VTK documentation pages, but the only functions that will be explored will be setting the input, specifying an isovalue, and deciding whether or not to compute normals.  Although it is still early to describe these objects, the output from vtkContourFilter will be able to have its color and opacity values set, but this is actually done farther in the pipeline after the data is converted to geometry. 


vtkContourFilter is a general purpose filter and will not be as fast to render or produce as good visual results as with vtkMarchingCubes.  vtkMarchingCubes is seemingly identical to vtkContourFilter except for a few differences.  First, they both have a nearly identical hierarchy to their base classes except that vtkContourFilter has vtkDataSetToPolyDataFilter as its immediate superclass, while vtkMarchingCubes has vtkStructuredPointsToPolyDataFilter as its immediate superclass.  Second, vtkMarchingCubes must take as input a class of type vtkImageData, while vtkContourFilter takes a class of type vtkDataSet as its input.  More generally speaking, the VTK documentation indicates that vtkMarchingCubes is designed to excel when receiving a volume input, while vtkContourFilter can work acceptably with 2-D or 3-D data.


It should be noted that vtkContourFilter may be the only available option if using the binaries found on the textbook CD.  In order to use vtkMarchingCubes, it is necessary to compile from source because this VTK object comes from a source directory named Patented and, by default, this is not included in the compilation.  So, a tradeoff must occur depending on if one’s confidence level in compiling is high enough to at least try for better results.



<<< Previous

vtkExtractVOI Functions


Table of Contents


Next >>>

vtkContourFilter / vtkMarchingCubes Functions