C++ Examples

These are fully independent, compilable examples. There is significant overlap in the examples, but they are each intended to illustrate a different concept and be fully stand alone compilable.

Info

This table shows the VTK classes covered by the examples.

Info

This table shows VTK classes that do not have an example. Please add examples in your area of expertise!

Hello World

Example Name Classes Demonstrated Description Image
A hello world example vtkPolyDataMapper vtkActor vtkRenderer vtkRenderWindow vtkRenderWindowInteractor Cylinder example from the VTK Textbook and source code.

Simple Operations

Example Name Classes Demonstrated Description Image
DistanceBetweenPoints(python) vtkMath Distance between two points.
DistancePointToLine vtkLine Distance between a point and a line.
FloatingPointExceptions vtkFloatingPointExceptions Floating Point Exceptions
GaussianRandomNumber vtkMath Generates Gaussian random numbers.
PerspectiveTransform vtkPerspectiveTransform Apply a perspective transformation to a point.
ProjectPointPlane vtkPlane Project a point onto a plane.
RandomSequence vtkMinimalStandardRandomSequence This is the preferred way to generate random numbers.
UniformRandomNumber vtkMath Generates uniform random numbers.

Input and Output

Graph Formats

3D File Formats

Example Name Classes Demonstrated Description Image
ConvertFile Convert a file from one type to another
XGMLReader vtkXGMLReader Read a .gml file

Standard Formats

Input
Example Name Classes Demonstrated Description Image
DEMReader vtkDEMReader Read DEM (elevation map) files
DelimitedTextReader vtkDelimitedTextReader Read a delimited file into a polydata.
DumpXMLFile vtkDataSetReader Report the contents of a VTK XML or legacy file
IndividualVRML vtkVRMLImporter This example is used to get each actor and object from a scene and verify axes correspondence
ParticleReader vtkParticleReader This example reads ASCII files where each line consists of points with its position (x,y,z) and (optionally) one scalar or binary files in RAW 3d file format.
ReadAllPolyDataTypes vtkBYUReader vtkOBJReader vtkPLYReader vtkPolyDataReader vtkSTLReader vtkXMLPolyDataReader Read any VTK polydata file.
ReadAllPolyDataTypesDemo vtkBYUReader vtkOBJReader vtkPLYReader vtkPolyDataReader vtkSTLReader vtkXMLPolyDataReader Read all VTK polydata file types.
ReadOBJ vtkOBJReader Read an OBJ (.obj) file.
ReadPDB vtkPDBReader Read Protein Data Bank Files.
ReadPLOT3D vtkPLOT3DReader Read CFD (computational fluid dynamics) data produced by PLOT3D.
ReadPLY vtkPLYReader Read PLY (.ply) files
ReadPlainTextTriangles vtkPolyData vtkSmartPointer vtkPoints vtkCellArray vtkXMLPolyDataWriter Read a plain text file into a polydata.
ReadSTL vtkSTLReader Read stereo lithography STL (.stl) files
ReadTextFile vtkPolyData Read a plain text file into a polydata.
SimplePointsReader vtkSimplePointsReader Read a simple "xyz" file of points.
Importers
Example Name Classes Demonstrated Description Image
3DSImporter(python) vtk3DSImporter Import a 3D Studio scene that includes multiple actors.
ImportPolyDataScene vtkXMLMultiBlockDataReader vtkDataObjectTreeIterator Import a polydata scene using multiblock datasets.
OBJImporter vtkOBJImporter Import an OBJ scene that includes actors, materials and textures.
VRMLImporter vtkVRMLImporter Import a VRML 2.0 (WRL) file.
VRMLImporterDemo vtkVRMLImporter Import a VRML 2.0 (WRL) file and add normals if necessary.
Output
Example Name Classes Demonstrated Description Image
DelimitedTextWriter vtkDelimitedTextWriter Write data to a delimited file
SimplePointsWriter vtkSimplePointsWriter Write a simple ".xyz" file
WritePLY vtkPLYWriter Write PLY (.ply) files
WriteSTL vtkSTLWriter Write stereo lithography STL (.stl) files
Exporters
Example Name Classes Demonstrated Description Image
ExportPolyDataScene vtkXMLMultiBlockDataWriter Export a polydata scene using multiblock datasets.

VTK Formats

Input
Example Name Classes Demonstrated Description Image
ReadImageData vtkXMLImageDataReader Read a image data (.vti) file
ReadPolyData vtkXMLPolyDataReader Read a polygonal data (.vtp) file
ReadRectilinearGrid vtkXMLRectilinearGridReader Read a rectilinear grid (.vtr) file
ReadStructuredGrid vtkXMLStructuredGridReader Read a structured grid (.vts) file
ReadUnknownTypeXMLFile vtkXMLGenericDataObjectReader Read an XML file and later decide what kind it is
ReadUnstructuredGrid vtkXMLUnstructuredGridReader Read an unstructured grid (.vtu) file
Output
Example Name Classes Demonstrated Description Image
ExodusIIWriter vtkExodusIIWriter Write a time varying ExodusII file.
WriteVTI vtkXMLImageDataWriter Write a .vti file. VTI is an "ImageData".
WriteVTP vtkXMLPolyDataWriter Write a .vtp file. VTP is a "PolyData". This format allows for the most complex geometric objects to be stored.
WriteVTU vtkXMLUnstructuredGridWriter Write a .vtu file. VTU is an "Unstructured Grid". This format allows for 3D data to be stored.
XMLPImageDataWriter vtkXMLPImageDataWriter Write a .pvti file with 4 .vti pieces.
XMLPUnstructuredGridWriter vtkXMLPUnstructuredGridWriter Write a .pvtu with 4 .vtu pieces.
XMLStructuredGridWriter vtkXMLStructuredGridWriter Write a .vts file from a vtkStructuredGrid.

Legacy VTK Formats

Example Name Classes Demonstrated Description Image
GenericDataObjectReader vtkGenericDataObjectReader Read any type of legacy .vtk file.
ReadLegacyUnstructuredGrid(python) vtkUnstructuredGridReader Read an unstructured grid that contains 11 linear cells.
StructuredGridReader vtkStructuredGridReader Read a structured grid (.vtk) file.
StructuredPointsReader vtkStructuredPointsReader Read a structured points (.vtk) file.
WriteLegacyLinearCells(python) vtkUnstructuredGridWriter Write each linear cell into a legacy UnstructuredGrid file.
WriteXMLLinearCells(python) vtkXMLDataSetWriter Write each linear cell into an XML UnstructuredGrid file (.vtu).

Image Format

Input

Example Name Classes Demonstrated Description Image
ImageReader2Factory vtkImageReader2Factory This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect.
JPEGReader vtkJPEGReader Read a JPEG image.
MetaImageReader vtkMetaImageReader Read .mha files.
PNGReader vtkPNGReader Read a PNG image.
ReadBMP vtkBMPReader Read BMP (.bmp) files.
ReadDICOM vtkDICOMImageReader Read DICOM file
ReadDICOMSeries vtkDICOMImageReader This example demonstrates how to read a series of DICOM images and scroll through slices
ReadPNM vtkPNMReader Read PNM (.pnm) files.
ReadTIFF vtkTIFFReader Read TIFF (.tif) files.

Output

Example Name Classes Demonstrated Description Image
ImageWriter(python) vtkBMPWriter vtkJPEGWriter vtkPNMWriter vtkPostScriptWriter vtkTIFFWriter vtkPNGWriter vtkWindowToImageFilter Write an imagefile based on the file extension.
JPEGWriter vtkJPEGWriter Write a JPEG (.jpg) file.
MetaImageWriter vtkMetaImageWriter Write a .mha/.mhd + .raw file.
PNGWriter vtkPNGWriter Write a PNG (.png) file.
WriteBMP vtkBMPWriter Write a BMP (.bmp) file.
WritePNM vtkPNMWriter Write a PNM (.pnm) file.
WriteTIFF vtkTIFFWriter Write a TIFF (.tif) file.

Geometric Objects

Example Name Classes Demonstrated Description Image
Axes(python) vtkAxesActor
ColoredLines(python) vtkCellData vtkLine
Dodecahedron(python) vtkPolyhedron Create a dodecahedron using vtkPolyhedron.
EllipticalCylinder(python) vtkLinearExtrusionFilter Create an elliptical cylinder using extrusion.
EllipticalCylinderDemo(python) vtkLinearExtrusionFilter Show the base and extrusion vector.
GeometricObjectsDemo(python) A demonstration of all geometric objects that work the same way.
Planes(python) vtkPlanes
PlanesIntersection(python) vtkPlanesIntersection
PolygonIntersection(python) vtkPolygon Compute the intersection of a line segment with a polygon.
SourceObjectsDemo(python) vtkSphereSource vtkConeSource vtkCylinderSource vtkCubeSource vtkPlaneSource vtkTextSource vtkPointSource vtkDiskSource vtkLineSource Examples of source objects that procedurally generate polygonal models. These nine images represent just some of the capability of VTK. From upper left in reading order: sphere, cone, cylinder, cube, plane, text, random point cloud, disk (with or without hole), and line source. Other polygonal source objects are available; check subclasses of vtkPolyDataAlgorithm.

Cells

Example Name Classes Demonstrated Description Image
Cell3DDemonstration(python) vtkHexagonalPrism vtkHexahedron vtkPentagonalPrism vtkPolyhedron vtkPyramid vtkTetra vtkVoxel vtkWedge vtkUnstructuredGrid Demonstrate the use of vtkCell3D to construct geometric objects. Sample objects are generated from the classes derived from vtkCell3D and displayed.
CellTypeSource(python) vtkCellTypeSource vtkTessellatorFilter Generate tessellated cells.
ConvexPointSet(python) vtkConvexPointSet Generate a ConvexPointSetCell.
Hexahedron(python) vtkHexahedron
LinearCellDemo(python) vtkCell vtkCell3D Linear cell types in VTK.
LongLine(python) vtkLine Manually create a polyline.
Point(python) vtkPoints
PolyLine(python) vtkPolyLine
Polygon(python) vtkPolygon
Polyhedron(python) Create an unstructured grid representation of a polyhedron (cube) and write it out to a file.
Pyramid(python) vtkPyramid
Quad(python) vtkQuad
Tetrahedron(python) vtkTetra
Triangle(python) vtkTriangle
Triangle strip(python) vtkTriangleStrip
Vertex(python) vtkVertex

Sources

Example Name Classes Demonstrated Description Image
Arrow(python) vtkArrowSource
Cone(python) vtkConeSource
Cube(python) vtkCubeSource
Cylinder(python) vtkCylinderSource
Disk(python) vtkDiskSource A circle with a hole in it.
Frustum(python) vtkFrustumSource
Line(python) vtkLineSource
OrientedArrow(python) vtkArrowSource Orient an arrow along an arbitrary vector.
OrientedCylinder(python) vtkCylinderSource Orient a cylinder along an arbitrary vector.
Plane(python) vtkPlaneSource
PlatonicSolids(python) vtkPlatonicSolidSource
PolyLine1(python) vtkPolyLine This example demonstrates how to create a polygon through several ordered points.
RegularPolygon(python) vtkRegularPolygonSource
Sphere(python) vtkSphereSource
TessellatedBoxSource(python) vtkTessellatedBoxSource Generate a box with tessellated sides.
TextActor(python) vtkTextActor 2D "HUD-type" text

Non Linear

Example Name Classes Demonstrated Description Image
IsoparametricCellsDemo(python) vtkNonLinearCell Nonlinear isoparametric cell types in VTK.
QuadraticHexahedron(python) vtkQuadraticHexahedron vtkTessellatorFilter Create and tessellate a nonlinear cell.
QuadraticHexahedronDemo(python) vtkQuadraticHexahedron vtkTessellatorFilter Interactively adjust chord error.
QuadraticTetra(python) vtkQuadraticTetra vtkTessellatorFilter Create and tessellate a nonlinear cell.
QuadraticTetraDemo(python) vtkQuadraticTetra vtkTessellatorFilter Interactively adjust chord error.

Parametric Objects

