# Python Examples

Please see this page to learn how to setup your environment to use VTK in Python.

It would be appreciated if there are any Python VTK experts who could convert any of the c++ examples to Python!


This table shows the VTK classes covered by the examples.


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(cxx) vtkPolyDataMapper vtkActor vtkRenderer vtkRenderWindow vtkRenderWindowInteractor Cylinder example from the VTK Textbook and source code. A hello world example.

Simple Operations

Example Name Classes Demonstrated Description Image
DistanceBetweenPoints(cxx) vtkMath::Distance2BetweenPoints

Input and Output

Graph Formats

3D File Formats

Standard Formats

Example Name Classes Demonstrated Description Image
ReadExodusData(cxx) vtkExodusIIReader A simple script for reading and viewing ExodusII data interactively.
ReadSLC(cxx) vtkSLCReader Read an SLC file.
ReadSTL(cxx) vtkSTLReader Read an STL file.
ReadVTP vtkXMLPolyDataReader Read a VTK XML PolyData file.
ReadUnstructuredGrid(cxx) vtkUnstructuredGridReader Using vtkUnstructuredGridReader to read a (legacy) *.vtk file
Example Name Classes Demonstrated Description Image
3DSImporter(cxx) vtk3DSImporter Import a 3D Studio scene that includes multiple actors.
Example Name Classes Demonstrated Description Image
WritePLY(cxx) vtkPLYWriter
WriteSTL(cxx) vtkSTLWriter

VTK Formats

Example Name Classes Demonstrated Description Image
ReadImageData(cxx) vtkXMLImageDataReader Read an image data (.vti) file
ReadPolyData(cxx) vtkXMLPolyDataReader Read a polygonal data (.vtp) file

Legacy VTK Formats

Example Name Classes Demonstrated Description Image
ReadLegacyUnstructuredGrid(cxx) vtkUnstructuredGridReader Read an unstructured grid that contains 11 linear cells.
WriteLegacyLinearCells(cxx) vtkUnstructuredGridWriter Write each linear cell into a legacy UnstructuredGrid file.
WriteXMLLinearCells(cxx) vtkXMLDataSetWriter Write each linear cell into an XML UnstructuredGrid file (.vtu).

Image Format



Example Name Classes Demonstrated Description Image
ImageWriter(cxx) vtkBMPWriter vtkJPEGWriter vtkPNMWriter vtkPostScriptWriter vtkTIFFWriter vtkPNGWriter vtkWindowToImageFilter Write an imagefile based on the file extension.

Geometric Objects

Example Name Classes Demonstrated Description Image
Axes(cxx) vtkAxesActor
ColoredLines(cxx) vtkCellData vtkLine
Circle(cxx) vtkRegularPolygonSource A disk is shown however this can be modified to show a circle.
Dodecahedron(cxx) vtkPolyhedron Create a dodecahedron using vtkPolyhedron.
EllipticalCylinder(cxx) vtkLinearExtrusionFilter Create an elliptical cylinder using extrusion.
EllipticalCylinderDemo(cxx) vtkLinearExtrusionFilter Show the base and extrusion vector.
Planes(cxx) vtkPlanes vtkHull We create a convex hull of the planes for display purposes.
PlanesIntersection(cxx) vtkPlanesIntersection
PolygonIntersection(cxx) vtkPolygon IntersectWithLine()
SourceObjectsDemo(cxx) 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.


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


Example Name Classes Demonstrated Description Image
Arrow(cxx) vtkArrowSource
Cone(cxx) vtkConeSource
Cube(cxx) vtkPolyData Manually build a polygonal cube.
Cube1(cxx) vtkCubeSource A nice simple example that demonstrates the operation of the VTK pipeline.
Cylinder(cxx) vtkCylinderSource
Disk(cxx) vtkDiskSource A circle with a hole in it.
Frustum(cxx) vtkFrustumSource
Line(cxx) vtkLineSource
OrientedArrow(cxx) vtkArrowSource Orient an arrow along an arbitrary vector.
OrientedCylinder(cxx) vtkCylinderSource Orient a cylinder along an arbitrary vector.
Plane(cxx) vtkPlaneSource
PlatonicSolids(cxx) vtkPlatonicSolidSource All five platonic solids are displayed.
PolyLine1(cxx) vtkPolyLine This example demonstrates how to create a polygon through several ordered points.
RegularPolygonSource(cxx) vtkRegularPolygonSource
ShrinkCube(cxx) vtkCubeSource vtkShrinkFilter Applying shrink filter to an object.
Sphere(cxx) vtkSphereSource
TessellatedBoxSource(cxx) vtkTessellatedBoxSource Generate a box with tessellated sides.
TextActor(cxx) vtkTextActor 2D "HUD-type" text

