VTK/Examples/Cxx

From KitwarePublic
< VTK‎ | Examples
Revision as of 12:28, 16 January 2013 by Lorensen (Talk | contribs)

Jump to: navigation, search

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.

Please add examples in your areas of expertise!

Simple Operations

Example Name VTK Classes Demonstrated Description
Distance between a point and a line vtkLine
Distance between two points vtkMath::Distance2BetweenPoints Computes the distance between two points
Random number (uniform distribution) vtkMath Generates uniform random numbers
Random number (Gaussian distribution) vtkMath Generates Gaussian random numbers
Random sequence vtkMinimalStandardRandomSequence This is the preferred way to generate random numbers.
Project a point onto a plane vtkPlane Project a point onto a plane
Floating Point Exceptions vtkFloatingPointExceptions Floating Point Exceptions
Apply a perspective transformation to a point vtkPerspectiveTransform

Input and Output

Graph Formats

3D File Formats

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

Standard Formats

Input
Example Name VTK Classes Demonstrated Description
Read a simple "xyz" file of points vtkSimplePointsReader
Read an "xyza" file 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
Read a plain text file into a polydata vtkPolyData Manually read a file using getline()
Read a plain text file into a polydata vtkPolyData vtkSmartPointer vtkPoints vtkCellArray vtkXMLPolyDataWriter Manually read a plain text file format
Read a delimited file into a polydata vtkDelimitedTextReader
Read an OBJ (.obj) File vtkOBJReader
Convert a series of DICOM files into a VTI File vtkDICOMImageReader This example demonstates how to read a series of DICOM images and scroll through slices
Read a VRML (WRL) file vtkVRMLImporter
Read individual VRML (WRL) actors vtkVRMLImporter This example is used to get each actor and object from a scene and verify axes correspondence
Read DICOM file vtkDICOMImageReader
Report the contents of a VTK XML or legacy file vtkDataSetReader
Read DEM (elevation map) files vtkDEMReader
Read stereo lithography STL (.stl) files vtkSTLReader
Read PLY (.ply) files vtkPLYReader
Read PLOT3D (.bin) files vtkPLOT3DReader Read CFD (computational fluid dynamics) data produced by PLOT3D.
Read Protein Data Bank files (.pdb) files vtkPDBReader Read Protein Data Bank Files.
Output
Example Name VTK Classes Demonstrated Description
Write a simple ".xyz" file vtkSimplePointsWriter
Write stereo lithography STL (.stl) files vtkSTLWriter
Write PLY (.ply) files vtkPLYWriter
Write data to a delimited file vtkDelimitedTextWriter

VTK Formats

Input
Example Name VTK Classes Demonstrated Description
Read an unstructured grid (.vtu) file vtkXMLUnstructuredGridReader
Read a polygonal data (.vtp) file vtkXMLPolyDataReader
Read a image data (.vti) file vtkXMLImageDataReader
Read a structured grid (.vts) file vtkXMLStructuredGridReader
Read a rectilinear grid (.vtr) file vtkXMLRectilinearGridReader
Read an XML file and later decide what kind it is vtkXMLGenericDataObjectReader
Output
Example Name VTK Classes Demonstrated Description
Write a .vtu file vtkXMLUnstructuredGridWriter VTU is an "Unstructured Grid". This format allows for 3D data to be stored.
Write a .vtp file vtkXMLPolyDataWriter VTP is a "PolyData". This format allows for the most complex geometric objects to be stored.
Write a .vti file vtkXMLImageDataWriter VTI is an "ImageData".
Write a .vts file from a vtkStructuredGrid vtkXMLStructuredGridWriter

Legacy VTK Formats

Example Name VTK Classes Demonstrated Description
Read any type of legacy .vtk file vtkGenericDataObjectReader
Read a structured grid (.vtk) file vtkStructuredGridReader
StructuredPointsReader vtkStructuredPointsReader

Image Formats

Input

Example Name VTK Classes Demonstrated Description
Read BMP (.bmp) files vtkBMPReader
Read a JPG image vtkJPEGReader
Read a PNG image vtkPNGReader
Read PNM (.pnm) files vtkPNMReader
Read TIFF (.tif) files vtkTIFFReader
Read .mha files vtkMetaImageReader
Read most standard image formats. 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.

Output

Example Name VTK Classes Demonstrated Description
Write a BMP (.bmp) file vtkBMPWriter
Write a JPEG (.jpg) file vtkJPEGWriter
Write a PNG (.png) file vtkPNGWriter
Write a PNM (.pnm) file vtkPNMWriter
Write a TIFF (.tif) file vtkTIFFWriter
Write a .mha/.mhd + .raw file vtkMetaImageWriter

Geometric Objects

Example Name VTK Classes Demonstrated Description
Compute the intersection of a line segment with a polygon vtkPolygon IntersectWithLine()
A demonstration of all geometric objects that work the same way
Arrow vtkArrowSource
Axes vtkAxesActor
Colored Lines vtkCellData vtkLine
Cone vtkConeSource
Cube vtkCubeSource
Cylinder vtkCylinderSource
Disk vtkDiskSource A circle with a hole in it.
Frustum vtkFrustumSource
Line vtkLineSource
Manually create a polyline vtkLine
Hexahedron vtkHexahedron
Oriented Arrow vtkArrowSource
Plane vtkPlaneSource
Planes vtkPlanes
PlanesIntersection vtkPlanesIntersection
PlatonicSolid vtkPlatonicSolidSource
Point vtkPoints
Polygon vtkPolygon
Pyramid vtkPyramid
PolyLine vtkPolyLine
Quad vtkQuad
Regular Polygon vtkRegularPolygonSource
Sphere vtkSphereSource
Triangle vtkTriangle
Triangle strip vtkTriangleStrip
Tetrahedron vtkTetra
Vertex vtkVertex

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 VTK Classes Demonstrated Description
Create and display a parametric object vtkParametricBoy, vtkParametricConicSpiral, vtkParametricCrossCap, vtkParametricDini, vtkParametricEllipsoid, vtkParametricEnneper, vtkParametricFigure8Klein, vtkParametricKlein, vtkParametricMobius, vtkParametricRandomHills, vtkParametricRoman, vtkParametricSpline, vtkParametricSuperEllipsoid, vtkParametricSuperToroid, vtkParametricTorus
Demonstration of all of the vtkParametric* classes

Implicit Functions and Iso-surfaces

Example Name VTK Classes Demonstrated Description
Visualize different isocontours using a slider vtkContourFunction
Sample and visualize an implicit function vtkSampleFunction
Extract largest isosurface vtkPolyDataConnectivityFilter
BandedPolyDataContourFilter vtkBandedPolyDataContourFilter
Create filled contours (vtkClipPolyData) vtkContourFilter
An implicit representation of a sphere vtkSphere
Marching cubes vtkMarchingCubes Create a voxelized sphere
Marching squares vtkMarchingSquares Create a contour from a structured point set (image)