These examples demonstrate how to create an display one of the many vtkParametric objects. All of the classes listed can be used in an identical fashion.

Example Name Classes Demonstrated Description Image
ParametricKuenDemo(python) vtkParametricKuen Interactively change the parameters for a Kuen Surface.
ParametricObjects(python) Create and display a parametric object. Uncomment the object that you wish to be displayed.
ParametricObjectsDemo(python) vtkParametricBoy vtkParametricConicSpiral vtkParametricCrossCap vtkParametricDini vtkParametricEllipsoid vtkParametricEnneper vtkParametricFigure8Klein vtkParametricKlein vtkParametricMobius vtkParametricRandomHills vtkParametricRoman vtkParametricSpline vtkParametricSuperEllipsoid vtkParametricSuperToroid vtkParametricTorus Demonstration of of the vtkParametric* classes added by Andrew Maclean. All the objects are displayed in a 4X4 array.
ParametricObjectsDemo2(python) vtkParametricBohemianDome vtkParametricBour vtkParametricCatalanMinimal vtkParametricHenneberg vtkParametricKuen vtkParametricPluckerConoid vtkParametricPseudosphere Demonstration of additional vtkParametric* classes added by Tim Meehan. All the objects are displayed in a 4X2 array.
ParametricSuperEllipsoidDemo(python) vtkParametricSuperEllipsoid Interactively change the parameters for a SuperEllipsoid Surface.
ParametricSuperToroidDemo(python) vtkParametricSuperToroid Interactively change the parameters for a SuperToroid Surface.

Implicit Functions and Iso-surfaces

Example Name Classes Demonstrated Description Image
BandedPolyDataContourFilter vtkBandedPolyDataContourFilter Create filled contours.
ContourTriangulator vtkMarchingSquares vtkContourTriangulator Create a contour from a structured point set (image) and triangulate it.
CutWithCutFunction vtkCutter Cut a surface with an implicit plane using vtkCutter.
CutWithScalars(python) vtkContourFilter Cut a surface with scalars.
DiscreteMarchingCubes vtkDiscreteMarchingCubes Generate surfaces from labeled data.
ExtractData(python) vtkSampleFunction Implicit functions used to select data: Two ellipsoids are combined using the union operation used to select voxels from a volume. Voxels are shrunk 50 percent.
ExtractLargestIsosurface vtkPolyDataConnectivityFilter Extract largest isosurface.
FilledContours vtkContourFilter Create filled contours (using vtkClipPolyData).
Hello(python) vtkImplicitModeller Implicit modelling used to thicken a stroked font.
IceCream(python) vtkImplicitBoolean vtkSampleFunction How to use boolean combinations of implicit functions to create a model of an ice cream cone.
ImplicitDataSet(python) vtkImplicitDataSet Convert an imagedata to an implicit function.
ImplicitSphere(python) vtkSphere An implicit representation of a sphere.
IsoContours vtkContourFunction Visualize different isocontours using a slider.
Lorenz(python) vtkContourFilter Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume.
MarchingCases(python) vtkMarchingCubes Explore the Marching Cubes cases.
MarchingCasesA(python) vtkMarchingCubes The 256 possible cases have been reduced to 15 cases using symmetry.
MarchingCasesB(python) vtkMarchingCubes Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed.
MarchingCasesC(python) vtkMarchingCubes Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label.
MarchingCasesD(python) vtkMarchingCubes Marching cubes. Case 7 is rotated 180 degrees about the y-axis with no label.
MarchingCubes vtkMarchingCubes Create a voxelized sphere.
MarchingSquares vtkMarchingSquares Create a contour from a structured point set (image).
SampleFunction vtkSampleFunction Sample and visualize an implicit function.
SmoothDiscreteMarchingCubes vtkDiscreteMarchingCubes vtkWindowedSincPolyDataFilter Generate smooth surfaces from labeled data.

Working with 3D Data

