CSharp Examples¶
Info
This table shows the VTK classes covered by the examples.
Info
This table shows VTK classes that do not have an example. Please add examples in your area of expertise!
| Example Name | Classes Demonstrated | Description | Image |
|---|
Simple Operations¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| DistanceBetweenPoints | vtkMath | Computes the distance between two point Distance between two points | |
| DistancePointToLine | vtkLine | Distance between a point and a line | |
| GaussianRandomNumber | vtkMath | Generates Gaussian random number Random number (Gaussian distribution) | |
| PerspectiveTransform | vtkPerspectiveTransform | Apply a perspective transformation to a point | |
| ProjectPointPlane | vtkPlane | Project a point onto a plan Project a point onto a plane | |
| RandomSequence | vtkMinimalStandardRandomSequence | This is the preferred way to generate random numbers Random sequence | |
| UniformRandomNumber | vtkMath | Generates uniform random number Random number (uniform distribution) |
Input and Output¶
Graph Formats¶
3D File Formats¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| ConvertFile | Convert a file from one type to another | ||
| XGMLReader | vtkXGMLReader | Read a .gml file |
Standard Formats¶
Input¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| DEMReader | vtkDEMReader | Read DEM (elevation map) files | |
| ReadDICOMSeries | vtkDICOMImageReader | This example demonstates how to read a series of DICOM images and scroll through slice Convert a series of DICOM files into a VTI File | |
| ReadPDB | vtkPDBReader | Read Protein Data Bank Files Read Protein Data Bank files (.pdb) files | |
| ReadPLOT3D | vtkPLOT3DReader | Read CFD (computational fluid dynamics) data produced by PLOT3D Read PLOT3D (.bin) files | |
| ReadPLY | vtkPLYReader | Read PLY (.ply) files | |
| ReadSTL | vtkSTLReader | Read stereo lithography STL (.stl) files | |
| SimplePointsReader | vtkSimplePointsReader | Read a simple "xyz" file of points | |
| VRML | vtkVRMLImporter | Read a VRML (WRL) file |
VTK Formats¶
Input¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| ReadImageData | vtkXMLImageDataReader | Read a image data (.vti) file | |
| ReadPolyData | vtkXMLPolyDataReader | Read a polygonal data (.vtp) file | |
| ReadRectilinearGrid | vtkXMLRectilinearGridReader | Read a rectilinear grid (.vtr) file | |
| ReadStructuredGrid | vtkXMLStructuredGridReader | Read a structured grid (.vts) file | |
| ReadUnknownTypeXMLFile | vtkXMLGenericDataObjectReader | Read an XML file and later decide what kind it is | |
| ReadUnstructuredGrid | vtkXMLUnstructuredGridReader | Demonstrates how to read a .vtu fil Read an unstructured grid (.vtu) file | |
Output¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| WriteVTI | vtkXMLImageDataWriter | VTI is an "ImageData" Write a .vti file | |
| WriteVTP | vtkXMLPolyDataWriter | VTP is a "PolyData". This format allows for the most complex geometric objects to be stored Write a .vtp file | |
| WriteVTU | vtkXMLUnstructuredGridWriter | VTU is an "Unstructured Grid". This format allows for 3D data to be stored Write a .vtu file | |
| XMLStructuredGridWriter | vtkXMLStructuredGridWriter | Write a .vts file from a vtkStructuredGrid |
Image Formats¶
Input¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| ImageReader2Factory | vtkImageReader2Factory | This class tries to find an appropriate reader. It is very convenient to use this when you don't know what kind of file to expect Read most standard image formats. | |
| JPEGReader | vtkJPEGReader | Read a JPG image | |
| MetaImageReader | vtkMetaImageReader | Read .mha files | |
| PNGReader | vtkPNGReader | Read a PNG image | |
| ReadBMP | vtkBMPReader | Read BMP (.bmp) files | |
| ReadPNM | vtkPNMReader | Read PNM (.pnm) files | |
| ReadTIFF | vtkTIFFReader | Read TIFF (.tif) files |
Output¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| JPEGWriter | vtkJPEGWriter | Write a JPEG (.jpg) file | |
| MetaImageWriter | vtkMetaImageWriter | Write a .mha/.mhd + .raw file | |
| WriteBMP | vtkBMPWriter | Write a BMP (.bmp) file | |
| WritePNG | vtkPNGWriter | Write a PNG (.png) file | |
| WritePNM | vtkPNMWriter | Write a PNM (.pnm) file | |
| WriteTIFF | vtkTIFFWriter | Write a TIFF (.tif) file | |
Geometric Objects¶
Parametric Objects¶
These examples demonstrate how to create an display one of the many vtkParametric* objects. All of the classes listed can be used in an identical fashion.
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| ParametricObjects | vtkParametricBoy, vtkParametricConicSpiral, vtkParametricCrossCap, vtkParametricDini, vtkParametricEllipsoid, vtkParametricEnneper, vtkParametricFigure8Klein, vtkParametricKlein, vtkParametricMobius, vtkParametricRandomHills, vtkParametricRoman, vtkParametricSpline, vtkParametricSuperEllipsoid, vtkParametricSuperToroid, vtkParametricTorus | Create and display a parametric object | |
| ParametricObjectsDemo | Demonstration of all of the vtkParametric* classes |
Implicit Functions and Iso-surfaces¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| BandedPolyDataContourFilter | vtkBandedPolyDataContourFilter | BandedPolyDataContourFilter | |
| ExtractLargestIsosurface | vtkPolyDataConnectivityFilter | Extract largest isosurface | |
| FilledContours | vtkContourFilter | Create filled contours vtkClipPolyData) | |
| ImplicitSphere | vtkSphere | An implicit representation of a sphere | |
| IsoContours | vtkContourFunction | Visualize different isocontours using a slider | |
| MarchingCubes | vtkMarchingCubes | Create a voxelized spher Marching cubes | |
| MarchingSquares | vtkMarchingSquares | Create a contour from a structured point set (image Marching squares | |
| SampleFunction | vtkSampleFunction | Sample and visualize an implicit function |
Working with 3D Data¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| AlignFrames | vtkLandmarkTransform | Align coordinate frames | |
| ContoursFromPolyData | vtkCutter | Create contours from PolyData | |
| FindAllArrayNames | vtkPolyData | Get the names of all of the data arrays | |
| ImplicitBoolean | vtkImplicitBoolean | Operations include intersection and union. | |
| IterateOverLines | vtkCellArray | Iterate through the lines of a PolyData | |
| MultiBlockMergeFilter | vtkMultiBlockMergeFilter, vtkMultiBlockDataSet | Combine MultiBlockDataSets | |
| NullPoint | vtkPointData | Set everything in PointData at a specified index to NUL NullPoint | |
| PolyDataGetPoint | vtkPolyData | Get point locations/coordinates from a vtkPolyData | |
| ShrinkPolyData | vtkShrinkPolyData | Move all items in a PolyData towards their centroid | |
| VectorFieldNonZeroExtraction | vtkExtractSelectedThresholds | This example shows how to create an imagedata object, associate scalar data with some points and visualize only nonzero scalar value Extract non-zero vectors from a vtkImageData | |
| WarpVector | vtkWarpVector | vtkWarpVector | |
Working with Meshes¶
| Example Name | Classes Demonstrated | Description | Image |
|---|---|---|---|
| BoundaryEdges | vtkFeatureEdges | Find the edges that are used by only one face Finding Boundary Edges | |
| CapClip | vtkClipPolyData | Cap a clipped polydata with a polygon | |
| CellEdges | vtkCell | Get edges of cells | |
| ClosedSurface | vtkFeatureEdges | Check if a surface is closed | |
| ColorDisconnectedRegions | vtkPolyDataConnectivityFilter | Color each disconnected region of a vtkPolyData a different color | |
| ColoredElevationMap | vtkLookupTable | Colormap, color ma Color a mesh by height | |
| Curvature | vtkCurvatures | Compute Gaussian, Mean, Min, and Max Curvatures | |
| Decimate | vtkDecimatePro | Reduce the number of triangles in a mesh Decimation | |
| DijkstraGraphGeodesicPath | vtkDijkstraGraphGeodesicPath | Find the shortest path between two points on a mesh | |
| ElevationFilter | vtkElevationFilter | Color a mesh by height | |
| ExtractEdges | vtkExtractEdges | Extract Edges | |
| FillHoles | vtkFillHolesFilter | Close holes in a mesh Fill Holes | |
| GreedyTerrainDecimation | vtkGreedyTerrainDecimation | Create a mesh from an ImageData | |
| HighlightBadCells | vtkMeshQuality | Highlight Bad Cells | |
| LargestRegion | vtkPolyDataConnectivityFilter | Extract the largest connected region in a polydata | |
| MatrixMathFilter | vtkMatrixMathFilter | Compute various quantities on cell and points in a mesh Matrix math filter | |
| OBBDicer | vtkOBBDicer | Breakup a mesh into pieces OBBDicer | |
| PolygonalSurfaceContourLineInterpolator | vtkPolygonalSurfaceContourLineInterpolator | Interactively find the shortest path between two points on a mesh | |
| QuadricClustering | vtkQuadricClustering | Reduce the number of triangles in a mesh Decimation (quadric clustering) | |
| QuadricDecimation | vtkQuadricDecimation | Reduce the number of triangles in a mesh Decimation (quadric decimation) | |
| SelectPolyData | vtkSelectPolyData | Select a region of a mesh | |
| SimpleElevationFilter | vtkSimpleElevationFilter | Color a mesh by dotting a vector from the origin to each point with a specified vector | |
| SolidClip | vtkClipPolyData | Create a "solid" clip | |
| SpecifiedRegion | vtkPolyDataConnectivityFilter | Extract a specific (specified) connected region in a polydata | |
| Subdivision | vtkButterflySubdivisionFilter, vtkLoopSubdivisionFilter, vtkLinearSubdivisionFilter | Increase the number of triangles in a mesh Subdivision | |
| Triangulate | vtkTriangleFilter | Convert all polygons in a mesh to triangles Triangulate a mesh | |
| WeightedTransformFilter | vtkWeightedTransformFilter | vtkWeightedTransformFilter | |
| WindowedSincPolyDataFilter | vtkWindowedSincPolyDataFilter | Smooth a mesh. |
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: [http://vtk.org/Wiki/VTK/Tutorials/3DDataTypes]. Image data can represent at typical 2D image, but also, a 3D volume.