VTK/Examples/Python
From KitwarePublic
It would be appreciated if there are any Python VTK experts who could convert any of the c++ examples to Python!
Simple Operations
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Distance between two points | vtkMath::Distance2BetweenPoints | |
| Random numbers | n/a | Random numbers can be generated with Python's random module |
Input and Output
Output
Input
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Using STLReader to read an STL file | vtkSTLReader | |
| Using vtkVTPReader to read a VTP file | vtkXMLPolyDataReader | |
| UnstructuredGridReader.py | vtkUnstructuredGridReader |
Using vtkUnstructuredGridReader to read a (legacy) *.vtk file |
| Using vtkFLUENTReader to read a Fluent case file | vtkFLUENTReader |
Using vtkFLUENTReader to read a Fluent case file and extract the unstructured grid. |
Working with Arrays
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Get a value from an array | GetTuple3 | |
| Rename an array | SetName |
Geometric Objects
Parametric Objects
Display
Working with PolyData
Miscellaneous
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Screenshot | vtkWindowToImageFilter | |
| check VTK version | vtkVersion | |
| vtkCutter | vtkCutter | |
| vtkImplicitDataSet | vtkImplicitDataSet | Clip one data set with another |
| vtkIdType | n/a | This is just a typedef, so in Python, you can use a python "int" or "long" for vtkIdType. |
| Using Numpy | n/a | |
| vtkVariant | vtkVariant |
Visualization
Working with vtkImageData
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Summing images | vtkImageWeightedSum |
Graphs
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Create and visualize a graph | vtkMutableDirectedGraph, vtkGraphLayoutView | |
| Add edge weights to a graph | vtkMutableDirectedGraph, vtkGraphLayoutView | |
| Get a list of the selected vertices and edges | vtkAnnotationLink, vtkGraphLayoutView |
User Interaction
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Handle mouse events | vtkInteractorStyleTrackballCamera | Subclass the interactor style. |
| Handle mouse events (light weight) | vtkCallbackCommand | Use an observer. |
Infovis
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| View Selected Graph IDs | vtkRandomGraphSource, vtkGraphLayoutView | Callback on vtkAnnotationLink in a Graph Layout View when selection is changed |
| Parallel Coordinates View | vtkParallelCoordinatesView | Plotting data attributes in a Parallel Coordinates View |
| Parallel Coordinates Extraction | vtkExtractSelection | Extract data based on a selection in a Parallel Coordinates View |
Geovis
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| vtkGeoAssignCoordinates | vtkGeoAssignCoordinates |
Widgets
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| Balloon Widget | vtkBaloonWidget | |
| Annotated cube with vtkOrientationWidget | vtkAnnotatedCubeActor vtkOrientationWidget | |
| vtkCompassWidget | vtkCompassWidget | |
| Contour widget | vtkCotourWidget | |
| TextWidget | vtkTextWidget | Annotate a VTK image with movable text |
| ScalarBarWidget | vtkScalarBarWidget | The ScalarBarWidget displays a scalar bar that is movable and changes orienation automatically when close to the borders of the image. It needs a ScalarBarActor |
Utilities
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| vtkDelaunay2D | vtkDelaunay2D |
Broken/Missing Examples
Broken/Missing Python Functionality
| Example Name | VTK Classes Demonstrated | Description |
|---|---|---|
| vtkFrustumSource not available in Python ?? | ||
| PointInPolygon not available in Python ? | ||
| method FindClosestPoint (and others) of vtkCellLocator not available in Python |