Example Name Classes Demonstrated Description Image
AlignFrames vtkLandmarkTransform Align coordinate frames.
AppendFilter vtkAppendFilter Append different types of data,
BooleanOperationPolyDataFilter(python) vtkBoleanOperationPolyDataFilter Perform boolean operations on two vtkPolyData objects.
Bottle(python) vtkRotationalExtrusionFilter Rotationally symmetric objects.
CellCenters vtkCellCenters Compute points at the center of every cell.
CellCentersDemo vtkCellCenters vtkGlyph3DMapper Visualize points at the center of every cell.
CellEdgeNeighbors vtkPolyData::GetCellNeighbors Determine which cells share an edge with a specific cell.
CellPointNeighbors vtkPolyData::GetCellNeighbors Determine which cells share a single point with a specific cell.
CenterOfMass vtkCenterOfMass Compute the center of mass of the points.
Circle vtkCutter Create a circle by cutting through a sphere.
CleanPolyData vtkCleanPolyData Remove coincident points.
ColorCells vtkLookupTable Color individual cells of a polydata with scalar index.
ColorCellsWithRGB vtkCellData Color individual cells of a polydata with rgb colors.
ColoredPoints vtkUnsignedCharArray Add three points to a polydata and associate a color with each of them.
CombinePolyData(python) vtkAppendPolyData Combine/Append PolyData.
ConnectivityFilter vtkConnectivityFilter Color any dataset type based on connectivity.
ContoursFromPolyData vtkCutter Create contours from PolyData.
ContoursToSurface vtkVoxelContoursToSurfaceFilter Convert contours to a surface.
ConvexHull vtkHull Convex hull using vtkHull.
ConvexHullShrinkWrap vtkSmoothPolyDataFilter Convex hull using shrink wrapping.
CopyAllArrays vtkPolyData Copy all arrays from one vtkPolyData to another.
DataBounds vtkPolyData::GetBounds Get the minimum and maximum value in each dimension. (Axis aligned bounding box)
DataSetSurfaceFilter vtkDataSetSurfaceFilter Convert vtkUnstructuredGrid to vtkPolyData.
DecimatePolyline vtkDecimatePolylineFilter Decimate polyline.
DeleteCells vtkPolyData Delete a cell from a vtkPolyData
DeletePoint vtkPoints vtkPolyData
DetermineArrayDataTypes vtkPolyData Determine data types of arrays.
DistancePolyDataFilter vtkDistancePolyDataFilter Compute the distance function from one vtkPolyData to another.
EmbedPointsIntoVolume vtkGaussianSplatter Embed points into a volume.
ExternalContour vtkWindowToImageFilter vtkContourFilter Get the External Contour from Polydata.
ExtractCellsUsingPoints vtkExtractSelection vtkSelection vtkSelectionNode Extract points but bring cells that are still complete with them.
ExtractOutsideSurface vtkPolyDataConnectivityFilter Extract the outer surface of a multiple surface polydata.
ExtractPolyLinesFromPolyData vtkPolyData Extract polylines from polydata.
ExtractSelectedIds vtkExtractSelectedIds Extract selected points.
ExtractSelection(python) vtkExtractSelection Extract selection points.
ExtractSelectionCells(python) vtkExtractSelection Extract selection cells.
ExtractSelectionOriginalId vtkExtractSelection Extract selection and find correspondence between new and original Id.
ExtractVisibleCells vtkHardwareSelector Extract and highlight visible cells.
FieldData vtkFieldData Add Global Miscellaneous Data (FieldData) to a Polydata.
Finance(python) vtkGaussianSplatter Visualization of multidimensional financial data. The gray/wireframe surface represents the total data population. The red surface represents data points delinquent on loan payment.
FinanceFieldData(python) vtkGaussianSplatter Visualization of multidimensional financial data. The yellow surface represents the total data population. The red surface represents data points delinquent on loan payment.
FindAllArrayNames vtkPolyData Get the names of all of the data arrays.
FitSplineToCutterOutput vtkKochanekSpline vtkSplineFilter vtkSpline Fit a spline to cutter output.
GeometryFilter vtkGeometryFilter Convert vtkUnstructuredGrid to vtkPolyData (another way).
GetMiscCellData vtkCellData Get Miscellaneous Data from Cells in a Polydata.
GetMiscPointData vtkDoubleArray Get Miscellaneous Data from Points in a Polydata.
GradientFilter vtkGradientFilter Compute the gradient of a scalar field on a data set.
ImplicitBoolean vtkImplicitBoolean Operations include intersection and union.
ImplicitBooleanDemo vtkImplicitBoolean Demo Union, Difference and Intersection.
ImplicitModeller vtkImplicitModeller Compute the distance from an object to every point on a uniform grid.
ImplicitPolyDataDistance(python) vtkImplicitPolyDataDistance Compute the distance function in a space around a vtkPolyData.
InterpolateMeshOnGrid vtkProbeFilter Interpolate a mesh over a grid.
InterpolateTerrain vtkProbeFilter vtkProbeFilter Interpolate terrain.
IntersectionPolyDataFilter vtkIntersectionPolyDataFilter Compute the intersection of two vtkPolyData objects.
IterateOverLines vtkCellArray Iterate through the lines of a PolyData.
KMeansClustering vtkKMeansStatistics KMeans Clustering
KochanekSpline vtkKochanekSpline Create an Kochanek spline on a set of points.
KochanekSplineDemo vtkKochanekSpline Interactively change the parameters of the Kochanek spline.
LinearExtrusion vtkLinearExtrusionFilter Extrude a shape.
LoopBooleanPolyDataFilter vtkLoopBooleanOpPolyDataFilter Perform boolean operations on two vtkPolyData objects.
MaskPoints vtkMaskPoints Select a subset (mask) of a point set.
MergePoints vtkMergePoints Remove duplicate (merge) points.
MergeSelections vtkSelection vtkSelectionNode Merge selected points.
MiscCellData vtkCellData Add Miscellaneous Data to Cells in a Polydata.
MiscPointData vtkPointData vtkFloatArray Add Miscellaneous Data to Points in a Polydata.
MultiBlockMergeFilter vtkMultiBlockMergeFilter vtkMultiBlockDataSet Combine MultiBlockDataSets.
NullPoint vtkPointData Set everything in PointData at a specified index to NULL
Outline(python) vtkOutlineFilter Draw the bounding box of the data
PKMeansClustering vtkPKMeansStatistics Parallel KMeans Clustering.
ParametricSpline vtkCardinalSpline vtkParametricSpline vtkParametricFunctionSource Create a Cardinal spline on a set of points.
Perlin Noise vtkPerlinNoise
PointCellIds vtkIdFilter Generate point and cell id arrays.
PointInsideObject vtkSelectEnclosedPoints Check if a point is inside an object.
PointInsideObject2 vtkDelaunay3D vtkPolyData::FindCell This uses a Delaunay triangulation to compute a volume. This gives more of an "is inside convex hull" effect than an "is inside object".
PointsProjectedHull vtkPointsProjectedHull Convex hull of points projected onto the coordinate planes.
PolyDataCellNormals vtkCellData Add/Get Normals to/from cells in a Polydata.
PolyDataContourToImageData(python) vtkLinearExtrusionFilter vtkPolyDataToImageStencil Generate a binarized image from a closed contour.
PolyDataExtractNormals vtkPolyDataNormals Extract Normals from a Polydata.
PolyDataGetPoint vtkPolyData Get point locations/coordinates from a vtkPolyData.
PolyDataIsoLines vtkBandedPolyDataContourFilter Iso lines on the surface of a polydata
PolyDataPointNormals vtkPointData Add/Get Normals to/from points in a Polydata.
PolyDataPointSampler vtkPolyDataPointSampler Sample the edges or surfaces of a polydata.
PolyDataToImageData vtkPolyDataToImageStencil Generate a binarized volume from a closed surface.
ProcrustesAlignmentFilter vtkProcrustesAlignmentFilter Align point sets.
ProgrammableFilter vtkProgrammableFilter Create a custom filter without subclassing.
ProgrammableSource vtkProgrammableSource Create points using a programmable source. Generates points for a strange attractor.
ProjectSphere vtkProjectSphereFilter Unroll a sphere or spherical-like model.
QuantizePolyDataPoints vtkQuantizePolyDataPoints Snap (quantize) points to a grid.
Reflection vtkReflectionFilter Mirror a DataSet.
RemoveOutsideSurface vtkConnectivityFilter Remove the outer surface of a multiple surface polydata.
RemoveVertices
ResamplePolyLine
ReverseSense vtkReverseSense Flip normals.
RibbonFilter vtkRibbonFilter
RotationAroundLine(python) vtkTransform vtkTransformPolyDataFilter Rotation around a line.
RuledSurfaceFilter(python) vtkRuledSurfaceFilter Create a surface between lines.
SCurveSpline vtkSCurveSpline Create an SCurve spline on a set of points.
SelectVisiblePoints vtkSelectVisiblePoints Select visible points.
SelectionSource vtkSelectionSource vtkExtractSelection Specify a selection.
ShrinkPolyData vtkShrinkPolyData Move all items in a PolyData towards their centroid.
Silhouette vtkPolyDataSilhouette
Spring(python) vtkRotationalExtrusionFilter Rotation in combination with linear displacement and radius variation.
Stripper vtkStripper Convert triangles to triangle strips.
ThinPlateSplineTransform vtkThinPlateSplineTransform
ThresholdCells vtkThreshold Thresholding Cells.
ThresholdPoints vtkThresholdPoints Thresholding Points.
TransformFilter vtkTransformFilter Transform a data set.
TransformOrderDemo vtkTransformPolyDataFilter Demonstrate how the order of applying transforms affects the result.
TransformPipeline vtkTransform Combining the transformation, in order to manipulate a group of vtkActor. Shown in the example robot arm motion.
TransformPolyData vtkTransformPolyDataFilter Apply a Transformation to a PolyData.
TriangleArea vtkTriangle::TriangleArea Compute the area of all triangles in a polydata.
TriangleColoredPoints(python) vtkUnsignedCharArray Set the color of each point of a triangle. You will be able to interpolate the colors across the triangle.
TriangleSolidColor vtkUnsignedCharArray Create a solid colored triangle.
TubeFilter vtkTubeFilter Give lines a thickness (produce a cylinder around lines.
VectorFieldNonZeroExtraction vtkExtractSelectedThresholds Extract non-zero vectors from a vtkImageData.
VertexConnectivity vtkPolyData::GetCellPoints Get a list of vertices attached (through an edge) to a vertex.
WarpScalar vtkWarpScalar Move vertices along normals.
WarpSurface vtkWarpVector Warp a surface along its normal.
WarpTo vtkWarpTo Bend an object.
WarpVector(python) vtkWarpVector

Data Types

Example Name Classes Demonstrated Description Image
CompositePolyDataMapper vtkCompositePolyDataMapper
Generate2DAMRDataSetWithPulse vtkAMRBox vtkOverlappingAMR vtkUniformGrid vtkXMLHierarchicalBoxDataSetWriter Generates sample 2-D AMR dataset.
Generate3DAMRDataSetWithPulse vtkAMRBox vtkOverlappingAMR vtkUniformGrid vtkXMLHierarchicalBoxDataSetWriter Generates sample 3-D AMR dataset.
MultiBlockDataSet vtkMultiBlockDataSet Demonstrates how to make and use VTK's MultiBlock type data
OverlappingAMR vtkOverlappingAMR Demonstrates how to create and populate a VTK's Overlapping AMR Grid type Data

Data Type Conversions

Example Name Classes Demonstrated Description Image
PolyDataToUnstructuredGrid vtkAppendFilter Convert a vtkPolyData to a vtkUnstructuredGrid.

Point Cloud Operations

Example Name Classes Demonstrated Description Image
CompareExtractSurface vtkExractSurface Compare three extract surface algorithms.
DensifyPoints vtkDensifyPointCloudFilter Add points to a point cloud.
DownsamplePointCloud vtkCleanPolyData Down sample a point cloud. Remove points so that there are no points within a tolerance of any point.
ExtractClusters vtkEuclideanClusterExtraction From a set of randomly distributed spheres, extract connected clusters.
ExtractPointsDemo vtkExtractPoints Extract points inside an implicit function.
ExtractSurface vtkExtractSurface vtkPCANormalEstimation vtkSignedDistance Create a surface from Unorganized Points using Point filters.
ExtractSurfaceDemo vtkExtractSurface vtkPCANormalEstimation vtkSignedDistance Create a surface from Unorganized Points using Point filters (DEMO).
FitImplicitFunction vtkFitImplicitFunction Extract points within a distance to an implicit function.
MaskPointsFilter vtkMaskPointsFilter Extract points within an image mask.
NormalEstimation vtkPCANormalEstimation Estimate the normals of a random points that lie on a sphere.
PointOccupancy vtkPointOccupancyFilter Show which voxels contain points.
PointSource vtkPointSource Generate a random point cloud.
PoissonExtractSurface Create a surface from Unorganized Points using the PoissonReconstruction algorithm.
PowercrustExtractSurface Create a surface from Unorganized Points using the Powercrust algorithm.
RadiusOutlierRemoval vtkRadiusOutlierRemoval Remove outliers.
SignedDistance vtkSignedDistance Compute signed distance to a point cloud.
UnsignedDistance vtkUnsignedDistance Compute unsigned distance to a point cloud.

Working with Meshes

Example Name Classes Demonstrated Description Image
AddCell vtkPolyData Add a cell to an existing mesh.
BoundaryEdges vtkFeatureEdges Find the edges that are used by only one face.
CellEdges vtkCell Get edges of cells.
ClosedSurface vtkFeatureEdges Check if a surface is closed.
ColorDisconnectedRegions vtkPolyDataConnectivityFilter Color each disconnected region of a vtkPolyData a different color.
ColoredElevationMap vtkLookupTable Color a mesh by height.
Curvatures vtkCurvatures Compute Gaussian, Mean, Min, and Max Curvatures.
Decimation vtkDecimatePro Reduce the number of triangles in a mesh.
DeformPointSet vtkDeformPointSet Deform a point set with a control polyhedra.
DelaunayMesh(python) vtkDelaunay2D vtkMinimalStandardRandomSequence vtkExtractEdges vtkGlyph3D vtkTubeFilter Two-dimensional Delaunay triangulation of a random set of points. Points and edges are shown highlighted with sphere glyphs and tubes.
DijkstraGraphGeodesicPath vtkDijkstraGraphGeodesicPath Find the shortest path between two points on a mesh.
ElevationFilter vtkElevationFilter Color a mesh by height.
ExtractEdges vtkExtractEdges
FillHoles vtkFillHolesFilter Close holes in a mesh.
GreedyTerrainDecimation vtkGreedyTerrainDecimation Create a mesh from an ImageData
HighlightBadCells vtkMeshQuality
IdentifyHoles vtkFillHolesFilter Close holes in a mesh and identify the holes.
ImplicitSelectionLoop vtkImplicitSelectionLoop Select a region of a mesh with an implicit function.
LargestRegion vtkPolyDataConnectivityFilter Extract the largest connected region in a polydata.
MatrixMathFilter vtkMatrixMathFilter Compute various quantities on cell and points in a mesh.
MeshQuality vtkMeshQuality
OBBDicer vtkOBBDicer Breakup a mesh into pieces.
PolygonalSurfaceContourLineInterpolator vtkPolygonalSurfaceContourLineInterpolator Interactively find the shortest path between two points on a mesh.
QuadricClustering vtkQuadricClustering Reduce the number of triangles in a mesh.
QuadricDecimation vtkQuadricDecimation Reduce the number of triangles in a mesh.
SelectPolyData vtkSelectPolyData Select a region of a mesh.
SimpleElevationFilter vtkSimpleElevationFilter Color a mesh by dotting a vector from the origin to each point with a specified vector.
SmoothPolyDataFilter vtkSmoothPolyDataFilter Laplacian smoothing.
SpecifiedRegion vtkPolyDataConnectivityFilter Extract a specific (specified) connected region in a polydata.
SplitPolyData vtkOBBDicer Breakup a mesh into pieces and save the pieces into files
Subdivision vtkButterflySubdivisionFilter vtkLoopSubdivisionFilter vtkLinearSubdivisionFilter Increase the number of triangles in a mesh.
Triangulate vtkTriangleFilter Convert all polygons in a mesh to triangles.
WeightedTransformFilter vtkWeightedTransformFilter
WindowedSincPolyDataFilter vtkWindowedSincPolyDataFilter Smooth a mesh (windowed sinc filter).

Clipping

Example Name Classes Demonstrated Description Image
BoxClipStructuredPoints vtkBoxClipDataSet vtkStructuredPoints Clip vtkStructuredPoints with a box. The results are unstructured grids with tetrahedra.
BoxClipUnstructuredGrid vtkBoxClipDataSet vtkUnstructuredGrid Clip a vtkUnstructuredGrid with a box. The results are unstructured grids with tetrahedra.
CapClip vtkClipPolyData Cap a clipped polydata with a polygon.
ClipClosedSurface vtkClipClosedSurface Clip a surface with multiple planes.
ClipDataSetWithPolyData(python) vtkClipDataSet vtkImplicitPolyDataDistance vtkRectilinearGrid Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. Contrast this with the next example.
ClipFrustum vtkFrustumSource vtkClipPolyData Clip a vtkPolyData with the vtkCamera's view frustum.
GenericClip vtkGenericClip vtkBridgeDataSet vtkGenericDataSet
ImplicitDataSetClipping vtkImplicitDataSet Clip using an implicit data set.
SolidClip vtkClipPolyData Create a "solid" clip.
TableBasedClipDataSetWithPolyData vtkTableBasedClipDataSet vtkImplicitPolyDataDistance vtkRectilinearGrid Clip a vtkRectilinearGrid with arbitrary polydata. In this example, use a vtkConeSource to generate polydata to slice the grid, resulting in an unstructured grid. Contrast this with the previous example.

Working with Structured 3D Data

This section includes vtkImageData vtkStructuredGrid and vtkRectilinearGrid.

"ImageData" is not the traditional "flat, 2D image" you are used to. It is a special VTK data structure in the collection of 3D data structures provided by VTK. Here is an overview of these data structures. Image data can represent at typical 2D image, but also, a 3D volume.

vtkImageData

Example Name Classes Demonstrated Description Image
CellIdFromGridCoordinates vtkStructuredData Get the id of a cell from its grid coordinates.
ExtractVOI vtkExtractVOI Extract a volume of interest (subvolume).
GetCellCenter vtkImageData Get the coordinates of the center of a cell.
ImageIterator vtkImageIterator
ImageIteratorDemo vtkImageIterator Demonstrate using an iterator to access pixels in a region.
ImageNormalize vtkImageNormalize Normalize an image.
ImageReslice vtkImageReslice Resize a vtkImageData.
ImageTranslateExtent vtkImageTranslateExtent Change the extent of a vtkImageData.
ImageWeightedSum(python) vtkImageWeightedSum Add two or more images.
IntersectLine vtkImageData Intersect a line with all cells of a vtkImageData.
IterateImageData vtkImageData Iterating over a vtkImageData.

Conversions

Example Name Classes Demonstrated Description Image
ImageDataGeometryFilter vtkImageDataGeometryFilter Convert a vtkImageData to a vtkPolyData
ImageDataToPointSet vtkImageDataToPointSet Convert a vtkImageData to a vtkStructuredGrid.

vtkStructuredGrid

Example Name Classes Demonstrated Description Image
BlankPoint vtkStructuredGrid Blank a point of a vtkStructuredGrid.
GetLinearPointId vtkStructuredGrid Get the linear point id of a point in a grid.
SGrid(python) vtkStructuredGrid Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction.
StructuredGrid vtkStructuredGrid Structured Grid.
StructuredGridOutline vtkStructuredGridOutlineFilter Visualize the outline of a structured grid.
VisualizeStructuredGrid vtkStructuredGridGeometryFilter Visualize the points of a structured grid.
VisualizeStructuredGridCells vtkShrinkFilter Visualize the cells of a structured grid.

vtkStructuredPoints

Example Name Classes Demonstrated Description Image
StructuredPointsToUnstructuredGrid vtkStructuredPoints vtkUnstructuredGrid Convert a vtkStructuredPoints to a vtkUnstructuredGrid.
Vol(python) vtkStructuredPoints vtkContourFilter Creating a image data dataset. Scalar data is generated from the equation for a sphere. Volume dimensions are 26 x 26 x 26.

vtkRectilinearGrid

Example Name Classes Demonstrated Description Image
RGrid(python) vtkRectilinearGrid Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray.
RectilinearGrid(python) vtkRectilinearGrid Rectilinear grid
RectilinearGridToTetrahedra vtkRectilinearGridToTetrahedra Convert a vtkRectilinearGrid to a vtkUnstructuredGrid mesh
VisualizeRectilinearGrid vtkRectilinearGrid vtkShrinkFilter Visualize the cells of a rectilinear grid

Working with Unstructured 3D Data

This section includes vtkUnstructuredGrid.

vtkUnstructuredGrid

Example Name Classes Demonstrated Description Image
UGrid(python) vtkUnstructuredGrid Creation of an unstructured grid.

Registration

Example Name Classes Demonstrated Description Image
IterativeClosestPointsTransform vtkIterativeClosestPointTransform Iterative Closest Points (ICP) Transform.
LandmarkTransform vtkLandmarkTransform Landmark Transform.

Medical

Example Name Classes Demonstrated Description Image
GenerateCubesFromLabels vtkMetaImageReader vtkMaskFields Create cubes from labeled volume data.
GenerateModelsFromLabels vtkDiscreteMarchingCubes vtkWindowedSincPolyDataFilter Create models from labeled volume data vtkDiscreteMarchingCubes).
MedicalDemo1(python) vtkMarchingCubes Create a skin surface from volume data
MedicalDemo2(python) vtkMarchingCubes Create a skin and bone surface from volume data
MedicalDemo3(python) vtkMarchingCubes Create skin, bone and slices from volume data
MedicalDemo4(python) vtkFixedPointVolumeRayCastMapper Create a volume rendering
TissueLens vtkMarchingCubes vtkClipDataSet vtkProbeFilter Cut a volume with a sphere