Non Linear

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

Parametric Objects

Example Name Classes Demonstrated Description Image
ParametricKuenDemo(cxx) vtkParametricKuen Interactively change the parameters for a Kuen Surface.
ParametricObjectsDemo(cxx) Demonstrates the Parametric classes added by Andrew Maclean and additional classes added by Tim Meehan. The parametric spline is also included. Options are provided to display single objects, add backface, add normals and print out an image.
ParametricSuperEllipsoidDemo(cxx) vtkParametricSuperEllipsoid Interactively change the parameters for a SuperEllipsoid Surface.
ParametricSuperToroidDemo(cxx) vtkParametricSuperToroid Interactively change the parameters for a SuperToroid Surface.

Implicit Functions and Iso-surfaces

Example Name Classes Demonstrated Description Image
Boolean vtkImplicitBoolean Demonstrate booleans of two different implicit functions
CutWithScalars(cxx) vtkContourFilter Cut a surface with scalars.
ExtractData(cxx) 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.
Hello(cxx) vtkImplicitModeller Implicit modelling used to thicken a stroked font.
IceCream(cxx) vtkImplicitBoolean vtkSampleFunction How to use boolean combinations of implicit functions to create a model of an ice cream cone.
ImplicitDataSet(cxx) vtkImplicitDataSet A cube is used to define an implicit function (through vtkImplicitDataSet) which is then used to clip a sphere.
ImplicitSphere(cxx) vtkSphere An implicit representation of a sphere.
Lorenz(cxx) vtkContourFilter Visualizing a Lorenz strange attractor by integrating the Lorenz equations in a volume.
MarchingCases(cxx) vtkMarchingCubes Explore the Marching Cubes cases.
MarchingCasesA(cxx) vtkMarchingCubes The 256 possible cases have been reduced to 15 cases using symmetry.
MarchingCasesB(cxx) vtkMarchingCubes Marching cubes complementary cases. Cases 3c, 6c, 7c, 10c, 12c and 13c are displayed.
MarchingCasesC(cxx) vtkMarchingCubes Marching cubes, case 3 is rotated 90 degrees about the y-axis with no label.
MarchingCasesD(cxx) vtkMarchingCubes Marching cubes, case 7 is rotated 180 degrees about the y-axis with no label.
Quadric vtkQuadric Create an ellipsoid using an implicit quadric
Sphere vtkSphere Demonstrate sampling of a sphere implicit function
SampleFunction(cxx) vtkSampleFunction Sample and visualize an implicit function.

Working with 3D Data

Example Name Classes Demonstrated Description Image
AlignTwoPolyDatas(cxx) vtkIterativeClosestPointTransform vtkLandmarkTransform vtkHausdorffDistancePointSetFilter Align two vtkPolyData's.
AppendFilter(cxx) vtkAppendFilter Append different types of data,
BooleanOperationPolyDataFilter(cxx) vtkBooleanOperationPolyDataFilter This example performs a boolean operation (Intersection, Union, Difference) of two PolyData
Bottle(cxx) vtkRotationalExtrusionFilter Rotationally symmetric objects.
CappedSphere(cxx) vtkRotationalExtrusionFilter Rotate an arc to create a capped sphere.
CellsInsideObject(cxx) vtkSelectEnclosedPoints vtkMultiThreshold Extract cells inside a closed surface.
ColoredTriangle vtkTriangle Creates a file TriangleColored.vtp.
CombinePolyData(cxx) vtkAppendPolyData This example combines Polydata objects, and displays the result to the screen.
ConnectivityFilter(cxx) vtkConnectivityFilter Color any dataset type based on connectivity.
CurvaturesDemo(cxx) vtkCurvatures vtkColorTransferFunction Demonstrates how to get the Gaussian and Mean curvatures of a surface.
ExtractSelection(cxx) vtkExtractSelection
ExtractSelectionCells(cxx) vtkExtractSelection Extract cell, select cell.
FilledPolygon vtkCutter
Finance(cxx) 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(cxx) vtkGaussianSplatter Visualization of multidimensional financial data. The yellow surface represents the total data population. The red surface represents data points delinquent on loan payment.
Glyph2D(cxx) vtkGlyph2D
Glyph3D(cxx) vtkGlyph3D
ImplicitPolyDataDistance(cxx) vtkImplicitPolyDataDistance
IterativeClosestPoints vtkIterativeClosestPointTransform
LineOnMesh vtkCellLocator vtkParametricSpline
MeshLabelImageColor vtkDiscreteMarchingCubes
Outline(cxx) vtkOutlineFilter
PolyDataContourToImageData(cxx) vtkLinearExtrusionFilter vtkPolyDataToImageStencil
PolyDataToImageDataStencil vtkPolyDataToImageStencil
PerlinNoise(cxx) vtkPerlinNoise
RotationAroundLine(cxx) vtkTransformPolyDataFilter
RuledSurfaceFilter(cxx) vtkRuledSurfaceFilter
SmoothMeshGrid vtkLoopSubdivisionFilter vtkButterflySubdivisionFilter
SolidColoredTriangle vtkTriangle Writes out a file TriangleSolidColor.vtp.
Spring(cxx) vtkRotationalExtrusionFilter Rotation in combination with linear displacement and radius variation.
TriangleColoredPoints(cxx) vtkUnsignedCharArray
TriangleCornerVertices vtkCellArray
TriangleCorners vtkXMLPolyDataWriter
TriangulateTerrainMap(cxx) vtkDelaunay2D Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface.
TransformPolyData(cxx) vtkTransformPolyDataFilter Apply a Transformation to a PolyData.
VertexGlyphFilter(cxx) vtkVertexGlyphFilter Add a vertex to each point.
WarpTo(cxx) vtkWarpTo Deform geometry by warping towards a point.
WarpVector(cxx) vtkLine vtkDoubleArray vtkPolyData vtkWarpVector This example warps/deflects a line.
WriteTriangleToFile vtkTriangle
TubeFilter(cxx) vtkTubeFilter Give lines a thickness (produce a cylinder around lines).