Working with 3D Data

Example Name VTK Classes Demonstrated Description
Compute the center of mass of the points CenterOfMass
Perform boolean operations on two vtkPolyData objects BooleanOperationPolyDataFilter
Compute the distance function from one vtkPolyData to another DistancePolyDataFilter
Compute the distance function in a space around a vtkPolyData ImplicitPolyDataDistance
Compute the intersection of two vtkPolyData objects IntersectionPolyDataFilter
Move all items in a PolyData towards their centroid vtkShrinkPolyData
Extract non-zero vectors from a vtkImageData vtkExtractSelectedThresholds Doesn't know which array to process?
Combine MultiBlockDataSets vtkMultiBlockMergeFilter, vtkMultiBlockDataSet
Iterate through the lines of a PolyData vtkCellArray
Align coordinate frames vtkLandmarkTransform
vtkWarpVector vtkWarpVector
Get the names of all of the data arrays vtkPolyData
Get point locations/coordinates from a vtkPolyData vtkPolyData
NullPoint vtkPointData Set everything in PointData at a specified index to NULL
Create contours from PolyData vtkCutter
OperationsOnImplicitFunctions vtkImplicitBoolean Operations include intersection and union.
Color any dataset type based on connectivity vtkConnectivityFilter
Append different types of data vtkAppendFilter
Perlin Noise vtkPerlinNoise
Create a circle vtkCutter Create a circle by cutting through a sphere.
Create a custom filter without subclassing vtkProgrammableFilter
Apply a Transformation to a PolyData vtkTransformPolyDataFilter
Combine/Append PolyData vtkAppendPolyData
Create a surface between lines vtkRuledSurfaceFilter
Remove coincident points vtkCleanPolyData
Determine which cells share a single point with a specific cell vtkPolyData::GetCellNeighbors connected
Determine which cells share an edge with a specific cell vtkPolyData::GetCellNeighbors connected
Iso lines on the surface of a polydata vtkBandedPolyDataContourFilter
KMeans Clustering vtkKMeansStatistics
Parallel KMeans Clustering vtkPKMeansStatistics
Move vertices along normals vtkWarpScalar
Get a list of vertices attached (through an edge) to a vertex vtkPolyData::GetCellPoints Vertex connectivity (connected, neighbor)
DeletePoint vtkPoints, vtkPolyData
ThinPlateSplineTransform vtkThinPlateSplineTransform
Generate point and cell id arrays vtkIdFilter
Mirror a DataSet vtkReflectionFilter
Compute points at the center of every cell vtkCellCenters
Extract selection points vtkExtractSelection
Extract selected points vtkExtractSelectedIds extract point, select point
Extract selection and find correspondence between new and original Id vtkExtractSelection
Extract selection cells vtkExtractSelection extract cell, select cell
Extract points but bring cells that are still complete with them vtkExtractSelection, vtkSelection, vtkSelectionNode
Snap (quantize) points to a grid vtkQuantizePolyDataPoints
Flip normals vtkReverseSense
Convex hull of points projected onto the coordinate planes vtkPointsProjectedHull
Create an SCurve spline on a set of points vtkSCurveSpline
Create an Kochanek spline on a set of points vtkKochanekSpline
Create a Cardinal spline on a set of points vtkCardinalSpline, vtkParametricSpline, vtkParametricFunctionSource
Select visible points vtkSelectVisiblePoints
Extract and highlight visible cells vtkHardwareSelector
Convert triangles to triangle strips vtkStripper
Convert vtkUnstructuredGrid to vtkPolyData vtkDataSetSurfaceFilter
Convert vtkUnstructuredGrid to vtkPolyData (another way) vtkGeometryFilter
Compute the distance from an object to every point on a uniform grid vtkImplicitModeller
Transform a data set vtkTransformFilter
Interpolate terrain vtkProbeFilter Here is a good explanation of what is going on.
Sample a PolyData vtkPolyDataPointSampler Sample the edges or surfaces of a polydata.
Select a subset (mask) of a point set vtkMaskPoints
Linear Extrusion vtkLinearExtrusionFilter Extrude a shape.
Rotation around a line vtkTransform, vtkTransformPolyDataFilter
Extract the outer surface of a multiple surface polydata vtkPolyDataConnectivityFilter
vtkVoxelContoursToSurfaceFilter vtkVoxelContoursToSurfaceFilter
vtkTubeFilter vtkTubeFilter Give lines a thickness (produce a cylinder around lines.
vtkRibbonFilter vtkRibbonFilter
Convex hull using shrink wrapping vtkSmoothPolyDataFilter
Convex hull using vtkHull vtkHull
Check if a point is inside an object vtkSelectEnclosedPoints
Check if a point is inside an object (alternate method) 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".
Data Bounds vtkPolyData::GetBounds Get the minimum and maximum value in each dimension. (Axis aligned bounding box)
Demonstrate how the order of applying transforms affects the result vtkTransformPolyDataFilter
Outline vtkOutlineFilter Draw the bounding box of the data
Triangle Area vtkTriangle::TriangleArea Compute the area of all triangles in a polydata.
Silhouette vtkPolyDataSilhouette
Thresholding Points vtkThresholdPoints
Thresholding Cells vtkThreshold
Align point sets vtkProcrustesAlignmentFilter
Compute the gradient of a scalar field on a data set vtkGradientFilter
Generate a binarized volume from a closed surface vtkPolyDataToImageStencil
Generate a binarized image from a closed contour vtkLinearExtrusionFilter,vtkPolyDataToImageStencil
Extract polylines from polydata vtkPolyData
Fit a spline to cutter output vtkKochanekSpline, vtkSplineFilter, vtkSpline
Remove duplicate (merge) points vtkMergePoints Insert unique point
Decimate polyline vtkDecimatePolylineFilter
Add Global Miscellaneous Data (FieldData) to a Polydata vtkFieldData
Extract Normals from a Polydata vtkPolyDataNormals
Determine data types of arrays vtkPolyData
Embed points into a volume vtkGaussianSplatter
Copy all arrays from one vtkPolyData to another vtkPolyData
Colored Points vtkUnsignedCharArray Add three points to a polydata and associate a color with each of them.
Triangle - Colored Points vtkUnsignedCharArray Set the color of each point of a triangle. You will be able to interpolate the colors across the triangle.
Triangle - Solid Color vtkUnsignedCharArray Create a solid colored triangle.
Color Cells vtkLookupTable Color individual cells of a polydata
Add/Get Normals to/from cells in a Polydata vtkCellData
Add/Get Normals to/from points in a Polydata vtkPointData
Add Miscellaneous Data to Points in a Polydata vtkPointData, vtkFloatArray
Get Miscellaneous Data from Points in a Polydata vtkDoubleArray
Add Miscellaneous Data to Cells in a Polydata vtkCellData
Get Miscellaneous Data from Cells in a Polydata vtkCellData
Get the External Contour from Polydata vtkWindowToImageFilter, vtkContourFilter
Combining the transformation, in order to manipulate a group of vtkActor. vtkTransform Shown in the example robot arm motion.

Point cloud operations

Example Name VTK Classes Demonstrated Description
Generate a random point cloud vtkPointSource
Downsample a point cloud vtkCleanPolyData Remove points so that there are no points within a tolerance of any point.

Working with Meshes

Example Name VTK Classes Demonstrated Description
Add a cell vtkPolyData Add a cell to an existing mesh.
Matrix math filter vtkMatrixMathFilter Compute various quantities on cell and points in a mesh.
vtkWeightedTransformFilter vtkWeightedTransformFilter
Create a mesh from an ImageData vtkGreedyTerrainDecimation
Extract the largest connected region in a polydata vtkPolyDataConnectivityFilter
Extract a specific (specified) connected region in a polydata vtkPolyDataConnectivityFilter
Color each disconnected region of a vtkPolyData a different color vtkPolyDataConnectivityFilter
Compute Gaussian, Mean, Min, and Max Curvatures vtkCurvatures
Mesh Quality vtkMeshQuality
Highlight Bad Cells vtkMeshQuality
Interactively find the shortest path between two points on a mesh vtkPolygonalSurfaceContourLineInterpolator
Find the shortest path between two points on a mesh vtkDijkstraGraphGeodesicPath
Select a region of a mesh vtkSelectPolyData
Laplacian smoothing vtkSmoothPolyDataFilter
Check if a surface is closed vtkFeatureEdges
Decimation vtkDecimatePro Reduce the number of triangles in a mesh.
Decimation (quadric decimation) vtkQuadricDecimation Reduce the number of triangles in a mesh.
Decimation (quadric clustering) vtkQuadricClustering Reduce the number of triangles in a mesh.
Subdivision vtkButterflySubdivisionFilter, vtkLoopSubdivisionFilter, vtkLinearSubdivisionFilter Increase the number of triangles in a mesh.
Finding Boundary Edges vtkFeatureEdges Find the edges that are used by only one face.
Fill Holes vtkFillHolesFilter Close holes in a mesh.
Windowed Sinc PolyData Filter|Smooth a mesh (windowed sinc filter) vtkWindowedSincPolyDataFilter Smooth a mesh.
Color a mesh by height vtkLookupTable Colormap, color map
Color a mesh by height vtkElevationFilter
Color a mesh by dotting a vector from the origin to each point with a specified vector vtkSimpleElevationFilter
Triangulate a mesh vtkTriangleFilter Convert all polygons in a mesh to triangles.
Extract Edges vtkExtractEdges
Get edges of cells vtkCell
Create a "solid" clip vtkClipPolyData
Cap a clipped polydata with a polygon vtkClipPolyData
OBBDicer vtkOBBDicer Breakup a mesh into pieces.

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: [1]. Image data can represent at typical 2D image, but also, a 3D volume.

vtkImageData

Example Name VTK Classes Demonstrated Description
Get the coordinates of the center of a cell vtkImageData
Get the id of a cell from its grid coordinates vtkStructuredData
Iterating over a vtkImageData vtkImageData Set and access locations in a 3D image. Iterate.
Normalize an image vtkImageNormalize
Extract a volume of interest (subvolume) vtkExtractVOI Crop
Add two or more images vtkImageWeightedSum
Resize a vtkImageData vtkImageReslice
Change the extent of a vtkImageData vtkImageTranslateExtent


Conversions

Example Name VTK Classes Demonstrated Description
Convert a vtkImageData to a vtkPolyData vtkImageDataGeometryFilter
Convert a vtkImageData to a vtkStructuredGrid vtkImageDataToPointSet

vtkStructuredGrid

Example Name VTK Classes Demonstrated Description
Structured Grid vtkStructuredGrid
Visualize the points of a structured grid vtkStructuredGridGeometryFilter
Visualize the outline of a structured grid vtkStructuredGridOutlineFilter
Visualize the cells of a structured grid vtkShrinkFilter
Blank a point of a vtkStructuredGrid vtkStructuredGrid

vtkStructuredPoints

Example Name VTK Classes Demonstrated Description
Convert a vtkStructuredPoints to a vtkUnstructuredGrid vtkStructuredPoints, vtkUnstructuredGrid

vtkRectilinearGrid

Example Name VTK Classes Demonstrated Description
Rectilinear grid vtkRectilinearGrid
Visualize the cells of a rectilinear grid vtkRectilinearGrid, vtkShrinkFilter
Convert a vtkRectilinearGrid to a vtkUnstructuredGrid mesh vtkRectilinearGridToTetrahedra

Registration

Example Name VTK Classes Demonstrated Description
Iterative Closest Points (ICP) Transform vtkIterativeClosestPointTransform
Landmark Transform vtkLandmarkTransform

Surface reconstruction

Example Name VTK Classes Demonstrated Description
Create a surface from Unorganized Points (Gaussian Splat) vtkGaussianSplatter
Triangulate a Terrain Map vtkDelaunay2D Generate heights (z values) on a 10x10 grid (a terrain map) and then triangulate the points to form a surface.
Create cubes from labeled volume data vtkMetaImageReader, vtkMaskFields
Create models from labeled volume data (Discrete MarchingCubes) vtkDiscreteMarchingCubes
Create a solid mesh from Unorganized Points (Delaunay3D) vtkDelaunay3D Convex hull.
Create a surface from Unorganized Points (with post processing) vtkSurfaceReconstructionFilter
Create a surface from Unorganized Points vtkSurfaceReconstructionFilter

Utilities

Example Name VTK Classes Demonstrated Description
Shallow copy a VTK object
Deep copy a VTK object
Capture the Z-buffer/depth buffer vtkRenderer zbuffer
Share a camera between multiple renderers vtkRenderer, vtkCamera
Perform in-place operations on arrays vtkArrayCalculator
File Output Window vtkFileOutputWindow Write errors to a log file instead of the screen.
Write a DenseArray or SparseArray to a file
Update the screen from inside an algorithm Visual debugging
Get the frame rate of the rendering
Find the path of VTK_DATA_ROOT vtkTesting
Find the location of a value in a vtkDataArray vtkDataArray vtkDataArray::LookupValue
Point inside polygon test vtkPolygon vtkPolygon::PointInPolygon
Box intersection and Inside tests vtkBoundingBox
Monitor a filters progress
Multiple Viewports vtkRenderer::SetViewPort
Side by side viewports vtkRenderer::SetViewPort
MultipleRenderWindows vtkRenderWindow
Casting VTK objects vtkObject::SafeDownCast
Concatenate two arrays vtkConcatenateArray
Produce a random vector at each point in a dataset vtkBrownianPoints
Mathematical vector class vtkVector
Compute Principle Component Analysis (PCA) values vtkPCAStatistics
Project 2D points onto the best 1D subspace (PCA Demo) vtkPCAStatistics
Pass input along to output vtkPassThrough
Convert a vtkDenseArray to a vtkTable vtkArrayToTable
Cardinal spline Interpolation vtkCardinalSpline
Shepard method interpolation vtkShepardMethod
Timer log vtkTimerLog
Time stamp vtkTimeStamp
Subclass vtkCommand vtkCommand Instead of using a callback function, it is more powerful to subclass vtkCommand.
Interpolation using a piecewise function vtkPiecewiseFunction
Convert between data types vtkVariant
Coordinate system conversions vtkCoordinate
Check VTK Version vtkVersion
Catch errors and warnings vtkCommand
Check VTK Version Macro/#define's
Color Lookup Table vtkLookupTable
Color Transfer Function vtkColorTransferFunction
Discretizable Color Transfer Function vtkDiscretizableColorTransferFunction
Construct a Table 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.
Delaunay Triangulation (2D) vtkDelaunay2D Perform a 2D Delaunay triangulation on a point set.
Constrained Delaunay Triangulation (2D) vtkDelaunay2D Perform a 2D Delaunay triangulation on a point set respecting a specified boundary.
Known Length Array vtkFloatArray
Unknown Length Array vtkFloatArray
Array of Vectors (Known Length) vtkFloatArray
Array of Vectors (Unknown Length) vtkFloatArray
Get the bounds of a vtkDenseArray vtkDenseArray, vtkArrayRange
Get the bounds (min,max) of a vtk array vtkFloatArray::GetRange minimum, maximum
2D Array vtkDenseArray
3D Array vtkDenseArray
Sparse Array vtkSparseArray
Custom type Dense (2D) Array vtkDenseArray
Determine the type of a VTK variable GetClassName()
Determine the type of an actor vtkActor, vtkActorCollection
Screenshot vtkWindowToImageFilter
Directory File Extensions vtkDirectory, vtksys/SystemTools
FilenameFunctions vtkDirectory, vtksys/SystemTools Do things like get the file extension, strip the file extension, etc.
Timer vtkRenderWindowInteractor::CreateRepeatingTimer
Off Screen Rendering vtkImagingFactory, vtkGraphicsFactory
String function parser vtkFunctionParser
Catch the window modified event vtkRenderWindow

CMake Techniques

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

Math Operations

Example Name VTK Classes Demonstrated Description
Normalize a vector vtkMath
vtkVectorDot vtkVectorDot
Raise all elements in an array to a power vtkPowerWeighting
Least Squares vtkMath::SolveLeastSquares
Homogeneous Least Squares vtkMath::SolveHomogeneousLeastSquares
Compute eigenvalues and eigenvectors of a symmetric matrix vtkMath::Jacobi
Matrix transpose vtkMatrix3x3
Matrix inverse vtkMatrix3x3
Get a vector perpendicular to another vector vtkMath::Perpendiculars
Get the lengths of an array of vectors vtkVectorNorm
Interpolate 1-tuples (linear, spline-based) vtkTupleInterpolator vtkCardinalSpline vtkKochanekSpline A simple example demonstrating how functions defined by sparsely distributed supporting points can be interpolated at arbitrary positions.

Graphs

Example Name VTK Classes Demonstrated Description
Find the shortest path on a graph vtkDijkstraGraphGeodesicPath
Set the color of vertex labels vtkGraphLayoutView, vtkRenderedGraphRepresentation
Set the size of vertices vtkGraphLayoutView, vtkRenderedGraphRepresentation Vertex size.
Size/scale vertices based on a data array vtkGraphLayoutView, vtkRenderedGraphRepresentation
Get a list of selected vertices and edges vtkAnnotationLink
Get a list of selected vertices and edges using an observer of AnnotationChangedEvent vtkAnnotationLink
Manually set coordinates of vertices in a graph vtkGraph::SetPoints, vtkPassThroughLayoutStrategy
Create either a vtkMutableDirectedGraph or vtkMutableUndirectedGraph vtkMutableGraphHelper
Display two graphs side by side vtkGraphLayoutView
Get all vertices connected to a specified vertex vtkAdjacentVertexIterator
Edge weights vtkGraph::GetEdgeData::AddArray
Iterate over edges vtkEdgeListIterator
Iterate over edges incoming to a vertex vtkInEdgeIterator
Iterate over edges outgoing from a vertex vtkOutEdgeIterator
Breadth first search tree vtkBoostBreadthFirstSearchTree
Distance from origin vtkBoostBreadthFirstSearch
Color vertices vtkGraphLayoutView
Color edges vtkGraphLayoutView
Construct a graph vtkMutableUndirectedGraph
Construct a tree vtkTree, vtkMutableDirectedGraph
Minimum spanning tree of a graph vtkBoostPrimMinimumSpanningTree
Depth First Search iterator vtkTreeDFSIterator
Breadth First Search iterator vtkTreeBFSIterator
Visualize a graph vtkGraphLayoutView, vtkGraphLayoutStrategy, vtkSimple2DLayoutStrategy
Label vertices and edges vtkGraphLayoutView::SetEdgeLabelArrayName, vtkGraphLayoutView::SetVertexLabelArrayName
Find Connected Components vtkBoostConnectedComponents
Convert a graph to a PolyData vtkGraphToPolyData
Visualize Directed Graph vtkGlyphSource2D
Create a random graph vtkRandomGraphSource
Depth First Search Animation vtkTreeDFSIterator
Remove vertices of degree 0 from a vtkGraph vtkRemoveIsolatedVertices

Graph Conversions

Example Name VTK Classes Demonstrated Description
vtkMutableDirectedGraph to vtkDirectedGraph vtkMutableDirectedGraph, vtkDirectedGraph
vtkDirectedGraph to vtkMutableDirectedGraph vtkMutableDirectedGraph, vtkDirectedGraph
vtkTree to vtkMutableDirectedGraph vtkMutableDirectedGraph, vtkTree

Graph Conversions That Don't Work

Example Name VTK Classes Demonstrated Description
vtkMutableDirectedGraph to vtkMutableUndirectedGraph vtkMutableDirectedGraph, vtkMutableUndirectedGraph
vtkMutableUndirectedGraph to vtkMutableDirectedGraph vtkMutableDirectedGraph, vtkMutableUndirectedGraph
vtkTree to vtkMutableUndirectedGraph vtkTree, vtkMutableUndirectedGraph

Data Structures

Example Name VTK Classes Demonstrated Description
Attach attributes vtkInformation Attach attributes to a VTK array
Find all points within a radius of a specified point vtkPointLocator
Visualization of the tree of a vtkCellLocator vtkCellLocator
Visualization of the tree of a vtkPointLocator vtkPointLocator
Efficient 3D point query vtkPointLocator
Efficient 3D cell query vtkCellLocator
Points inside an object using vtkCellTreeLocator vtkCellTreeLocator

Timing Demonstrations

Example Name VTK Classes Demonstrated Description
Octree timing demo vtkOctreePointLocator Plot the runtime vs MaxPointsPerRegion
KDTree timing demo vtkKdTreePointLocator Plot the runtime vs MaxLevel (doesn't seem correct)
OBBTree timing demo vtkOBBTree Plot the runtime vs MaxLevel
ModifiedBSPTree timing demo vtkModifiedBSPTree Plot the runtime vs MaxLevel

KD-Tree

Example Name VTK Classes Demonstrated Description
vtkKdTree_BuildLocatorFromPoints vtkKdTree
vtkKdTree_BuildLocatorFromPoints_ClosestKPoints vtkKdTree
Access the points of a KDTree vtkKdTree
Find the closest point to a query point vtkKdTreePointLocator
Find the closest N points to a query point vtkKdTreePointLocator
Visualize levels of the tree vtkKdTreePointLocator
Find points within a specified radius of a query point vtkKdTreePointLocator
Data structure comparison vtkKdTree, vtkOBBTree, vtkOctreePointLocator, vtkModifiedBSPTree Illustrates, side by side, the differences between several spatial data structures

Oriented Bounding Box (OBB) Tree

Example Name VTK Classes Demonstrated Description
Intersect a line with a vtkOBBTree vtkOBBTree
Visualize levels of the tree vtkOBBTree

Octree

Example Name VTK Classes Demonstrated Description
Create an octree vtkOctreePointLocator
Find the closest point to a query point vtkOctreePointLocator
Find the K closest points to a query point vtkOctreePointLocator
Find the points within a sphere of specified radius to a query point vtkOctreePointLocator
Visualize levels of the tree vtkOctreePointLocator
Insert points into an octree without rebuilding it vtkIncrementalOctreePointLocator

Modified BSP Tree

Example Name VTK Classes Demonstrated Description
Intersect a line with a modified BSP Tree vtkModifiedBSPTree
Visualize levels of the tree vtkModifiedBSPTree

VTK Concepts

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

Lighting

Example Name VTK Classes Demonstrated Description
Create shadows vtkShadowMapPass
Add a directional light to a scene vtkLight
Display the location and direction of a light vtkLightActor

Visualization

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

Example Name VTK Classes Demonstrated Description
Switch between coloring the actor and coloring the data vtkDataSetMapper ScalarVisibility, color
Display an image in 2D vtkImageMapper
Use a texture for the background of a vtkRenderer vtkRenderer, vtkTexture Background texture, BackgroundTexture
Visualize a vector field vtkGlyph3D
Orientation of the view of an image vtkInteractorStyleImage
Draw a caption/bubble pointing to a particular point CaptionActor2D
Determine the display order of a stack of images vtkRenderer
Render into an existing OpenGL Context vtkRenderPass,vtkVolumetricPass
Set transparency of image pixels vtkImageData
Create oriented glyphs from vector data [2]
Create oriented lines (hedgehogs) from vector data vtkHedgeHog, vtkStructuredGrid
Change the width/thickness of lines in an actor vtkActor, vtkProperty
Change the shape of the cursor vtkRenderWindow
Get the bounds of the whole scene vtkRenderer
Convolve a splat image with every point in an input image vtkFastSplatter
Create tubes with varying radius and colors vtkTubeFilter
vtkGlyph2D vtkGlyph2D
vtkGlyph3D vtkGlyph3D
Add a vertex to each point vtkVertexGlyphFilter
vtkCutter vtkCutter
Display a quadratic surface vtkQuadric
Backface culling vtkActor::GetProperty::BackfaceCullingOn
Background color vtkRenderer::SetBackground
Background gradient vtkRenderer::GradientBackgroundOn, vtkRenderer::Setbackground2
CameraActor vtkCameraActor Visualize a camera (frustum) in a scene.
Generate 3D clip art from an image vtkTextureMapToPlane
Close a render window vtkRenderWindowInteractor::TerminateApp, vtkRenderWindow::Finalize
Color an Actor vtkActor::GetProperty::SetColor
Color the edges of an Actor vtkActor::GetProperty::SetEdgeColor
Color glyphs vtkGlyph3D vtkGlyph3D::SetColorModeToColorByScalar
Corner annotation vtkCornerAnnotation Write text in the corners of a window.
Correctly Rendering Translucent Geometry vtkDepthSortPolyData
Display three orthogonal axes with labels vtkCubeAxesActor
vtkCursor3D vtkCursor3D
Track a 3D cursor vtkPointWidget
Display coordinate axes vtkOrientationMarkerWidget
Display Text vtkTextActor, vtkTextProperty
A little bit easier rendering vtkRenderView
FlatShading vtkActor::GetProperty::SetInterpolationToFlat
Draw text that stays right side up vtkFollower
Hide an actor vtkPropCollection, vtkProp::VisibilityOff visible
Hide all actors vtkRenderer::RemoveAllViewProps
Level of detail rendering vtkLODProp3D
Label Contours vtkLabeledDataMapper
Label points vtkPointSetToLabelHierarchy, vtkLabelPlacementMapper Display a non-overlapping text label at each point.
Display the point ID at each point vtkLabeledDataMapper
Legend vtkLegendBoxActor
Display the scale of a scene vtkLegendScaleActor
Movable axes vtkFollower, vtkAxesActor, vtkAssembly
Moving an Actor vtkInteractorStyleTrackballActor
Moving the Camera vtkInteractorStyleTrackballCamera
Multiple Actors vtkActor
Named colors vtkNamedColors Demonstrates how to use the vtkNamedColor class
NoShading vtkActor::GetProperty::SetAmbient, vtkActor::GetProperty::SetDiffuse, vtkActor::GetProperty::SetSpecular
Opacity vtkActor::GetProperty::SetOpacity Transparency, transparent.
PointSize vtkActor::GetProperty::SetPointSize
Poly Data Depth Sorting vtkDepthSortPolyData
Automatic level of detail adjustment vtkQuadricLODActor Level of detail adjustment.
Render a large image, larger than a window vtkRenderLargeImage
Rotate an Actor vtkActor::GetMatrix
ScalarBarActor vtkScalarBarActor Display a color bar.
Scale glyphs vtkGlyph3D vtkGlyph3D::SetScaleModeToScaleByScalar
Select a region of a window vtkInteractorStyleRubberBand2D
Stream Lines vtkStreamLine
Display text vtkTextSource
Texture map an ImageData vtkImageCanvasSource2D
Texture map a plane vtkTextureMapToPlane
Texture map a quad vtkPolygon, vtkPolyData::GetPointData::SetTCoords
Transform an Actor vtkActor::SetUserTransform
Transform an actor collection vtkActorCollection
Multiple Actors in a Vector vtkActor
Display high resolution text vtkVectorText
Visualize a 2D Set of Points vtkPolyDataMapper2D, vtkProperty2D
Visualize the points of an ImageData vtkDataSetMapper
Visualize a VTP File vtkXMLPolyDataReader, vtkPolyDataMapper
Change the size of a window vtkRenderWindow:SetSize
Change the title of a window vtkRenderWindow::SetWindowName
Wireframe vtkActor::GetProperty::SetRepresentationToWireframe
Positioning and aiming the camera vtkCamera
Display Quadratic Surfaces vtkQuadric, vtkSampleFunction, vtkContourFilter
Glyph3DMapper vtkGlyph3DMapper
DistanceToCamera vtkDistanceToCamera
Generate a custom glyph at each point vtkProgrammableGlyphFilter
Sample a volume with a curved surface vtkProbeFilter In medical imaging, this is often called curved multi planar reformation
Sample a volume with an isosurface vtkProbeFilter Demonstrates how to create point data on an isosurface.
Accessing the source of an actor reversely vtkActor Demonstrates how to access the source (e.g. vtkSphereSource) of an actor reversely

Volume Rendering

Example Name VTK Classes Demonstrated Description
HAVS vtkHAVSVolumeMapper
Smart volume mapper vtkSmartVolumeMapper
Min intensity rendering vtkFixedPointVolumeRayCastMapper
ITK->VTK conversion Conversion maintaining DICOM orientation and position

User Interaction

Example Name VTK Classes Demonstrated Description
Create, invoke, and handle a custom event Simple observer, emit
Handle events in class member functions Set observers to be class member functions.
Click and drag a vertex of a vtkPolyData vtkPointPicker
Click and drag a vertex of a vtkUnstructuredGrid vtkPointPicker
Give an observer access to an object (via ClientData) vtkCommand
Drag a glyph around vtkGlyph3D
Picking vtkPropPicker Get the world coordinate of the mouse click (if you clicked an actor)
Disallow interaction with a specific actor vtkActor::PickableOff
Assembly vtkAssembly Combine actors into an assembly.
Catch a double click vtkInteractorStyleTrackballCamera
vtkImageClip vtkImageClip Demonstrates how to interactively select and display a region of an image.
Select a region of an image vtkCommand
Terrain mode vtkInteractorStyleTerrain
Handle keypress events vtkInteractorStyleTrackballCamera
Handle keypress events (lightweight) vtkCallbackCommand This uses a callback function rather than a derived interactor class.
InteractorStyleUser vtkInteractorStyleUser Create a completely custom interactor style (no default functionality is provided)
Handle mouse events vtkInteractorStyleTrackballCamera Subclass the interactor style.
Handle mouse events (light weight) vtkCallbackCommand Use an observer.
Get the coordinates of the closest point in the data set to the mouse click vtkPointPicker
RubberBand2D Observer vtkInteractorStyleRubberBand2D
RubberBand2D vtkInteractorStyleRubberBand2D
RubberBand3D vtkInteractorStyleRubberBand3D
RubberBandPick vtkInteractorStyleRubberBandPick
RubberBandZoom vtkInteractorStyleRubberBandZoom
Select an actor vtkPropPicker
Check if shift or control is being held vtkRenderWindowInteractor::GetControlKey() Hold/holding down a key
Choose between multiple interaction modes vtkInteractorStyleSwitch
Trackball actor mode vtkInteractorStyleTrackballActor
Trackball camera mode vtkInteractorStyleTrackballCamera
Get world coordinates of mouse click vtkWorldPointPicker
Cell Picking vtkCellPicker select cell, click cell
Area Picking vtkAreaPicker
Highlight Selected Points vtkExtractGeometry
Highlight selection vtkExtractPolyDataGeometry

Working with Images

Example Name VTK Classes Demonstrated Description
Shift and scale an image vtkImageShiftScale
Copy one image into another image vtkImageStencil, vtkImageToImageStencil
Display layers of images vtkImageStack
Set the size of border pixels vtkImageSliceMapper
Set the interpolation type for the display of an image vtkImageSlice, vtkImageProperty If pixels look blurry instead of sharp when zoomed in, change this.
Draw text in an image vtkFreeTypeUtilities, vtkImageBlend
Convolve a separable kernel with an image vtkImageSeparableConvolution
Median filter an image vtkImageHybridMedian2D
Dilate or erode an image vtkImageDilateErode3D
Open or close (morphologically) an image vtkImageOpenClose3D
Replace every pixel with the range of its neighbors according to a kernel vtkImageRange3D
Convert a vtkImageData to a vtkPolyData vtkImageToPolyDataFilter, vtkImageQuantizeRGBToIndex
Compute the Manhattan distance from every point to every black point in a binary image vtkImageCityBlockDistance
Perform Canny edge detection on an image
Convert a vtkImageData to a vtkStructuredPoints vtkImageToStructuredPoints
Find peaks in an image using non maximum suppression vtkImageNonMaximumSuppression
Make part of an image transparent vtkImageMapToColors, vtkLookupTable Transparency
RTAnalyticSource vtkRTAnalyticSource An image source that can be used for regression testing
Create a Mandelbrot image vtkImageMandelbrotSource
Stretch an image vtkImageMagnify Supersample and stretch an image.
Create a image of a grid vtkImageGridSource
Create a sinusoidal image vtkImageSinusoidSource
2D actor and mapper vtkActor2D vtkMapper2D
Cast an image to a different type vtkImageCast
Extract components of an image vtkImageExtractComponents This can be used to get, for example, the red channel of an image.
Display a greyscale histogram vtkImageAccumulate, vtkBarChartActor
Display an image as the background of a scene vtkImageCanvasSource2D
Display a static image vvtkImageViewer2 This will display the image, but not allow you to interact with it.
Image dot product vtkImageDotProduct Compute the pixel-wise dot product of two vector images.
Drawing on an image vtkImageCanvasSource2D
Drawing shapes in an image vtkImageCanvasSource2D
Mask a region of an image vtkImageMask
Perform mathematical operations on an image vtkImageMathematics
vtkImageMirrorPad vtkImageMirrorPad Pad the edges of an extended image by mirror existing pixels.
Visualize and interact with an image vtkImageActor, vtkInteractorStyleImage
Visualize and interact with an image vtkImageSlice, vtkImageSliceMapper This is the new way to do this. It is much more powerful.
Visualize and interact with an image vtkImageSlice, vtkImageResliceMapper This is even more powerful than vtkImageSliceMapper. It can also do oblique slices.
Negative Indices vtkImageData A very powerful feature of vtkImageData is that you can use negative indices.
Picking a pixel 2 - modified version for exact pixel values vtkPropPicker
Picking a pixel vtkPropPicker
Mark keypoints in an image vtkVectorText, vtkFollower
Visually Compare Two Images vtkImageCheckerboard
Threshold an image vtkImageThreshold

Image Processing

Example Name VTK Classes Demonstrated Description
RescaleAnImage vtkImageShiftScale Rescale an image
vtkImageAccumulate vtkImageAccumulate Histogram
Get the range of image pixel values (min/max) vtkImageData minimum, maximum
Anisotropic diffusion (2D) vtkImageAnisotropicDiffusion2D
Blending 2D images with different color maps vtkImageMapToColors
Center an image vtkImageChangeInformation
Combine two images vtkImageBlend
Combine layers into an RGB image vtkImageAppendComponents
Convert RGB image to greyscale vtkImageMagnitude grayscale
Compute the difference image of two images vtkImageDifference
Convert RGB image to greyscale (luminance) vtkImageLuminance grayscale
Flip an image vtkImageFlip
Image gradient vtkImageGradient Compute the gradient vector at every pixel.
Dilate an image vtkImageContinuousDilate3D
Erode an image vtkImageContinuousErode3D
Convolve an image with a kernel vtkImageConvolve Convolution
Correlate two images vtkImageCorrelation
Divergence of a vector field vtkImageDivergence
Create an image of an ellipsoid vtkImageEllipsoidSource
Compute the FFT of an image vtkImageFFT
Smooth an image vtkImageGaussianSmooth
Compute the magnitude of the gradient at each pixel of an image vtkImageGradientMagnitude
Compute the Laplacian of an image vtkImageLaplacian
Create an image of noise vtkImageNoiseSource
Switch axes of an image vtkImagePermute
Resample an image vtkImageShrink3D
Sobel edge detection 2D vtkImageSobel2D
Variance of a 3D image vtkImageVariance3D Construct a new image consisting of the variance of the input image at each pixel.
Convert RGB to HSV vtkImageRGBToHSV

Widgets

Example Name VTK Classes Demonstrated Description
PointWidget vtkPointWidget
SeedWidgetImage vtkImageViewer2, vtkSeedWidget How to start the interaction?
Interact with a plane vtkPlaneWidget
Apply an affine transformation interactively vtkAffineWidget
vtkPolygonalSurfacePointPlacer vtkPolygonalSurfacePointPlacer Used in conjuntion with vtkContourWidget to draw curves on a surface.
Sphere widget events vtkSphereWidget
Draw movable text vtkTextWidget
Seed widget vtkSeedWidget
Sphere widget vtkSphereWidget
vtkSphereWidget2 vtkSphereWidget2
vtkSplineWidget vtkSplineWidget
vtkBorderWidget vtkBorderWidget 2D selection, 2D box.
vtkBorderWidget vtkBorderWidget 2D selection box in world coordinates.
vtkAngleWidget vtkAngleWidget
vtkAngleWidget + vtkAngleRepresentation2D vtkAngleWidget, vtkAngleRepresentation2D
vtkCaptionWidget vtkCaptionWidget
3D Slider vtkSliderWidget, vtkSliderRepresentation3D
2D Slider vtkSliderWidget, vtkSliderRepresentation2D
Balloon vtkBalloonWidget
Contour Widget vtkContourWidget Create a contour from a set of points and dynamically change the contour using the points as control points.
vtkDistanceWidget vtkDistanceWidget
vtkImplicitPlaneWidget2 vtkImplicitPlaneWidget2 Clip polydata with an implicit plane.
vtkBoxWidget vtkBoxWidget
vtkBoxWidget2 vtkBoxWidget2
vtkLineWidget2 vtkLineWidget2
vtkBiDimensionalWidget vtkBiDimensionalWidget When would you use this?
vtkImagePlaneWidget vtkImagePlaneWidget
vtkImageTracerWidget vtkImageTracerWidget Scribble on an image.
vtkImageTracerWidget vtkImageTracerWidget Highlight pixels inside a non-regular region scribbled on an image.
Draw on a non-planar surface vtkImageTracerWidget
vtkHoverWidget vtkHoverWidget How to detect a hover?
Logo widget vtkLogoWidget
Orientation Marker widget vtkOrientationMarkerWidget Display a polydata as an orientation icon.
Rectilinear Wipe widget vtkImageRectilinearWipe, vtkRectilinearWipeWidget, vtkRectilinearWipeRepresentation Compare two images.
Checkerboard widget vtkCheckerboardWidget, vtkCheckerboardRepresentation Compare two images using a checkerboard.
vtkCursor2D vtkCursor2D
vtkButtonWidget vtkButtonWidget Create a textured 2D button

Plotting

Example Name VTK Classes Demonstrated Description
Line plot vtkChartXY
Scatter plot vtkPlotPoints
Bar chart vtkChartXY
Pie chart vtkChartPie, vtkPlotPie
Parallel coordinates vtkChartParallelCoordinates
Diagram

Animation

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

Geographic Visualization (Geovis)

Example Name VTK Classes Demonstrated Description
Compass Widget vtkCompassWidget
Earth source vtkEarthSource Create the Earth.
Convert lat/long coordinates to world coordinates vtkGeoAssignCoordinates

Information Visualization (Infovis)

Example Name VTK Classes Demonstrated Description
Parallel coordinates vtkParallelCoordinatesView
Tree map vtkTreeMapView

Qt

Click here for a tutorial on how to setup Qt.

Example Name VTK Classes Demonstrated Description
Convert a QImage to a vtkImageData vtkQImageToImageSource
Use the showEvent event to do things that you might want to do in the constructor
Render window without a .ui file QVTKWidget 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 RenderWindowUi)
Render window with a .ui (single inheritance) QMainWindow Using a QVTKWidget with the Qt Single Inheritance model
Render window with a .ui (multiple inheritance) QMainWindow Using a QVTKWidget with the Qt Multiple Inheritance model
Side by side render windows QApplication
vtkQtBarChart vtkQtBarChart
Border Widget vtkBorderWidget, QApplication
Connect a VTK event to a Qt slot vtkEventQtSlotConnect
Convert a vtkImageData to a QImage
Share the camera between QVTKWidgets

Matlab

You must turn on VTK_USE_MATLAB_MEX to use these.

Example Name VTK Classes Demonstrated Description
vtkMatlabEngineFilter vtkMatlabEngineFilter

Databases

SQL

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

Example Name VTK Classes Demonstrated Description
Connect to and read a MySQL database vtkMySQLDatabase, vtkSQLQuery
Create a MySQL database vtkMySQLDatabase
Write to a MySQL database vtkSQLQuery, vtkMySQLDatabase

Broken/Missing Examples (Please write/fix me!)

Some of these are simply shells waiting for a good example. Some of these have a specific problem that is noted. Please help improve them!

Testing Needed

Example Name VTK Classes Demonstrated Description
AVI (Windows only) vtkAVIWriter Someone please test this.
OggTheora vtkOggTheoraWriter Can't find lvtkoggtheora
MPEG2 vtkMPEG2Writer CMake won't find MPEG2 include?
FFMPEG vtkFFMPEGWriter CMake won't find FFMPEG include?
Display a histogram vtkImageAccumulate, vtkBarChartActor Testing images seem to vary slightly on different machines.

Small Problems

Example Name VTK Classes Demonstrated Description
Interact/move the vertices of a graph vtkGraph
Read an mdb Access database file vtkODBCDatabase Error: “Could not execute statement”
Sobel edge detection 3D vtkImageSobel3D
Anisotropic diffusion (3D) vtkImageAnisotropicDiffusion3D Need a suitable input.
Write an ExodusII file vtkExodusIIWriter Write a time varying file. Someone who is familiar with this format should make a reasonable example.
ImageReader2 vtkImageReader2 No errors, but no image is displayed. I think this is a superclass not intended to be used directly?
Stacked plot vtkPlotStacked Image produced is not consistent. Try again after Marcus merges StringToImage topic.
Display a representative object of each class derived from vtkCell3D vtkCell3D HexagonalPrism seems wrong, Polyhedron is empty.
Median filter a 3d or 2d image vtkImageMedian3D Input image is incorrect (totally white)
Remove small patches from an image vtkImageIslandRemoval2D Removes all of the regions.
High pass filter an image vtkImageIdealHighPass Empty output
Low pass filter an image vtkImageIdealLowPass
Inverse FFT vtkImageRFFT Empty output
Delete points vtkPolyData No longer crashes but doesn't seem to do anything. See example Delete cells.
Delete cells vtkPolyData Not sure if this has much utility?
Play/stop/fast forward etc buttons vtkPlaybackWidget Need to show user how to start recording? Playback a recording?
Get world coordinates of mouse click vtkCoordinate When zoomed this does not produce the correct coordinate. vtkWorldPointPicker?
Bend an object vtkWarpTo The tube is squashed, but not bent.
Vary the shape of vertices vtkGraphLayoutView
Vary the width of edges vtkGraphLayoutView
Move a cube into a sphere vtkInteractorStyleTrackballActor
Write an unstructured grid to parallel files vtkXMLPUnstructuredGridWriter Even with SetNumberOfPieces(4), only 2 files are generated?
Convert a vtkTable to a vtkGraph vtkTableToGraph How to specify the columns?
Convert an adjacency matrix to an edge table vtkAdjacencyMatrixToEdgeTable What does the output mean?
Generate a diagonal matrix vtkDiagonalMatrixSource What type is output?
Generate different glyphs based on a table vtkGlyph3D How to specify which values get which glyphs?
Write an image file to parallel files vtkXMLPImageDataWriter Even with SetNumberOfPieces(4), only 2 files are generated?
Combine the points of multiple PolyData datasets vtkAppendPoints The data sets seem to have been combined (there are 10 points and 10 cells in the output), but nothing is displayed -- this is because the points and cells are copied but not the verts. See example vtkAppendPolyData instead (there's already an example for that).
Extract a subgraph vtkExtractSelectedGraph Waiting for dual vtkGraphView
Order cells from a viewing direction vtkKdTree
Merge selections vtkSelection
SpherePuzzle vtkSpherePuzzle Looks like a beach ball... what is the point?
Side By Side Render Windows
vtkImageIterator vtkImageIterator
Extract points based on a criterion function vtkExtractSelectedThresholds
Clip using an implicit data set vtkImplicitDataSet
Get connected cells vtkCellLinks How to use vtkCellLinks::Links class? How to know how many cells GetCells returns?
Convert data from an object into a vtkTable vtkDataObjectToTable How to get the point coordinates into the table?
vtkImageViewer2 vtkImageViewer2 How to start the interaction?
Convert a polydata to an implicit function vtkImplicitDataSet The error is: "Can't evaluate dataset!"
vtkGenericClip vtkGenericClip The input is vtkPolyData, but a vtkGenericDataSet is required.
vtkCameraWidget vtkCameraWidget How to use this?
Compute occupancy of an object on a grid vtkVoxelModeller VTK_BIT is not supported - convert it?
Divide a point cloud into uniform cubic voxels vtkCellLocator We can determine which cell a point is in, but how to determine which points are in a particular cell?
Flight vtkInteractorStyleFlight linux keypresses not handled. I submitted a patch to the devel list - we'll see if they respond.
vtkPointHandleRepresentation2D vtkPointHandleRepresentation2D
RecordEvents vtkInteractorEventRecorder How to exit?
PlayBackEvents vtkInteractorEventRecorder How to slow down?
Quadric Surface Fitting vtkQuadric
LU Factorization vtkMath::LUFactorLinearSystem how do you get the resulting L and U?
Rectangular button source vtkRectangularButtonSource is this the intended usage?
ApplyColors vtkApplyColors How is this different from just adding a Colors array to a vtkDataSet?
vtkSelectionSource vtkSelectionSource The output currently has 50 points when it should only have 10.
vtkPCAAnalysisFilter vtkPCAAnalysisFilter What is the difference between this and vtkPCAStatistics? The eigenvalues vector doesn't seem to be valid. It seems like the eigenvector corresponding to the smallest value is stored as the normal of the cell in the output - how do you get the other two eigen vectors?

Wish List

Example Name VTK Classes Demonstrated Description
Plot data (Legacy method) vtkXYPlotActor The charts examples always seem to render slightly differently.
Display a histogram vtkImageAccumulate, XYPlotActor The charts examples always seem to render slightly differently.
vtkTableBasedClipDataSet vtkTableBasedClipDataSet Empty
vtkLSDynaReader vtkLSDynaReader Empty
vtkCompositeDataGeometryFilter vtkCompositeDataGeometryFilter Empty - combine multiple blocks into a single data set
vtkTryDowncast vtkTryDowncast Empty
vtkCubeAxesActor2D vtkCubeAxesActor2D

Big Problems

Example Name VTK Classes Demonstrated Description
A comparison of some graph layout strategies vtkGraphLayoutView This crashes unless you build against the VTK-SideBySideGraphs branch from here: git@github.com:daviddoria/daviddoria-vtk.git
Export an image to a C array vtkImageExport Shell
Import an image from a C array vtkImageImport Shell
Set a value by manipulating something vtkContinuousValueWidget Can't instantiate this class? But nothing derives from it?
Delete a cell. vtkPolyData I tried this with lines and it doesn't work (crashes). The documentation says only works with polys - so wait for this functionality to be added?
Box intersection vtkBox This class doesn't have any non static functions! Need to create convenience functions.
vtkTensorProbeWidget vtkTensorProbeWidget How is this used?
vtkTensorGlyph vtkTensorGlyph
GeoGlobeSource vtkGeoGlobeSource
GeoView vtkGeoView
FixedPointRayCastImage vtkFixedPointRayCastImage Shell
vtkFrustumCoverageCuller vtkFrustumCoverageCuller Doesn't seem to have a property to specify a frustum? What is it for? How to use it?
vtkKdTreeSelector vtkKdTreeSelector Shell
vtkRungeKutta4 vtkRungeKutta4 Shell
vtkCoincidentPoints vtkCoincidentPoints What is this for?
Threaded/Parallel example Shell
Assign an array to a particular field vtkAssignAttribute Shell
vtkTransposeMatrix vtkTransposeMatrix What is this supposed to operate on? There is no vtkMatrix class.
vtkHyperOctree vtkHyperOctree What does this do?
vtkTextExtraction vtkTextExtraction Shell