Surface reconstruction

Example Name Classes Demonstrated Description Image
Delaunay3D vtkDelaunay3D Create a solid mesh from Unorganized Points.
Delaunay3DDemo vtkDelaunay3D Interactively adjust Alpha for Delaunay3D.
ExtractSurface vtkExtractSurface vtkPCANormalEstimation vtkSignedDistance Create a surface from Unorganized Points using Point filters.
ExtractSurfaceDemo vtkExtractSurface vtkPCANormalEstimation vtkSignedDistance Create a surface from Unorganized Points using Point filters (DEMO).
GaussianSplat vtkGaussianSplatter Create a surface from Unorganized Points (Gaussian Splat).
SurfaceFromUnorganizedPoints vtkSurfaceReconstructionFilter Create a surface from Unorganized Points.
SurfaceFromUnorganizedPointsWithPostProc vtkSurfaceReconstructionFilter Create a surface from Unorganized Points (with post processing).
TriangulateTerrainMap vtkDelaunay2D Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface.

Utilities

Example Name Classes Demonstrated Description Image
BoundingBox vtkBoundingBox Bounding Box construction.
BoundingBoxIntersection vtkBoundingBox Box intersection and Inside tests.
Box vtkBoundingBox Intersect a box with a ray.
BrownianPoints vtkBrownianPoints Produce a random vector at each point in a dataset.
CardinalSpline vtkCardinalSpline Cardinal spline Interpolation.
Casting vtkObject::SafeDownCast Casting VTK objects.
CheckVTKVersion vtkVersion Check VTK Version.
ColorLookupTable vtkLookupTable Color Lookup Table.
ColorTransferFunction vtkColorTransferFunction Color Transfer Function.
CommandSubclass vtkCommand Instead of using a callback function, it is more powerful to subclass vtkCommand.
ConstrainedDelaunay2D vtkDelaunay2D Perform a 2D Delaunay triangulation on a point set respecting a specified boundary.
Coordinate vtkCoordinate Coordinate system conversions.
DeepCopy Deep copy a VTK object.
Delaunay2D(python) vtkDelaunay2D Perform a 2D Delaunay triangulation on a point set.
DetermineActorType vtkActor vtkActorCollection Determine the type of an actor.
DiscretizableColorTransferFunction vtkDiscretizableColorTransferFunction Discretizable Color Transfer Function.
ExtractFaces vtkCellIterator Extract faces froam vtkUnstructuredGrid.
FileOutputWindow vtkFileOutputWindow Write errors to a log file instead of the screen.
FilenameFunctions vtkDirectory vtksys/SystemTools Do things like get the file extension, strip the file extension, etc.
FilterSelfProgress Monitor a filters progress.
FrameRate Get the frame rate of the rendering.
FullScreen vtkRenderWindow Maximize/full screen a vtkRenderWindow.
FunctionParser vtkFunctionParser String function parser.
GetClassName GetClassName() Determine the type of a VTK variable.
GetDataRoot vtkTesting Find the path of VTK_DATA_ROOT.
LUTUtilities(python) vtkLookupTable vtkColorSeries A utility class for vtkLookupTable allowing you to output the table contents or to compare tables.
MassProperties vtkMassProperties Compute volume and surface area of a closed, triangulated mesh.
MultipleRenderWindows vtkRenderWindow Multiple Render Windows
MultipleViewports(python) vtkRenderer::SetViewPort Multiple Viewports.
OffScreenRendering vtkImagingFactory vtkGraphicsFactory Off Screen Rendering.
PCADemo vtkPCAStatistics Project 2D points onto the best 1D subspace (PCA Demo).
PCAStatistics vtkPCAStatistics Compute Principal Component Analysis (PCA) values.
PassThrought vtkPassThrough Pass input along to outpu.
PiecewiseFunction vtkPiecewiseFunction Interpolation using a piecewise function.
PointInPolygon vtkPolygon Point inside polygon test.
ReportRenderWindowCapabilities vtkRenderWindow Report the capabilities of a render window.
SaveSceneToFieldData(python) vtkCamera Save a vtkCamera's state in a vtkDataSet's vtkFieldData and restore it.
SaveSceneToFile(python) vtkCamera Save a vtkCamera's state in a file and restore it.
Screenshot(python) vtkWindowToImageFilter
ShallowCopy Shallow copy a VTK object.
ShareCamera vtkRenderer vtkCamera Share a camera between multiple renderers.
ShepardMethod vtkShepardMethod Shepard method interpolation.
SideBySideViewports vtkRenderer::SetViewPort Side by side viewports.
TimeStamp vtkTimeStamp Time stamp.
Timer vtkRenderWindowInteractor::CreateRepeatingTimer
TimerLog vtkTimerLog Timer log.
Variant(python) vtkVariant Convert between data types.
Vector vtkVector Mathematical vector class.
VersionMacros Macro/#define's Check VTK Version.
ViewportBorders Draw a border around each viewport.
VisualDebugging Update the screen from inside an algorithm.
ZBuffer vtkRenderer zbuffer.

Arrays

Example Name Classes Demonstrated Description Image
2DArray vtkDenseArray 2D Array.
3DArray vtkDenseArray 3D Array.
ArrayCalculator vtkArrayCalculator Perform in-place operations on arrays.
ArrayLookup vtkDataArray Find the location of a value in a vtkDataArray.
ArrayRange vtkFloatArray::GetRange Get the bounds (min,max) of a vtk array.
ArrayToTable vtkArrayToTable Convert a vtkDenseArray to a vtkTable.
ArrayWriter vtkArrayWriter Write a DenseArray or SparseArray to a file.
ConstructTable vtkTable A table is a 2D array of any type of elements. They do not all have to be the same type. This is achieved using vtkVariant.
CustomDenseArray vtkDenseArray Custom type Dense (2D) Array.
DenseArrayRange vtkDenseArray vtkArrayRange Get the bounds of a vtkDenseArray.
ExtractArrayComponent vtkArrayCalculator Extract a component of an array.
KnownLengthArray vtkFloatArray Known Length Array.
SortDataArray vtkSortDataArray Reorder array values based on an ordering (key) array.
SparseArray vtkSparseArray Sparse Array.
UnknownLengthArray vtkFloatArray Unknown Length Array.
VectorArrayKnownLength vtkFloatArray Array of Vectors (Known Length).
VectorArrayUnknownLength vtkFloatArray Array of Vectors (Unknown Length).

Events

Example Name Classes Demonstrated Description Image
CameraModifiedEvent vtkCameraWindow Catch the camera modified event.
ObserveError vtkCommand Catch errors and warnings.
WindowModifiedEvent vtkRenderWindow Catch the window modified event.

CMake Techniques

Example Name Classes Demonstrated Description Image
Check VTK Version in CMake
Check if a specific module is present

Math Operations

Example Name Classes Demonstrated Description Image
1DTupleInterpolation vtkTupleInterpolator vtkCardinalSpline vtkKochanekSpline A simple example demonstrating how functions defined by sparsely distributed supporting points can be interpolated at arbitrary positions.
EigenSymmetric vtkMath::Jacobi Compute eigenvalues and eigenvectors of a symmetric matrix.
HomogeneousLeastSquares vtkMath::SolveHomogeneousLeastSquares Homogeneous Least Squares.
LUFactorization vtkMath LU Factorization.
LeastSquares vtkMath::SolveLeastSquares Least Squares.
MatrixInverse vtkMatrix3x3 Matrix inverse.
MatrixTranspose vtkMatrix3x3 Matrix transpose.
NormalizeVector vtkMath Normalize a vector.
PerpendicularVector vtkMath::Perpendiculars Get a vector perpendicular to another vector.
VectorDot vtkVectorDot
VectorNorm vtkVectorNorm Get the lengths of an array of vectors.

Graphs

Example Name Classes Demonstrated Description Image
AdjacencyMatrixToEdgeTable vtkAdjacencyMatrixToEdgeTable Convert an adjacency matrix to an edge table.
AdjacentVertexIterator vtkAdjacentVertexIterator Get all vertices connected to a specified vertex.
BoostBreadthFirstSearchTree vtkBoostBreadthFirstSearchTree Breadth first search tree. Can also be used to convert a graph to a tree.
BreadthFirstDistance vtkBoostBreadthFirstSearch Distance from origin.
ColorEdges vtkGraphLayoutView Color edges.
ColorVertexLabels vtkGraphLayoutView vtkRenderedGraphRepresentation Set the color of vertex labels.
ColorVerticesLookupTable vtkGraphLayoutView Color vertices.
ConnectedComponents vtkBoostConnectedComponents Find connected components of a graph.
ConstructGraph vtkMutableUndirectedGraph Construct a graph.
ConstructTree vtkTree vtkMutableDirectedGraph Construct a tree.
DepthFirstSearchAnimation vtkTreeDFSIterator Depth First Search Animation.
DepthFirstSearchIterator vtkTreeDFSIterator Depth First Search iterator.
EdgeListIterator vtkEdgeListIterator Iterate over edges of a graph.
EdgeWeights(python) vtkGraph::GetEdgeData::AddArray Edge weights.
GraphPoints vtkGraph::SetPoints, vtkPassThroughLayoutStrategy Manually set coordinates of vertices in a graph.
GraphToPolyData vtkGraphToPolyData Convert a graph to a PolyData.
InEdgeIterator vtkInEdgeIterator Iterate over edges incoming to a vertex.
LabelVerticesAndEdges vtkGraphLayoutView Label vertices and edges.
MinimumSpanningTree vtkBoostPrimMinimumSpanningTree Minimum spanning tree of a graph.
MutableGraphHelper vtkMutableGraphHelper Create either a vtkMutableDirectedGraph or vtkMutableUndirectedGraph.
NOVCAGraph(python) vtkUnstructuredGrid vtkXMLUnstructuredGridWriter vtkPolyLine Create a graph & visualize it in ParaView/VisIt.
OutEdgeIterator vtkOutEdgeIterator Iterate over edges outgoing from a vertex.
RandomGraphSource vtkRandomGraphSource Create a random graph.
RemoveIsolatedVertices vtkRemoveIsolatedVertices Remove vertices of degree 0 from a vtkGraph.
ScaleVertices vtkGraphLayoutView vtkRenderedGraphRepresentation Size/scale vertices based on a data array.
SelectedVerticesAndEdges(python) vtkAnnotationLink Get a list of selected vertices and edges.
SelectedVerticesAndEdgesObserver vtkAnnotationLink Get a list of selected vertices and edges using an observer of AnnotationChangedEvent.
ShortestPath vtkDijkstraGraphGeodesicPath Find the shortest path on a graph.
SideBySideGraphs vtkGraphLayoutView Display two graphs side by side.
TreeBFSIterator vtkTreeBFSIterator Breadth First Search iterator.
VertexSize vtkGraphLayoutView vtkRenderedGraphRepresentation Set the size of vertices.
VisualizeDirectedGraph vtkGlyphSource2D Visualize a directed graph.
VisualizeGraph(python) vtkGraphLayoutView vtkGraphLayoutStrategy vtkSimple2DLayoutStrategy Visualize a graph.