Data Types

Example Name Classes Demonstrated Description Image
CompositePolyDataMapper(cxx) vtkCompositePolyDataMapper
MultiBlockDataSet(cxx) vtkMultiBlockDataSet Demonstrates how to make and use VTK's MultiBlock type data
OverlappingAMR(cxx) vtkOverlappingAMR Demonstrates how to create and populate a VTK's Overlapping AMR Grid type Data

Data Type Conversions

Point Cloud Operations

Example Name Classes Demonstrated Description Image
PointSource vtkPointSource

Working with Meshes

This section includes examples of manipulating meshes.

Example Name Classes Demonstrated Description Image
BoundaryEdges(cxx) vtkFeatureEdges Find the edges that are used by only one face.
CapClip(cxx) vtkClipPolyData Cap a clipped polydata with a polygon.
ClipDataSetWithPolyData(cxx) 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.
ClosedSurface(cxx) vtkFeatureEdges Check if a surface is closed.
ColoredElevationMap(cxx) vtkLookupTable Color a mesh by height.
Decimation(cxx) vtkDecimatePro Reduce the number of triangles in a mesh.
DeformPointSet(cxx) vtkDeformPointSet vtkElevationFilter Use the vtkDeformPointSet filter to deform a vtkSphereSource with arbitrary polydata.
DelaunayMesh(cxx) 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.
PointInterpolator(cxx) vtkPointInterpolator Plot a scalar field of points onto a PolyData surface.


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.


Example Name Classes Demonstrated Description Image
ImageWeightedSum(cxx) vtkImageWeightedSum Add two or more images.



Example Name Classes Demonstrated Description Image
SGrid(cxx) vtkStructuredGrid Creating a structured grid dataset of a semi-cylinder. Vectors are created whose magnitude is proportional to radius and oriented in tangential direction.


Example Name Classes Demonstrated Description Image
Vol(cxx) 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.


Example Name Classes Demonstrated Description Image
RGrid(cxx) vtkRectilinearGrid Creating a rectilinear grid dataset. The coordinates along each axis are defined using an instance of vtkDataArray.
RectilinearGrid(cxx) vtkRectilinearGrid create a rectilinear grid

Working with Unstructured 3D Data

This section includes vtkUnstructuredGrid.


Example Name Classes Demonstrated Description Image
ClipUnstructuredGridWithPlane(cxx) vtkTableBasedClipDataSet vtkUnstructuredGrid Clip a UGrid with a plane.
ClipUnstructuredGridWithPlane2(cxx) vtkClipDataSet vtkUnstructuredGrid Clip a UGrid with a plane.
UGrid(cxx) vtkUnstructuredGrid Creation of an unstructured grid.



Example Name Classes Demonstrated Description Image
MedicalDemo1(cxx) vtkMarchingCubes Create a skin surface from volume data
MedicalDemo2(cxx) vtkMarchingCubes Create a skin and bone surface from volume data
MedicalDemo3(cxx) vtkMarchingCubes Create skin, bone and slices from volume data
MedicalDemo4(cxx) vtkFixedPointVolumeRayCastMapper Create a volume rendering

Surface reconstruction

Example Name Classes Demonstrated Description Image
GaussianSplat(cxx) vtkGaussianSplatter Create a surface from Unorganized Points (Gaussian Splat).


Example Name Classes Demonstrated Description Image
Delaunay2D(cxx) vtkDelaunay2D
LUTUtilities(cxx) vtkLookupTable vtkColorSeries A utility class for vtkLookupTable allowing you to output the table contents or to compare tables.
MultipleViewports(cxx) vtkRenderer::SetViewport
SaveSceneToFieldData(cxx) vtkCamera Save a vtkCamera's state in a vtkDataSet's vtkFieldData and restore it.
SaveSceneToFile(cxx) vtkCamera Save a vtkCamera's state in a file and restore it.
Screenshot(cxx) vtkWindowToImageFilter
VTKVersion vtkVersion
VTKWithNumpy vtkImageImport
Variant(cxx) vtkVariant


Example Name Classes Demonstrated Description Image
GetValues GetTuple3
RenameArray SetName


Math Operations


Example Name Classes Demonstrated Description Image
ColorEdges(cxx) vtkGraphLayoutView Color edges.
ColorVertexLabels(cxx) vtkGraphLayoutView vtkRenderedGraphRepresentation Set the color of vertex labels.
ColorVerticesLookupTable(cxx) vtkGraphLayoutView Color vertices.
ConstructGraph(cxx) vtkMutableUndirectedGraph Construct a graph.
ConstructTree(cxx) vtkTree vtkMutableDirectedGraph Construct a tree.
EdgeWeights(cxx) vtkMutableDirectedGraph vtkGraphLayoutView
GraphToPolyData(cxx) vtkGraphToPolyData Convert a graph to a PolyData.
LabelVerticesAndEdges(cxx) vtkGraphLayoutView Label vertices and edges.
NOVCAGraph(cxx) vtkUnstructuredGrid vtkXMLUnstructuredGridWriter
RandomGraphSource(cxx) vtkRandomGraphSource Create a random graph.
ScaleVertices(cxx) vtkGraphLayoutView vtkRenderedGraphRepresentation Size/scale vertices based on a data array.
SelectedVerticesAndEdges(cxx) vtkAnnotationLink vtkGraphLayoutView
SideBySideGraphs(cxx) vtkGraphLayoutView Display two graphs side by side.
VisualizeDirectedGraph(cxx) vtkGlyphSource2D Visualize a directed graph.
VisualizeGraph(cxx) vtkMutableDirectedGraph vtkGraphLayoutView

Graph Conversions

Data Structures

Timing Demonstrations


Oriented Bounding Box (OBB) Tree


Modified BSP Tree


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

VTK Concepts


Example Name Classes Demonstrated Description Image
AmbientSpheres(cxx) vtkProperty Demonstrates the effect of ambient lighting on spheres.
CameraBlur(cxx) Example of a scene rendered with focal depth.
ColoredSphere(cxx) vtkSphereSource vtkElevationFilter A simple sphere.
Cone3(cxx) vtkRenderWindow Four frames of output, based on the VTK example
Cone4(cxx) vtkRenderWindow Modifying properties and transformation matrix based on the VTK example
DiffuseSpheres(cxx) vtkProperty Demonstrates the effect of diffuse lighting on spheres.
FlatVersusGouraud(cxx) 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(cxx) An example of multiple inputs and outputs.
Model(cxx) vtkRenderer vtkRenderWindow vtkRenderWindowInteractor Illustrative diagram of graphics objects.
MotionBlur(cxx) vtkRenderStepsPass vtkSimpleMotionBlurPass Example of motion blur.
PhysicallyBasedRendering(cxx) vtkSkybox vtkTexture Demonstrates physically based rendering, image based lighting, texturing and a skybox.
Rainbow(cxx) vtkLookupTable Use and manipulation of vtkLookupTables.
Rotations(cxx) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Rotations of a cow about her axes.
RotationsA(cxx) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Perform six rotations of a cow about her x-axis (Figure 3-31a).
RotationsB(cxx) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Perform six rotations of a cow about her y-axis (Figure 3-31b).
RotationsC(cxx) vtkActor::RotateX,Y,Z vtkRenderer::EraseOff Perform six rotations of a cow about her z-axis (Figure 3-31c).
RotationsD(cxx) 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).
Shadows(cxx) vtkCameraPass vtkRenderStepsPass vtkSequencePass vtkShadowMapBakerPass vtkShadowMapPass Draw model with shadows.
Skybox_PBR(cxx) vtkSkybox vtkTexture Demonstrates physically based rendering, image based lighting and a skybox.
SpecularSpheres(cxx) vtkProperty Demonstrates the effect of specular lighting on spheres.
StippledLine(cxx) vtkTexture Draw a stippled line.
StripFran(cxx) 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(cxx) vtkSphereSource vtkElevationFilter vtkTransform vkTransformFilter The addition of a transform filter to ColoredSphere.
WalkCow(cxx) vtkBYUReader vtkRenderWindow::EraseOff() vtkActor This generates Figs. 3-32, 3-33 found in VTKTextbook.pdf.
WalkCowA(cxx) vtkBYUReader vtkRenderWindow::EraseOff() vtkActor This generates Fig. 3-33a found in VTKTextbook.pdf.
WalkCowB(cxx) vtkBYUReader vtkRenderWindow::EraseOff() vtkActor This generates Fig. 3-33b found in VTKTextbook.pdf.