Graph Conversions

Example Name Classes Demonstrated Description Image
DirectedGraphToMutableDirectedGraph vtkMutableDirectedGraph vtkDirectedGraph vtkDirectedGraph to vtkMutableDirectedGraph.
MutableDirectedGraphToDirectedGraph vtkMutableDirectedGraph vtkDirectedGraph vtkMutableDirectedGraph to vtkDirectedGraph.
TreeToMutableDirectedGraph vtkMutableDirectedGraph vtkTree vtkTree to vtkMutableDirectedGraph

Data Structures

Example Name Classes Demonstrated Description Image
AttachAttributes vtkInformation Attach attributes to a VTK array
CellLocator vtkCellLocator Project a point onto a mesh. Closest point on a mesh.Efficient 3D cell query.
CellLocatorVisualization vtkCellLocator Visualization of the tree of a vtkCellLocator.
CellTreeLocator vtkCellTreeLocator Points inside an object using vtkCellTreeLocator.
PointLocator vtkPointLocator Efficient 3D point query.
PointLocatorRadius vtkPointLocator Find all points within a radius of a specified point.
PointLocatorVisualization vtkPointLocator Visualization of the tree of a vtkPointLocator.

Timing Demonstrations

Example Name Classes Demonstrated Description Image
KDTreeTimingDemo vtkKdTreePointLocator Plot the runtime vs MaxLevel (doesn't seem correct)
ModifiedBSPTreeTimingDemo vtkModifiedBSPTree Plot the runtime vs MaxLevel
OBBTreeTimingDemo vtkOBBTree Plot the runtime vs MaxLevel
OctreeTimingDemo vtkOctreePointLocator Plot the runtime vs MaxPointsPerRegionOctree timing demo.

KD-Tree

Example Name Classes Demonstrated Description Image
BuildLocatorFromKClosestPoints vtkKdTree
ClosestNPoints vtkKdTreePointLocator Find the closest N points to a query point.
DataStructureComparison vtkKdTree vtkOBBTree vtkOctreePointLocator vtkModifiedBSPTree Illustrates, side by side, the differences between several spatial data structures
KDTreeAccessPoints vtkKdTree Access the points of a KDTree.
KDTreeFindPointsWithinRadius vtkKdTreePointLocator Find points within a specified radius of a query point.
KdTree vtkKdTree
KdTreePointLocatorClosestPoint vtkKdTreePointLocator Find the closest point to a query point.
VisualizeKDTree vtkKdTreePointLocator Visualize levels of the tree.

Oriented Bounding Box (OBB) Tree

Example Name Classes Demonstrated Description Image
OBBTreeExtractCells vtkOBBTree Intersect a line with an OBB Tree and display all intersected cells.
OBBTreeIntersectWithLine vtkOBBTree Intersect a line with a vtkOBBTree.
VisualizeOBBTree vtkOBBTree Visualize levels of the tree.

Octree

Example Name Classes Demonstrated Description Image
BuildOctree vtkOctreePointLocator Create an octree.
IncrementalOctreePointLocator vtkIncrementalOctreePointLocator Insert points into an octree without rebuilding it.
OctreeClosestPoint vtkOctreePointLocator Find the closest point to a query point.
OctreeFindPointsWithinRadius vtkOctreePointLocator Find the points within a sphere of specified radius to a query point.
OctreeKClosestPoints vtkOctreePointLocator Find the K closest points to a query point.
OctreeVisualize vtkOctreePointLocator Visualize levels of the tree.

Modified BSP Tree

Example Name Classes Demonstrated Description Image
ModifiedBSPTreeExtractCells vtkModifiedBSPTree Intersect a line with a modified BSP Tree and display all intersected cells.
ModifiedBSPTreeIntersectWithLine vtkModifiedBSPTree Intersect a line with a modified BSP Tree.
VisualizeModifiedBSPTree vtkModifiedBSPTree Visualize levels of the tree.

HyperTreeGrid

Example Name Classes Demonstrated Description Image
HyperTreeGridSource vtkHyperTreeGridSource Create a vtkHyperTreeGrid.

VTK Concepts

Example Name Classes Demonstrated Description Image
Scalars VTKConcepts Attach a scalar value to each point (PointData) or cell (CellData) in a data set.

Rendering

Example Name Classes Demonstrated Description Image
AmbientSpheres vtkProperty Demonstrates the effect of ambient lighting on spheres.
CameraBlur(python) Example of a scene rendered with focal depth.
ColoredSphere(python) vtkSphereSource vtkElevationFilter A simple sphere.
Cone3(python) vtkRenderWindow Four frames of output, based on the VTK example Cone3.cxx.
Cone4(python) vtkRenderWindow Modifying properties and transformation matrix based on the VTK example Cone4.cxx.
CylinderRenderingProperties vtkProperty Change the properties of a cylinder.
DiffuseSpheres vtkProperty Demonstrates the effect of diffuse lighting on spheres.
FlatVersusGouraud(python) vtkProperty::SetInterpolationToFlat vtkProperty::SetInterpolationToGouraud Flat and Gouraud shading. Different shading methods can dramatically improve the look of an object represented with polygons. On the top, flat shading uses a constant surface normal across each polygon. On the bottom, Gouraud shading interpolates normals from polygon vertices to give a smoother look.
Mace(python) An example of multiple inputs and outputs.
Model(python) vtkRenderer vtkRenderWindow vtkRenderWindowInteractor Illustrative diagram of graphics objects.
MotionBlur(python) vtkRenderStepsPass vtkSimpleMotionBlurPass Example of motion blur.
Rainbow(python) vtkLookupTable Use and manipulation of vtkLookupTables.
Rotations(python) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Rotations of a cow about her axes.
RotationsA(python) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Perform six rotations of a cow about her x-axis (Figure 3-31a).
RotationsB(python) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Perform six rotations of a cow about her y-axis (Figure 3-31b).
RotationsC(python) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Perform six rotations of a cow about her z-axis (Figure 3-31c).
RotationsD(python) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff First a rotation of a cow about her x-axis, then six rotations about her y-axis (Figure 3-31d).
SpecularSpheres(python) vtkProperty Demonstrates the effect of specular lighting on spheres.
StippledLine vtkTexture Draw a stippled line.
StripFran(python) vtkDecimatePro vtkStripper Triangle strip examples. (a) Structured triangle mesh consisting of 134 strips each of 390 triangles. (b) Unstructured triangle mesh consisting of 2227 strips of average length 3.94, longest strip 101 triangles. Images are generated by displaying every other triangle strip.
TransformSphere(python) vtkSphereSource vtkElevationFilter vtkTransform vkTransformFilter The addition of a transform filter to ColoredSphere.
WalkCow(python) vtkBYUReader vtkRenderWindow::EraseOff() vtkActor This generates Figs. 3-32, 3-33 found in VTKTextbook.pdf.
WalkCowA(python) vtkBYUReader vtkRenderWindow::EraseOff() vtkActor This generates Fig. 3-33a found in VTKTextbook.pdf.
WalkCowB(python) vtkBYUReader vtkRenderWindow::EraseOff() vtkActor This generates Fig. 3-33b found in VTKTextbook.pdf.

Lighting

Example Name Classes Demonstrated Description Image
Light vtkLight Add a directional light to a scene.
LightActor vtkLightActor Display the location and direction of a light.
Shadows vtkShadowMapPass Create shadows.
SpotLights vtkLight Create two positional(spot) lights.

Shaders

Example Name Classes Demonstrated Description Image
BozoShader vtkShaderProgram vtkOpenGLPolyDataMapper::AddShaderReplacement Modify the shader to load and use noise functions for color selection.
BozoShaderDemo vtkShaderProgram vtkOpenGLPolyDataMapper::AddShaderReplacement Show the bozo shader on a variety of polydata models.
ColorByNormal vtkOpenGLPolyDataMapper vtkTriangleMeshPointNormals Modify the shader to color based on model normal.
CubeMap vtkShaderProgram vtkOpenGLPolyDataMapper Modify the Vertex and Frament shaders to apply a 6-sided cube map.
MarbleShader vtkShaderProgram vtkOpenGLPolyDataMapper::AddShaderReplacement Modify the shader to load and use noise functions for color selection.
MarbleShaderDemo vtkShaderProgram vtkOpenGLPolyDataMapper::AddShaderReplacement Explore parameter space with sliders.
SpatterShader vtkShaderProgram vtkOpenGLPolyDataMapper::AddShaderReplacement Modify the shader to load and use noise functions for color selection.
SphereMap vtkShaderProgram vtkOpenGLPolyDataMapper Modify the Vertex and Frament shaders to apply a spherical map.

Texture Mapping

Example Name Classes Demonstrated Description Image
AnimateVectors(python) vtkTexture vtkGlyph3D One frame from a vector field animation using texture maps (animVectors.tcl).
BackgroundTexture vtkRenderer vtkTexture Use a texture for the background of a vtkRenderer.
ClipArt vtkTextureMapToPlane Generate 3D clip art from an image.
ProjectedTexture vtkProjectedTexture Project a texture onto vtkPolyData.
TextureCutQuadric(python) vtkBooleanTexture vtkImplicitTextureCoords Cut a quadric with boolean textures.
TextureCutSphere(python) vtkImplicitTextureCoords Cut a sphere using texture coordinates.
TextureMapImageData vtkImageCanvasSource2D Texture map an ImageData.
TextureMapPlane vtkTextureMapToPlane Texture map a plane.
TextureMapQuad vtkPolygon vtkPolyData Texture map a quad.
TexturePlane(python) vtkTexture Example of texture mapping.
TextureThreshold(python) vtkTexture vtkThresholdTextureCoords vtkStructuredGridGeometryFilter Demonstrate the use of scalar thresholds to show values of flow density on three planes.
TexturedSphere vtkTextureMapToSphere Texture a sphere.

Visualization

See this tutorial for a brief explanation of the VTK terminology of mappers, actors, etc.

Example Name Classes Demonstrated Description Image
AlphaFrequency(python) vtkLinearExtrusionFilter vtkVectorText Linearly extrude fonts to show letter frequencies in text.
AnatomicalOrientation(python) vtkAnnotatedCubeActor vtkAxesActor vtkOrientationMarkerWidget vtkTransform Show a labelled set of anatomical planes transecting a human figure.
AnnotatedCubeActor vtkAnnotatedCubeActor Annotated cube.
Arbitrary3DCursor vtkPointWidget Track a 3D cursor.
AssignCellColorsFromLUT(python) vtkNamedColors vtkPlaneSource vtkLookupTable vtkColorTransferFunction Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables.
BackfaceCulling vtkActor Backface culling.
BackgroundColor vtkRenderer Background color.
BackgroundGradient vtkRenderer vtkRenderer Background gradient.
BillboardTextActor3D vtkBillboardTextActor3D Label points with billboards.
BlobbyLogo(python) vtkImplicitModeller Blobby logo from VTK textbook.
Blow(python) vtkUnstructuredGridReader vtkWarpVector vtkConnectivityFilter Ten frames from a blow molding finite element analysis.
BluntStreamlines(python) vtkStructuredGridGeometryFilter vtkStreamTracer Demonstrates airflow around a blunt fin using streamlines.
Camera(python) vtkCamera Positioning and aiming the camera.
CameraActor vtkCameraActor Visualize a camera (frustum) in a scene.
CameraModel1(python) vtkCameraActor Illustrate camera movement.
CameraModel2(python) vtkCameraActor Illustrate camera movement.
CaptionActor2D vtkCaptionActor2D Draw a caption/bubble pointing to a particular point.
CarotidFlow(python) vtkStreamTracer vtkThresholdPoints Visualizing blood flow in the human carotid arteries. Streamtubes of flow velocity are generated.
CarotidFlowGlyphs(python) vtkGlyph3D vtkThresholdPoints Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude.
ChooseTextColor vtkTextActor vtkTextProperty::SetFontFamily vtkNamedColors Choose a text color that contrasts with a background color.
ChooseTextColorDemo vtkTextActor vtkNamedColors Create a grid of random colored viewpports and pick a good text color.
ClipSphereCylinder(python) vtkImplicitBoolean vtkClipPolyData A plane clipped with a sphere and an ellipse. The two transforms place each implicit function into the appropriate position. Two outputs are generated by the clipper.
CloseWindow vtkRenderWindowInteractor vtkRenderWindow Close a render window.
ColorActorEdges vtkActor Color the edges of an Actor.
ColorAnActor vtkActor Color an Actor.
ColorGlyphs vtkGlyph3D vtkGlyph3D Color glyphs.
CombustorIsosurface(python) vtkContourFilter Marching cubes surface of flow density.
ComplexV(python) vtkHedgeHog ComplexV from the VTK Textbook.
ContourQuadric(python) vtkQuadric vtkSampleFunction vtkContourFilter Contouring a quadric function.
CornerAnnotation vtkCornerAnnotation Write text in the corners of a window.
CorrectlyRenderTranslucentGeometry vtkDepthSortPolyData Correctly Rendering Translucent Geometry.
CreateBFont(python) vtkClipPolyData vtkImageDataGeometryFilter A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles.
CubeAxesActor(python) vtkCubeAxesActor Display three orthogonal axes with labels.
CubeAxesActor2D vtkCubeAxesActor2D This example uses the vtkCubeAxesActor2D to show your scene with axes to indicate the spatial extent of your data.
Cursor3D vtkCursor3D
CursorShape vtkRenderWindow Change the shape of the cursor.
CurvatureBandsWithGlyphs(python) vtkCurvatures vtkBandedPolyDataContourFilter vtkLookupTable vtkColorSeries vtkGlyph3D Demonstrates the coloring of a surface by partitioning the gaussian curvature of a surface into bands and using arrows to display the normals on the surface.
CurvedReformation vtkProbeFilter Sample a volume with a curved surface. In medical imaging, this is often called curved multi planar reformation.
CutStructuredGrid(python) vtkCutter Cut through structured grid with plane. The cut plane is shown solid shaded. A computational plane of constant k value is shown in wireframe for comparison. The colors correspond to flow density. Cutting surfaces are not necessarily planes: implicit functions such as spheres, cylinders, and quadrics can also be used.
Cutter(python) vtkCutter
DataSetSurface(python) vtkDataSetSurfaceFilter Cutting a hexahedron with a plane. The red line on the surface shows the cut.
DecimateFran(python) vtkDecimatePro Examples of decimation algorithm. (a) Decimation of laser digitizer data.
DecimateHawaii(python) vtkDecimatePro Examples of decimation algorithm. (b) Decimation of terrain data.
DepthSortPolyData vtkDepthSortPolyData Poly Data Depth Sorting.
DisplacementPlot(python) vtkColorTransferFunction vtkWarpVector vtkVectorDot Show modal lines for a vibrating beam.
DisplayCoordinateAxes(python) vtkOrientationMarkerWidget Display coordinate axes.
DisplayQuadricSurfaces vtkQuadric vtkSampleFunction vtkContourFilter Display Quadric Surfaces.
DistanceToCamera vtkDistanceToCamera
DrawText vtkTextActor vtkTextProperty Display Text.
ElevationBandsWithGlyphs(python) vtkBandedPolyDataContourFilter vtkLookupTable vtkColorSeries vtkGlyph3D Demonstrates the coloring of a surface by partitioning the elevation into bands and using arrows to display the normals on the surface.
ExponentialCosine(python) vtkWarpScalar Carpet plots. Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values.
ExtrudePolyDataAlongLine vtkRuledSurfaceFilter Extrude a 2D polydata along a line in 3D space.
FastSplatter vtkFastSplatter Convolve a splat image with every point in an input image.
FindCellIntersections vtkCellLocator Find the intersection of a line and the cells in an unstructured dataset
FlatShading vtkActor
Follower vtkFollower Draw text that stays right side up.
FontFile vtkTextProperty Use an external font.
FrogSlice(python) vtkMetaImageReader Photographic slice of frog (upper left), segmented frog (upper right) and composite of photo and segmentation (bottom). The purple color represents the stomach and the kidneys are yellow.
Glyph2D vtkGlyph2D
Glyph3D vtkGlyph3D
Glyph3DImage vtkGlyph3DMapper Glyph the points in a vtkImageData.
Glyph3DMapper vtkGlyph3DMapper
Hanoi(python) Towers of Hanoi.
HanoiInitial(python) Towers of Hanoi - Initial configuration.
HanoiIntermediate(python) Towers of Hanoi - Intermediate configuration.
Hawaii(python) vtkElevationFilter vtkColorSeries vtkLookupTable Visualize elevations by coloring the scalar values with a lookup table.
HeadBone(python) vtkMarchingCubes Marching cubes surface of human bone.
HeadSlice(python) vtkContourFilter Marching squares used to generate contour lines.
HedgeHog vtkHedgeHog vtkStructuredGrid Create oriented lines (hedgehogs) from vector data.
HideActor vtkPropCollection vtkProp visible
HideAllActors vtkRenderer Hide all actors.
HyperStreamline(python) vtkHyperStreamline Example of hyperstreamlines, the four hyperstreamlines shown are integrated along the minor principle stress axis. A plane (colored with a different lookup table) is also shown.
ImageMapper vtkImageMapper Display an image in 2D.
ImageOrder vtkRenderer Determine the display order of a stack of images.
ImageOrientation vtkInteractorStyleImage Orientation of the view of an image.
ImageTransparency vtkImageData Set transparency of image pixels.
IronIsoSurface(python) vtkContourFilter Marching cubes surface of iron-protein.
IsosurfaceSampling vtkProbeFilter Demonstrates how to create point data on an isosurface.
Kitchen(python) vtkStreamTracer vtkStructuredGrid Demonstrates stream tracing in a kitchen.
KochSnowflake(python) vtkPolyData vtkPolyLine vtkTriangle vtkLookupTable Use recursion to represent a Koch snowflake fractal.
LODProp3D vtkLODProp3D Level of detail rendering.
LOx(python) vtkStreamTracer vtkTubeFilter Streamtubes created by using the computational grid just in front of the post as a source for seeds.
LOxGrid(python) vtkStreamTracer vtkTubeFilter Portion of computational grid for the LOx post.
LOxSeeds(python) vtkStreamTracer vtkTubeFilter Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown.
LabelContours vtkLabeledDataMapper Label Contours.
LabelPlacementMapper vtkPointSetToLabelHierarchy vtkLabelPlacementMapper Display a non-overlapping text label at each point.
LabeledDataMapper vtkLabeledDataMapper Display the point ID at each point.
LabeledMesh vtkLabeledDataMapper Label Mesh.
Legend vtkLegendBoxActor
LegendScaleActor vtkLegendScaleActor Display the scale of a scene.
LineWidth vtkActor vtkProperty Change the width/thickness of lines in an actor.
LoopShrink(python) A network with a loop. VTK 5.0 does not allow you to execute a looping visualization network; this was possible in previous versions of VTK.
Morph3D vtkInterpolateDataSetAttributes vtkImplicitModeller vtkContourFilter Interpolate between datasets.
Motor(python) vtkBYUReader vtkStructuredPointsReader vtkTexture vtkImplicitTextureCoords Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture.
MovableAxes vtkFollower vtkAxesActor vtkAssembly Movable axes.
MoveActor vtkInteractorStyleTrackballActor Moving an Actor.
MoveCamera vtkInteractorStyleTrackballCamera Moving the Camera.
MultipleActors vtkActor Multiple Actors.
NamedColorPatches(python) vtkNamedColors Creates a HTML file called VTKNamedColorPatches
NamedColors(python) vtkNamedColors Demonstrate the use of the vtkNamedColors class.
NoShading vtkActor
NormalsDemo(python) vtkPolyDataNormals Demo different options to generate normals.
Office(python) vtkPointSource vtkStreamTracer Using random point seeds to create streamlines.
OfficeA(python) vtkPointSource vtkStreamTracer Corresponds to Fig 9-47(a) in the VTK textbook.
OfficeTube(python) vtkStreamTracer vtkTubeFilter The stream polygon. Sweeping a polygon to form a tube.
Opacity vtkActor Transparency, transparent.
OrientedGlyphs(python) vtkGlyph3D Create oriented glyphs from vector data.
PineRootConnectivity(python) vtkMCubesReader vtkPolyDataConnectivityFilter Applying the connectivity filter to remove noisy isosurfaces.
PineRootConnectivityA(python) vtkMCubesReader vtkPolyDataConnectivityFilter The isosurface, with no connectivity filter applied.
PineRootDecimation(python) vtkMCubesReader vtkDecimatePro vtkConnectivityFilter Applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size.
PlateVibration(python) vtkWarpVector vtkVectorDot Demonstrates the motion of a vibrating beam.
PointDataSubdivision(python) vtkLinearSubdivisionFilter vtkButterflySubdivisionFilter Demonstrates the effect of applying these filters on various sources.
PointSize(python) vtkActor
ProbeCombustor(python) vtkProbeFilter Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter.
ProgrammableGlyphFilter vtkProgrammableGlyphFilter Generate a custom glyph at each point.
PseudoVolumeRendering(python) vtkCutter vtkContourFilter 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering.
QuadraticSurface(python) vtkQuadric Display a quadratic surface.
QuadricLODActor vtkQuadricLODActor Level of detail adjustment.
QuadricVisualization(python) vtkQuadric vtkSampleFunction vtkContourFilter Visualizing a quadric function.
RandomProbe vtkProbeFilter Demonstrates how to probe a dataset with random points and select points inside the data set.
RenderLargeImage vtkRenderLargeImage Render a large image, larger than a window.
RenderView vtkRenderView A little bit easier rendering.
ReverseAccess vtkActor Demonstrates how to access the source (e.g. vtkSphereSource) of an actor reversely.
RotateActor vtkActor Rotate an Actor.
ScalarBarActor vtkScalarBarActor Display a color bar.
ScalarBarActorColorSeries vtkScalarBarActor vtkColorSeries Display a color bar with a color series lookup table.
ScalarVisibility vtkDataSetMapper Switch between coloring the actor and coloring the data.
ScaleGlyphs vtkGlyph3D vtkGlyph3D Scale glyphs.
SceneBounds vtkRenderer Get the bounds of the whole scene.
SelectWindowRegion vtkInteractorStyleRubberBand2D Select a region of a window.
SingleSplat(python) vtkGaussianSplatter Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector.
SpikeFran(python) vtkGlyph3D Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected.
SplatFace(python) vtkGaussianSplatter Elliptical splatting. (b) Surface reconstructed using elliptical splats into 100^3 volume followed by isosurface extraction. Points regularly subsampled and overlaid on original mesh.
Stocks(python) vtkRibbonFilter vtkLinearExtrusionFilter Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time.
StreamLines(python) vtkStreamTracer Streamlines.
StreamlinesWithLineWidget(python) vtkCallbackCommand vtkLineWidget Using the vtkLineWidget to produce streamlines in the combustor dataset. The StartInteractionEvent turns the visibility of the streamlines on; the InteractionEvent causes the streamlines to regenerate themselves.
StructuredDataTypes Demonstration of structured data types.
TensorAxes(python) vtkPointLoad vtkTensorGlyph Display the scaled and oriented principal axes of the stress tensor.
TensorEllipsoids(python) vtkPointLoad vtkTensorGlyph Display the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor.
TensorGlyph vtkTensorGlyph Draw a rotated/scaled glyph at each point.
TextSource(python) vtkTextSource Display text.
TransformActor vtkActor Transform an Actor.
TransformActorCollection vtkActorCollection Transform an actor collection.
TubesFromSplines vtkTubeFilter vtkParametricFunctionSource vtkTupleInterpolator Create tubes from interpolated points and scalars.
TubesWithVaryingRadiusAndColors vtkTubeFilter Create tubes with varying radius and colors.
VectorField vtkGlyph2D vtkImageData
VectorOfActors vtkActor Multiple Actors in a Vector.
VectorText(python) vtkVectorText Display high resolution text.
VelocityProfile(python) vtkMultiBlockPLOT3DReader vtkStructuredGridGeometryFilter vtkAppendPolyData vtkWarpVector Warping the geometry of three planes to show flow momentum.
VertexGlyphFilter vtkVertexGlyphFilter Add a vertex to each point.
ViewFrog(python) vtkMetaImageReader vtkMarchingCubes vtkImageGaussianSmooth vtkWindowedSincPolyDataFilter The complete frog without skin.
ViewFrogA(python) vtkMetaImageReader vtkMarchingCubes vtkImageGaussianSmooth vtkWindowedSincPolyDataFilter The complete frog without skin or skeleton.
ViewFrogBoth(python) vtkMetaImageReader vtkMarchingCubes vtkImageGaussianSmooth vtkImageGaussianSmooth The frog’s brain. Model extracted without smoothing (left) and with smoothing (right).
ViewFrogSkinAndTissue(python) vtkMetaImageReader vtkMarchingCubes vtkWindowedSincPolyDataFilter vtkImageGaussianSmooth All frog parts and translucent skin.
Visualize2DPoints vtkPolyDataMapper2D vtkProperty2D Visualize a 2D Set of Points.
VisualizeImageData vtkDataSetMapper Visualize the points of an ImageData.
VisualizeVTP vtkXMLPolyDataReader vtkPolyDataMapper Visualize a VTP File.
WarpCombustor(python) vtkWarpScalar vtkMultiBlockPLOT3DReader Carpet plots. Carpet plot of combustor flow energy in a structured grid. Colors and plane displacement represent energy values.
WindowSize vtkRenderWindow:SetSize Change the size of a window.
WindowTitle(python) vtkRenderWindow Change the title of a window.
Wireframe vtkActor

Volume Rendering

Example Name Classes Demonstrated Description Image
FixedPointVolumeRayCastMapperCT vtkFixedPointVolumeRayCastMapper vtkColorTransferFunction vtkDICOMImageReader vtkMetaImageReader Volume render DICOM or Meta volumes with various vtkColorTransferFunction's.
HAVS vtkHAVSVolumeMapper
IntermixedUnstructuredGrid vtkUnstructuredGridVolumeRayCastMapper vtkSLCReader mix of poly data and unstructured grid volume mapper.
MinIntensityRendering vtkFixedPointVolumeRayCastMapper Min intensity rendering.
SimpleRayCast(python) vtkFixedPointVolumeRayCastMapper Volume rendering of a high potential iron protein.
SmartVolumeMapper vtkSmartVolumeMapper Smart volume mapper.

User Interaction

Example Name Classes Demonstrated Description Image
AreaPicking vtkAreaPicker Area Picking.
Assembly vtkAssembly Combine/group actors into an assembly.
CallBack(python) vtkCallbackCommand vtkOrientationMarkerWidget Setting up a callback with client data. Two different methods are demonstrated.
CallData vtkCommand Pass an observer a value (via CallData).
CellPicking vtkCellPicker Cell Picking.
ClientData vtkCommand Give an observer access to an object (via ClientData).
DoubleClick vtkInteractorStyleTrackballCamera Catch a double click.
EllipticalButton vtkEllipticalButtonSource vtkButtonWidget Create an elliptical button.
Game vtkInteractorStyleTrackballActor Move a cube into a sphere.
HighlightPickedActor vtkPropPicker Highlight a picked actor.
HighlightSelectedPoints vtkExtractGeometry Highlight Selected Points.
HighlightSelection vtkExtractPolyDataGeometry Highlight selection.
ImageClip vtkImageClip Demonstrates how to interactively select and display a region of an image.
ImageRegion vtkCommand Select a region of an image.
InteractorStyleTerrain vtkInteractorStyleTerrain Terrain mode.
InteractorStyleUser vtkInteractorStyleUser Create a completely custom interactor style (no default functionality is provided)
KeypressEvents vtkInteractorStyleTrackballCamera Handle keypress events.
KeypressObserver vtkCallbackCommand This uses a callback function rather than a derived interactor class. Handle keypress events (lightweight).
MouseEvents(python) vtkInteractorStyleTrackballCamera Subclass the interactor style. Handle mouse events.
MouseEventsObserver(python) vtkCallbackCommand Use an observer. Handle mouse events (light weight).
MoveAGlyph vtkGlyph3D Drag a glyph around.
MoveAVertexUnstructuredGrid vtkPointPicker Click and drag a vertex of a vtkUnstructuredGrid.
ObserverMemberFunction Set observers to be class member functions.
PickableOff vtkActor Disallow interaction with a specific actor.
Picking vtkPropPicker Get the world coordinate of the mouse click (if you clicked an actor)
PointPicker vtkPointPicker Get the coordinates of the closest point in the data set to the mouse click.
RubberBand2D vtkInteractorStyleRubberBand2D
RubberBand2DObserver vtkInteractorStyleRubberBand2D RubberBand2D Observer.
RubberBand3D vtkInteractorStyleRubberBand3D
RubberBandPick vtkInteractorStyleRubberBandPick
RubberBandZoom vtkInteractorStyleRubberBandZoom
SelectAVertex vtkPointPicker Click and drag a vertex of a vtkPolyData.
SelectAnActor vtkPropPicker Select an actor.
ShiftAndControl vtkRenderWindowInteractor Hold/holding down a key. Check if shift or control is being held.
StyleSwitch vtkInteractorStyleSwitch Choose between multiple interaction modes.
TrackballActor vtkInteractorStyleTrackballActor Trackball actor mode.
TrackballCamera vtkInteractorStyleTrackballCamera Trackball camera mode.
UserEvent Simple observer. Create, invoke, and handle a custom event.
WorldPointPicker vtkWorldPointPicker Get world coordinates of mouse click.

Working with Images

Example Name Classes Demonstrated Description Image
Actor2D vtkActor2D vtkMapper2D 2D actor and mapper.
BackgroundImage(python) vtkImageCanvasSource2D Display an image as the background of a scene.
BorderPixelSize vtkImageSliceMapper Set the size of border pixels.
CannyEdgeDetector Perform Canny edge detection on an image.
Cast vtkImageCast Cast an image to a different type.
DotProduct vtkImageDotProduct Compute the pixel-wise dot product of two vector images.
DrawOnAnImage vtkImageCanvasSource2D Drawing on an image.
DrawShapes vtkImageCanvasSource2D Drawing shapes in an image.
ExtractComponents vtkImageExtractComponents Extract components of an image. This can be used to get, for example, the red channel of an image.
FillWindow vtkCamera Fit imageSetup the camera to fill the window with an image.
ImageAccumulateGreyscale vtkImageAccumulate vtkBarChartActor Display a grey scale histogram.
ImageCheckerboard vtkImageCheckerboard Visually Compare Two Images.
ImageCityBlockDistance vtkImageCityBlockDistance Compute the Manhattan distance from every point to every black point in a binary image.
ImageDilateErode3D vtkImageDilateErode3D Dilate or erode an image.
ImageExport vtkImageExport Export an image to a C array.
ImageGridSource vtkImageGridSource Create a image of a grid.
ImageHistogram vtkImageHistogram Compute the histogram of an image.
ImageHybridMedian2D vtkImageHybridMedian2D Median filter an image.
ImageIdealHighPass vtkImageIdealHighPass High pass filter an image.
ImageImport vtkImageImport Import an image from a C array.
ImageIslandRemoval2D vtkImageIslandRemoval2D Remove small patches from an image.
ImageMagnify vtkImageMagnify Supersample and stretch an image.
ImageMandelbrotSource vtkImageMandelbrotSource Create a Mandelbrot image.
ImageMask vtkImageMask Mask a region of an image.
ImageMathematics vtkImageMathematics Perform mathematical operations on an image.
ImageMedian3D vtkImageMedian3D Median filter a 3d or 2d image.
ImageMirrorPad vtkImageMirrorPad Pad the edges of an extended image by mirror existing pixels.
ImageNonMaximumSuppression vtkImageNonMaximumSuppression Find peaks in an image using non maximum suppression.
ImageOpenClose3D vtkImageOpenClose3D Open or close (morphologically) an image.
ImageRFFT vtkImageRFFT Inverse FFT.
ImageRange3D vtkImageRange3D Replace every pixel with the range of its neighbors according to a kernel.
ImageRotate vtkImageSlice vtkImageResliceMapper Rotate a 2D image. This is even more powerful than vtkImageSliceMapper. It can also do oblique slices.
ImageSeparableConvolution vtkImageSeparableConvolution Convolve a separable kernel with an image.
ImageShiftScale vtkImageShiftScale Shift and scale an image.
ImageSinusoidSource vtkImageSinusoidSource Create a sinusoidal image.
ImageSlice vtkImageSlice vtkImageResliceMapper Visualize and interact with an image. This is even more powerful than vtkImageSliceMapper. It can also do oblique slices.
ImageSliceMapper vtkImageSlice vtkImageSliceMapper Visualize and interact with an image. This is the new way to do this. It is much more powerful.
ImageStack vtkImageStack Display layers of images.
ImageStencil vtkImageStencil vtkImageToImageStencil Copy one image into another image.
ImageText vtkFreeTypeUtilities vtkImageBlend Draw text in an image.
ImageThreshold vtkImageThreshold Threshold an image.
ImageToPolyDataFilter vtkImageToPolyDataFilter vtkImageQuantizeRGBToIndex Convert a vtkImageData to a vtkPolyData.
ImageToStructuredPoints vtkImageToStructuredPoints Convert a vtkImageData to a vtkStructuredPoints.
InteractWithImage vtkImageActor vtkInteractorStyleImage Visualize and interact with an image.
Interpolation vtkImageSlice vtkImageProperty Set the interpolation type for the display of an image. If pixels look blurry instead of sharp when zoomed in, change this.
MarkKeypoints vtkVectorText vtkFollower Mark keypoints in an image.
NegativeIndices vtkImageData A very powerful feature of vtkImageData is that you can use negative indices.
PickPixel vtkPropPicker Picking a pixel.
PickPixel2 vtkPropPicker Picking a pixel 2 - modified version for exact pixel values.
RTAnalyticSource vtkRTAnalyticSource An image source that can be used for regression testing
StaticImage vtkImageViewer2 This will display the image, but not allow you to interact with it.
Transparency vtkImageMapToColors vtkLookupTable Make part of an image transparent.

Image Processing

Example Name Classes Demonstrated Description Image
Attenuation(python) vtkImageGaussianSmooth vtkImageMathematics vtkImageShiftScale This MRI image illustrates attenuation that can occur due to sensor position. The artifact is removed by dividing by the attenuation profile determined manually.
CenterAnImage vtkImageChangeInformation Center an image.
Colored2DImageFusion vtkImageMapToColors Blending 2D images with different color maps.
CombineImages vtkImageBlend Combine two images.
CombiningRGBChannels vtkImageAppendComponents Combine layers into an RGB image.
EnhanceEdges(python) vtkImageLaplacian vtkImageMathematics High-pass filters can extract and enhance edges in an image. Subtraction of the Laplacian (middle) from the original image (left) results in edge enhancement or a sharpening operation (right).
Flip vtkImageFlip Flip an image.
GaussianSmooth(python) vtkImageGaussianSmooth Low-pass filters can be implemented as convolution with a Gaussian kernel.
Gradient vtkImageGradient Compute the gradient vector at every pixel.
HybridMedianComparison(python) vtkImageHybridMedian2D vtkImageMedian3D Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter.
IdealHighPass(python) vtkImageFFT vtkImageRFFT vtkImageIdealHighPass vtkImageButterworthHighPass This figure shows two high-pass filters in the frequency domain. The Butterworth high-pass filter has a gradual attenuation that avoids ringing produced by the ideal high-pass filter with an abrupt transition.
ImageAccumulate vtkImageAccumulate Histogram
ImageAnisotropicDiffusion2D vtkImageAnisotropicDiffusion2D Anisotropic diffusion (2D).
ImageContinuousDilate3D vtkImageContinuousDilate3D Dilate an image.
ImageContinuousErode3D vtkImageContinuousErode3D Erode an image.
ImageConvolve vtkImageConvolve Convolve an image with a kernel.
ImageCorrelation vtkImageCorrelation Correlate two images.
ImageDifference vtkImageDifference Compute the difference image of two images.
ImageDivergence vtkImageDivergence Divergence of a vector field.
ImageEllipsoidSource vtkImageEllipsoidSource Create an image of an ellipsoid.
ImageFFT vtkImageFFT Compute the FFT of an image.
ImageGaussianSmooth vtkImageGaussianSmooth Smooth an image.
ImageGradient(python) vtkImageMagnify vtkImageGaussianSmooth vtkImageGradient vtkImageEuclideanToPolar vtkImageExtractComponents vtkImageHSVToRGB Create an imaging pipeline to visualize gradient information.
ImageGradientMagnitude vtkImageGradientMagnitude Compute the magnitude of the gradient at each pixel of an image.
ImageLaplacian vtkImageLaplacian Compute the Laplacian of an image.
ImageLuminance vtkImageLuminance Convert RGB image to greyscale (luminance).
ImageMagnitude vtkImageMagnitude grayscaleConvert RGB image to grey scale.
ImageMapToColors vtkImageMapToColors Use a lookup table to map scalar (gray scale) values to colorsConvert grey scale image to RGB.
ImageNoiseSource vtkImageNoiseSource Create an image of noise.
ImagePermute vtkImagePermute Switch axes of an image.
ImageShrink3D vtkImageShrink3D Resample an image.
ImageSobel2D vtkImageSobel2D Sobel edge detection 2D.
ImageValueRange vtkImageData Get the range of image pixel values (min/max).
ImageVariance3D vtkImageVariance3D Construct a new image consisting of the variance of the input image at each pixel.
ImageWarp(python) vtkBMPReader vtkImageLuminance vtkWarpScalar vtkMergeFilter Combine the imaging and visualization pipelines to deform an image in the z-direction. The vtkMergeFilter is used to combine the warped surface with the original color data.
IsoSubsample(python) vtkImageMarchingCubes vtkImageShrink3D vtkImageGaussianSmooth This figure demonstrates aliasing that occurs when a high-frequency signal is subsampled. High frequencies appear as low frequency artifacts. The left image is an isosurface of a skull after subsampling. The right image used a low-pass filter before subsampling to reduce aliasing.
MedianComparison(python) vtkImageGaussianSmooth vtkImageMedian3D vtkImageNoiseSource Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.
MorphologyComparison(python) vtkImageDilateErode3D vtkImageSeedConnectivity This figure demonstrates various binary filters that can alter the shape of segmented regions.
Pad(python) vtkImageConstantPad vtkImageMirrorPad Convolution in frequency space treats the image as a periodic function. A large kernel can pick up features from both sides of the image. The lower-left image has been padded with zeros to eliminate wraparound during convolution. On the right, mirror padding has been used to remove artificial edges introduced by borders.
RGBToHSI vtkImageRGBToHSI Convert RGB to HSI.
RGBToHSV vtkImageRGBToHSV Convert RGB to HSV.
RGBToYIQ vtkImageRGBToYIQ Convert RGB to YIQ.
RescaleAnImage vtkImageShiftScale Rescale an image
ResizeImage vtkImageResize vtkImageSincInterpolator Resize an image using a sinc interpolator.
ResizeImageDemo vtkImageResize vtkImageSincInterpolator Demonstrate allsinc interpolators to resize an image.
VTKSpectrum(python) vtkImageFFT vtkImageFourierCenter vtkImageLogarithmicScale vtkImageMagnitude The discrete Fourier transform changes an image from the spatial domain into the frequency domain, where each pixel represents a sinusoidal function. This figure shows an image and its power spectrum displayed using a logarithmic transfer function.

Widgets

Example Name Classes Demonstrated Description Image
AffineWidget vtkAffineWidget Apply an affine transformation interactively.
AngleWidget vtkAngleWidget
AngleWidget2D vtkAngleWidget vtkAngleRepresentation2D vtkAngleWidget + vtkAngleRepresentation2D.
BalloonWidget(python) vtkBalloonWidget
BiDimensionalWidget vtkBiDimensionalWidget When would you use this?
BorderWidget vtkBorderWidget 2D selection, 2D box.
BoxWidget(python) vtkBoxWidget
BoxWidget2 vtkBoxWidget2
CaptionWidget vtkCaptionWidget
CheckerboardWidget vtkCheckerboardWidget vtkCheckerboardRepresentation Compare two images using a checkerboard.
ContourWidget(python) vtkContourWidget Create a contour from a set of points and dynamically change the contour using the points as control points.
Cursor2D vtkCursor2D
DistanceWidget vtkDistanceWidget
HoverWidget vtkHoverWidget How to detect a hover?
ImagePlaneWidget vtkImagePlaneWidget
ImageTracerWidget vtkImageTracerWidget Scribble on an image.
ImageTracerWidgetInsideContour vtkImageTracerWidget Highlight pixels inside a non-regular region scribbled on an image.
ImageTracerWidgetNonPlanar vtkImageTracerWidget Draw on a non-planar surface.
ImplicitPlaneWidget2 vtkImplicitPlaneWidget2 Clip polydata with an implicit plane.
LineWidget2 vtkLineWidget2
LogoWidget vtkLogoWidget Logo widget.
OrientationMarkerWidget(python) vtkOrientationMarkerWidget Display a polydata as an orientation icon.
PlaneWidget vtkPlaneWidget Interact with a plane.
PolygonalSurfacePointPlacer vtkPolygonalSurfacePointPlacer Used in conjunction with vtkContourWidget to draw curves on a surface.
RectilinearWipeWidget vtkImageRectilinearWipe vtkRectilinearWipeWidget vtkRectilinearWipeRepresentation Compare two images.
SeedWidget vtkSeedWidget Seed widget.
SeedWidgetImage vtkImageViewer2 vtkSeedWidget How to start the interaction?
SeedWidgetWithCustomCallback vtkCommand vtkPointHandleRepresentation2D How to place points in a scene using a custom callback.
Slider vtkSliderWidget vtkSliderRepresentation3D 3D Slider.
Slider2D vtkSliderWidget vtkSliderRepresentation2D 2D Slider.
SphereWidget(python) vtkSphereWidget Sphere widget.
SphereWidget2 vtkSphereWidget2
SphereWidgetEvents vtkSphereWidget Sphere widget events.
SplineWidget vtkSplineWidget
TextWidget(python) vtkSeedWidget vtkTextWidget Draw movable text.
TexturedButtonWidget vtkButtonWidget vtkTexturedButtonRepresentation2D Create a textured 2D button.

Plotting

Example Name Classes Demonstrated Description Image
BarChart vtkChartXY Bar chart.
BoxChart vtkChartBox Box plot.
Diagram
HistogramBarChart vtkBarChartActor Histogram using bar chart.
LinePlot vtkChartXY Line plot.
ParallelCoordinates vtkChartParallelCoordinates Parallel coordinates.
PieChart vtkChartPie vtkPlotPie Pie chart.
PieChartActor vtkPieChartActor Pie chart.
ScatterPlot(python) vtkPlotPoints Scatter plot.
SpiderPlot(python) vtkSpiderPlotActor Spider plot.
StackedBar vtkPlotBar Stacked bar.
StackedPlot vtkPlotStacked Stacked plot.

Animation

Example Name Classes Demonstrated Description Image
AnimateActors vtkAnimationScene vtkAnimationCue Animate actors.
Animation(python) vtkRenderWindowInteractor Move a sphere across a scene.
AnimationScene vtkAnimationScene vtkAnimationCue Animation (the right way). Zoom in on a sphere.
DataAnimation vtkCallbackCommand vtkProgrammableFilter Data Animation. Update points in a dataset every specified interval.
DataAnimationSubclass vtkCommand vtkProgrammableFilter Update points in a dataset every specified interval (using a vtkCommand subclass instead of a callback function.

Geographic Visualization (Geovis)

Example Name Classes Demonstrated Description Image
CompassWidget vtkCompassWidget Compass Widget.
EarthSource vtkEarthSource Create the Earth.
GeoAssignCoordinates(python) vtkGeoAssignCoordinates Convert lat/long coordinates to world coordinates.
GeoGraticle vtkGeoGraticle Show lat/long lines that have been distorted.
Example Name Classes Demonstrated Description Image
ParallelCoordinatesView(python) vtkParallelCoordinatesView Parallel coordinates.
TreeMapView vtkTreeMapView Tree map.

Qt

Click here for a tutorial on how to setup Qt.

Example Name Classes Demonstrated Description Image
BorderWidgetQt vtkBorderWidget QApplication
EventQtSlotConnect vtkEventQtSlotConnect Connect a VTK event to a Qt slot.
ImageDataToQImage Convert a vtkImageData to a QImage.
QImageToImageSource vtkQImageToImageSource Convert a QImage to a vtkImageData.
QtBarChart vtkQtBarChart
RenderWindowNoUiFile QVTKOpenGLWidget This is a very basic example that shows how to create a Qt window. Typically, one would want to design a form in the QtDesigner (this is shown in RenderWindowUIMultipleInheritance).
RenderWindowUIMultipleInheritance QMainWindow Using a QVTKOpenGLWidget with the Qt Multiple Inheritance model.
RenderWindowUISingleInheritance QMainWindow Using a QVTKOpenGLWidget with the Qt Single Inheritance model.
ShareCameraQt Share the camera between QVTKOpenGLWidgets.
ShowEvent Use QMainWindow::showEvent event to do things that you might want to do in the constructor
SideBySideRenderWindowsQt QApplication Side by side render windows.

Matlab

You must turn on VTK_USE_MATLAB_MEX to use these.

Example Name Classes Demonstrated Description Image
MatlabEngineFilter vtkMatlabEngineFilter

Databases

SQL

If you have any trouble or errors with the following examples, please troubleshoot using these instructions.

Example Name Classes Demonstrated Description Image
ConnectAndRead vtkMySQLDatabase vtkSQLQuery Connect to and read a MySQL database.
CreateDatabase vtkMySQLDatabase Create a MySQL database.
WriteToDatabase vtkSQLQuery vtkMySQLDatabase Write to a MySQL database.

RenderMan

RenderMan is a high quality rendering system created by Pixar. VTK can export RenderMan RIB files for rendering by prman. In the spring of 2015, Pixar released a non-commercial version of its RenderMan products.

Example Name Classes Demonstrated Description Image
PolyDataRIB vtkRIBExporter Apply a RenderMan Shader to a PolyData.

Remote Modules

Remote modules are user contributed code that is not distributed with VTK. A description of a remote module and the location of its repository is listed in the VTK/Remote directory with the extension .remote.cmake. Once enabled, a remote module is treated like any other VTK module. Each of the remote module examples describes how to enable the example. More information about remote modules is here.

Example Name Classes Demonstrated Description Image
FrenetSerretFrame vtkFrenetSerretFrame Compute tangent and normal vectors to a polyline.
FrenetSerretFrameDemo vtkFrenetSerretFrame Uses vtkSplineWidget to interact with a spline. Shows how to control a pipeline inside a callback.