Texture Mapping

Example Name Classes Demonstrated Description Image
AnimateVectors(cxx) vtkTexture vtkGlyph3D One frame from a vector field animation using texture maps.
TextureCutQuadric(cxx) vtkBooleanTexture vtkImplicitTextureCoords Cut a quadric with boolean textures.
TextureCutSphere(cxx) vtkImplicitTextureCoords Examples of texture thresholding. (b) Boolean combination of two planes to cut nested spheres.
TexturePlane(cxx) vtkTexture Example of texture mapping.
TextureThreshold(cxx) vtkTexture vtkThresholdTextureCoords vtkStructuredGridGeometryFilter Demonstrate the use of scalar thresholds to show values of flow density on three planes.


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

Example Name Classes Demonstrated Description Image
AlphaFrequency(cxx) vtkLinearExtrusionFilter vtkVectorText Linearly extrude fonts to show letter frequencies in text.
AnatomicalOrientation(cxx) vtkAnnotatedCubeActor vtkAxesActor vtkOrientationMarkerWidget vtkTransform Show a labelled set of anatomical planes transecting a human figure.
AssignCellColorsFromLUT(cxx) vtkNamedColors vtkPlaneSource vtkLookupTable vtkColorTransferFunction Demonstrates how to assign colors to cells in a vtkPolyData structure using lookup tables.
BlobbyLogo(cxx) vtkImplicitModeller A logo created with vtkImplicitModeller.
Blow(cxx) vtkUnstructuredGridReader vtkWarpVector vtkConnectivityFilter Ten frames from a blow molding finite element analysis.
BluntStreamlines(cxx) vtkStructuredGridGeometryFilter vtkStreamTracer Demonstrates airflow around a blunt fin using streamlines.
Camera(cxx) vtkCamera Positioning and aiming the camera.
CameraModel1(cxx) vtkCameraActor Illustrate camera movement.
CameraModel2(cxx) vtkCameraActor Illustrate camera movement.
CarotidFlow(cxx) vtkStreamTracer vtkThresholdPoints Visualizing blood flow in the human carotid arteries. Streamtubes of flow velocity are generated.
CarotidFlowGlyphs(cxx) vtkGlyph3D vtkThresholdPoints Visualizing blood flow in human carotid arteries. Cone glyphs indicate flow direction and magnitude.
ClampGlyphSizes vtkGlyph3D Use vtkGlyph3D with ClampingOn to limit glyph sizes
ClipSphereCylinder(cxx) 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.
CollisionDetection(cxx) vtkCollisionDetectionFilter Collison between two spheres.
ColorActor vtkActor::GetProperty()::SetColor Colour the actor.
ColoredAnnotatedCube(cxx) vtkAnnotatedCubeActor vtkAxesActor vtkCubeSource vtkPropAssembly vtkOrientationMarkerWidget How to color the individual faces of an annotated cube.
ColorSeriesPatches(cxx) vtkColorSeries Creates a HTML file called VTKColorSeriesPatches
CombustorIsosurface(cxx) vtkContourFilter Marching cubes surface of flow density.
ComplexV(cxx) vtkHedgeHog ComplexV from the VTK Textbook.
ContourQuadric(cxx) vtkQuadric vtkSampleFunction vtkContourFilter Contouring a quadric function.
CreateBFont(cxx) vtkClipPolyData vtkImageDataGeometryFilter A scanned image clipped with a scalar value of 1/2 its maximum intensity produces a mixture of quadrilaterals and triangles.
CreateColorSeriesDemo(cxx) vtkColorSeries vtkLookupTable Create a custom vtkColorSeries.
CubeAxesActor(cxx) vtkCubeAxesActor Display three orthogonal axes with labels.FWorking with 3D
CurvatureBandsWithGlyphs(cxx) 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.
CutStructuredGrid(cxx) 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(cxx) vtkCutter How to use vtkCutter by cutting through a cube.
DataSetSurface(cxx) vtkDataSetSurfaceFilter Cutting a hexahedron with a plane. The red line on the surface shows the cut.
DecimateFran(cxx) vtkDecimatePro Examples of decimation algorithm. (a) Decimation of laser digitizer data.
DecimateHawaii(cxx) vtkDecimatePro Examples of decimation algorithm. (b) Decimation of terrain data.
DisplacementPlot(cxx) vtkColorTransferFunction vtkWarpVector vtkVectorDot Show modal lines for a vibrating beam.
DisplayCoordinateAxes(cxx) vtkOrientationMarkerWidget Display coordinate axes.
ElevationBandsWithGlyphs(cxx) 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(cxx) vtkWarpScalar Carpet plots. Visualization of an exponential cosine function. Function values are indicated by surface displacement. Colors indicate derivative values.
FlyingFrogSkinAndTissue(cxx) vtkMetaImageReader vtkFlyingEdges3D vtkWindowedSincPolyDataFilter vtkImageGaussianSmooth All frog parts and translucent skin.
FlyingHeadSlice(cxx) vtkFlyingEdges2D Flying edges used to generate contour lines.
FrogSlice(cxx) 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.
GlyphTable vtkGlyph3D Vary the shapes of glyphed points using a glyph table
Hanoi(cxx) Towers of Hanoi.
HanoiInitial(cxx) Towers of Hanoi - Initial configuration.
HanoiIntermediate(cxx) Towers of Hanoi - Intermediate configuration.
HardwareSelector vtkHardwareSelector
Hawaii(cxx) vtkElevationFilter vtkColorSeries vtkLookupTable Visualize elevations by coloring the scalar values with a lookup table.
HeadBone(cxx) vtkMarchingCubes Marching cubes surface of human bone.
HeadSlice(cxx) vtkContourFilter Marching squares used to generate contour lines.
HyperStreamline(cxx) 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.
InteractorStyleTrackballActor vtkInteractorStyleTrackBallActor
InteractorStyleTrackballCamera vtkInteractorStyleTrackBallCamera
IronIsoSurface(cxx) vtkContourFilter Marching cubes surface of iron-protein.
Kitchen(cxx) vtkStreamTracer vtkStructuredGrid Demonstrates stream tracing in a kitchen.
KochSnowflake(cxx) vtkPolyData vtkCellArray vtkPoints vtkPolyLine This example draws a Koch snowflake fractal using recursive functions and some of the convenient tools in the toolkit.
LOx(cxx) vtkStreamTracer vtkTubeFilter Streamtubes created by using the computational grid just in front of the post as a source for seeds.
LOxGrid(cxx) vtkStreamTracer vtkTubeFilter Portion of computational grid for the LOx post.
LOxSeeds(cxx) vtkStreamTracer vtkTubeFilter Streamlines seeded with spherical cloud of points. Four separate cloud positions are shown.
LoopShrink(cxx) 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.
Motor(cxx) vtkBYUReader vtkStructuredPointsReader vtkTexture vtkImplicitTextureCoords Texture cut used to reveal internal structure of a motor. Two cut planes are used in combination with transparent texture.
NamedColorPatches(cxx) vtkNamedColors Creates a HTML file called VTKNamedColorPatches
NamedColors(cxx) vtkNamedColors Demonstrates how to use the vtkNamedColors class.
NormalsDemo(cxx) vtkPolyDataNormals Demo different options to generate normals.
Office(cxx) vtkPointSource vtkStreamTracer Using random point seeds to create streamlines.
OfficeA(cxx) vtkPointSource vtkStreamTracer Corresponds to Fig 9-47(a) in the VTK textbook.
OfficeTube(cxx) vtkStreamTracer vtkTubeFilter The stream polygon. Sweeping a polygon to form a tube.
OrientedGlyphs(cxx) vtkGlyph3D Create oriented glyphs from vector data.
PineRootConnectivity(cxx) vtkMCubesReader vtkPolyDataConnectivityFilter Applying the connectivity filter to remove noisy isosurfaces.
PineRootConnectivityA(cxx) vtkMCubesReader vtkPolyDataConnectivityFilter The isosurface, with no connectivity filter applied.
PineRootDecimation(cxx) vtkMCubesReader vtkDecimatePro vtkConnectivityFilter Applying the decimation and connectivity filters to remove noisy isosurfaces and reduce data size.
PlateVibration(cxx) vtkWarpVector vtkVectorDot Demonstrates the motion of a vibrating beam.
PointDataSubdivision(cxx) vtkLinearSubdivisionFilter Vary the shapes of glyphed points using a programmable glyph filter
PointSize(cxx) vtkActor
ProbeCombustor(cxx) vtkProbeFilter Probing data in a combustor. Probes are regular arrays of 50 by 50 points that are then passed through a contouring filter.
ProgrammableGlyphs vtkProgrammableGlyphFilter Generate programmable glyphs.
PseudoVolumeRendering(cxx) vtkCutter vtkContourFilter 100 cut planes with opacity of 0.05. Rendered back-to-front to simulate volume rendering.
QuadraticSurface(cxx) vtkQuadric
QuadricVisualization(cxx) vtkQuadric vtkSampleFunction vtkContourFilter Visualizing a quadric function.
SingleSplat(cxx) vtkGaussianSplatter Elliptical splatting. (a) Single elliptical splat with eccentricity E=10. Cone shows orientation of vector.
SphereTexture vtkTextureMapToSphere Apply an ImageData texture to an sphere
SpikeFran(cxx) vtkGlyph3D Glyphs indicate surface normals on model of human face. Glyph positions are randomly selected.
SplatFace(cxx) 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(cxx) vtkRibbonFilter vtkLinearExtrusionFilter Two views from the stock visualization script. The top shows closing price over time; the bottom shows volume over time.
StreamLines(cxx) vtkStreamLine Seed streamlines with vectors from a structured grid
StreamlinesWithLineWidget(cxx) 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.
TensorAxes(cxx) vtkPointLoad vtkTensorGlyph Display the scaled and oriented principal axes of the stress tensor.
TensorEllipsoids(cxx) vtkPointLoad vtkTensorGlyph Display the scaled and oriented principal axes as tensor ellipsoids representing the stress tensor.
TextSource(cxx) vtkTextSource
VectorText(cxx) vtkVectorText Display high resolution text.
VelocityProfile(cxx) vtkMultiBlockPLOT3DReader vtkStructuredGridGeometryFilter vtkAppendPolyData vtkWarpVector Warping the geometry of three planes to show flow momentum.
ViewFrog(cxx) vtkMetaImageReader vtkMarchingCubes vtkImageGaussianSmooth vtkWindowedSincPolyDataFilter The complete frog without skin.
ViewFrogA(cxx) vtkMetaImageReader vtkMarchingCubes vtkImageGaussianSmooth vtkWindowedSincPolyDataFilter The complete frog without skin or skeleton.
ViewFrogBoth(cxx) vtkMetaImageReader vtkMarchingCubes vtkImageGaussianSmooth vtkImageGaussianSmooth The frog’s brain. Model extracted without smoothing (left) and with smoothing (right).
ViewFrogSkinAndTissue(cxx) vtkMetaImageReader vtkMarchingCubes vtkWindowedSincPolyDataFilter vtkImageGaussianSmooth All frog parts and translucent skin.
WarpCombustor(cxx) vtkWarpScalar vtkMultiBlockPLOT3DReader Carpet plots. Carpet plot of combustor flow energy in a structured grid. Colors and plane displacement represent energy values.
WindowTitle(cxx) vtkRenderWindow::SetWindowName

Working with vtkImageData

Example Name Classes Demonstrated Description Image
ImageDataGeometryFilter(cxx) vtkImageDataGeometryFilter Convert a vtkImageData to a vtkPolyData.
ImageNormalize(cxx) vtkImageNormalize Normalize an image.
SumVTKImages vtkImageWeightedSum A function to simplify the summing of images, where you can pass a list of images and weights.
WriteReadVtkImageData vtkImageData vtkXMLImageDataReader vtkXMLImageDataWriter Generate, edit and read out vtk image data.

Volume Rendering

Example Name Classes Demonstrated Description Image
SimpleRayCast(cxx) vtkFixedPointVolumeRayCastMapper Volume rendering of a high potential iron protein.

User Interaction

Example Name Classes Demonstrated Description Image
CallBack(cxx) vtkCallbackCommand vtkOrientationMarkerWidget Setting up a callback with client data. Two different methods are demonstrated.
HighlightPickedActor(cxx) vtkPropPicker vtkInteractorStyleTrackballCamera Pick and highlight an actor based on mouse clicks.
HighlightWithSilhouette(cxx) vtkPropPicker vtkPolyDataSilhouette Highlight a picked actor by adding a silhouette.
MouseEvents(cxx) vtkInteractorStyleTrackballCamera Subclass the interactor style.
MouseEventsObserver(cxx) vtkCallbackCommand Use an observer.

Working with Images

Example Name Classes Demonstrated Description Image
Actor2D(cxx) vtkActor2D vtkMapper2D 2D actor and mapper.
Cast(cxx) vtkImageCast Cast an image to a different type.
BackgroundImage(cxx) vtkJPEGReader vtkImageCanvasSource2D vtkImageActor vtkSuperquadricSource Display an image as the "background" of a scene, and render a superquadric in front of it.

Image Processing

Example Name Classes Demonstrated Description Image
Attenuation(cxx) 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.
EnhanceEdges(cxx) 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).
GaussianSmooth(cxx) vtkImageGaussianSmooth Low-pass filters can be implemented as convolution with a Gaussian kernel.
HybridMedianComparison(cxx) vtkImageHybridMedian2D vtkImageMedian3D Comparison of median and hybrid-median filters. The hybrid filter preserves corners and thin lines, better than the median filter.
IdealHighPass(cxx) 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.
ImageGradient(cxx) vtkImageMagnify vtkImageGaussianSmooth vtkImageGradient vtkImageEuclideanToPolar vtkImageExtractComponents vtkImageHSVToRGB Create an imaging pipeline to visualize gradient information.
ImageWarp(cxx) 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(cxx) 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(cxx) vtkImageGaussianSmooth vtkImageMedian3D vtkImageNoiseSource Comparison of Gaussian and Median smoothing for reducing low-probability high-amplitude noise.
MorphologyComparison(cxx) vtkImageDilateErode3D vtkImageSeedConnectivity This figure demonstrates various binary filters that can alter the shape of segmented regions.
Pad(cxx) 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.
VTKSpectrum(cxx) 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.


Example Name Classes Demonstrated Description Image
BalloonWidget(cxx) vtkBalloonWidget vtkBalloonRepresentation Uses a vtkBalloonWidget to draw labels when the mouse stays above an actor.
BoxWidget(cxx) vtkBoxWidget This 3D widget defines a region of interest that is represented by an arbitrarily oriented hexahedron with interior face angles of 90 degrees (orthogonal faces). The object creates 7 handles that can be moused on and manipulated.
ContourWidget(cxx) vtkContourWidget vtkOrientedGlyphContourRepresentation Draw a contour (line) which can be deformed by the user
OrientationMarkerWidget(cxx) vtkAnnotatedCubeActor vtkOrientationWidget Draws two cubes. One of them can be clicked to be rotated, and will rotate the second one. The second one has annotations on it, and can also be moved.
ScalarBarWidget vtkScalarBarWidget The ScalarBarWidget displays a scalar bar that is movable and changes orientation automatically when close to the borders of the image. It needs a ScalarBarActor
SphereWidget(cxx) vtkSphereWidget This 3D widget defines a sphere that can be interactively placed in a scene.
TextWidget(cxx) vtkTextWidget Annotate a VTK image with movable text


Example Name Classes Demonstrated Description Image
ScatterPlot(cxx) vtkChartXY
SpiderPlot(cxx) vtkSpiderPlotActor
SurfacePlot(cxx) vtkPlotSurface vtkChartXYZ Surface plot


Example Name Classes Demonstrated Description Image
Animation(cxx) vtkRenderWindowInteractor Move a sphere across a scene.


Example Name Classes Demonstrated Description Image
MultiLineText(cxx) vtkTextMapper Display multiline text.
TextOrigin(cxx) This example demonstrates the use of vtkVectorText and vtkFollower. vtkVectorText is used to create 3D annotation.

Geographic Visualization (Geovis)

Example Name Classes Demonstrated Description Image
CompassWidget vtkCompassWidget vtkCompassRepresentation Draws an interactive compass.
CompassWidget(cxx) vtkCompassWidget Compass Widget.
EarthSource(cxx) vtkEarthSource Create the Earth.
GeoGraticle(cxx) vtkGeoGraticle Show lat/long lines that have been distorted.
GeoAssignCoordinates(cxx) vtkGeoAssignCoordinates vtkMutableDirectedGraph vtkGraphMapper Draws a sphere, based on longituds and latitudes.
ParallelCoordinatesView(cxx) vtkRTAnalyticSource vtkParallelCoordinatesView vtkParallelCoordinatesRepresentation Plotting data attributes in a Parallel Coordinates View


Example Name Classes Demonstrated Description Image
ParallelCoordinatesExtraction vtkExtractSelection vtkAnnotationLink Extract data based on a selection in a Parallel Coordinates View
SelectedGraphIDs vtkAnnotationLink vtkRandomGraphSource vtkGraphLayoutView Callback on vtkAnnotationLink in a Graph Layout View when selection is changed


Example Name Classes Demonstrated Description Image
EmbedInPyQt vtkRenderWindowInteractor Shows how to easily embed VTK in PyQt with QVTKRenderWindowInteractor, first example
EmbedInPyQt2 vtkRenderWindowInteractor Shows how to embed VTK in PyQt with QVTKRenderWindowInteractor, second example

Has Bugs

Example Name Classes Demonstrated Description Image
UnstructuredTransientVolumeRendering vtkUnstructuredGridVolumeRayCastMapper