Python examples for the Visualization Toolkit (VTK).
- VTK is a powerful high-level 3D graphics and visualization library.
- Widely used for scientific data visualization, 3D graphics, and image processing.
- Provides hundreds of algorithms for various purposes.
- First released in 1993, actively developed and maintained by Kitware Inc.
- Open Source, written in C++, with wrappers for Python, Java, and Tcl.
To install VTK on various platforms (Windows, Linux, macOS), visit the official download page for platform-specific installation guides: https://vtk.org/download/
- Data input and representation: Select the appropriate data structure for your data.
- Data manipulation and processing: Apply filters and algorithms to process the data.
- Visualization and rendering: Use mappers, actors, and renderers to display the data.
- Interaction and exporting: Add user interactivity and export the visualizations as needed.
This repository contains examples and tutorials to help users get started with VTK in Python. Each subdirectory contains a specific topic, along with corresponding code examples.
To run the examples in this repository, follow the steps below:
- Make sure to have a virtual environment set up for your project. You can use
virtualenv
orconda
to create a virtual environment. - Activate the virtual environment and install the necessary packages. For example:
pip install -r requirements.txt
To run an individual example script, navigate to the appropriate folder within the src/
directory and execute the Python script using the command line. For example:
cd src/01_basic_shapes
python circle.py
This will run the circle.py
script, which creates a simple circle using VTK.
If you prefer to use an Integrated Development Environment (IDE) like Visual Studio Code or PyCharm, follow these steps:
- Open the IDE and load the project folder.
- Set up the Python interpreter for the project by selecting the virtual environment you created earlier.
- Open the example script you would like to run.
- Run the script using the IDE's built-in tools (e.g., the "Run" button or right-clicking on the script and selecting "Run").
With the IDE, you can also set breakpoints, step through the code, and debug the example scripts as needed.
Number | Description | Link |
---|---|---|
1 | Demonstrates the steps to create a perfectly round circle | Python |
2 | Describes the process of generating a 3D cone | Python |
3 | Explore how to make a simple cube in 3D space | Python |
4 | Learn to draw a cylinder using vtk | Python |
5 | Get started with glyph production in vtk | Python |
6 | Tutorial on creating a 2D square | Python |
7 | Guides you through the creation of a simple triangle | Python |
Number | Description | Link |
---|---|---|
1 | A detailed example of creating a 3D box that encloses other objects | Python |
2 | Shows how to construct an isosurface in vtk | Python |
3 | Delves into creating scenes with multiple dependent objects | Python |
4 | Explores creating complex scenes with multiple independent objects | Python |
5 | Introduction to the creation of streamlines in vtk | Python |
6 | Teaches you how to use triangulation techniques in vtk | Python |
7 | Explores the world of volume rendering in vtk | Python |
8 | A comparison of different visualization techniques in vtk | Python |
Number | Description | Link |
---|---|---|
1 | Shows you how to manipulate points in vtk | Python |
2 | Dives into the workings of cells within vtk | Python |
3 | An overview of handling fields in vtk | Python |
4 | Detailed example of working with multiblock datasets | Python |
5 | Covers the basics of poly data structures in vtk | Python |
6 | Teaches you how to work with structured grids | Python |
7 | Guides you through the intricacies of unstructured grids | Python |
Number | Description | Link |
---|---|---|
1 | Walkthrough of handling Exodus II files | Python |
2 | Introduction to working with OBJ files in vtk | Python |
3 | Tutorial on interacting with OpenFOAM files | Python |
4 | Learn to read and write STL files with vtk | Python |
5 | Overview of handling VTK file format | Python |
6 | Guides you through the usage of VTM file format | Python |
7 | Explores handling VTU file formats with vtk | Python |
Number | Description | Link |
---|---|---|
1 | Interface for data conversion utilities | Python |
2 | Teaches conversion between STL and OBJ formats | Python |
3 | Learn to convert between STL and VTK formats | Python |
4 | Demonstrates conversion between VTK and OBJ formats | Python |
5 | Shows you how to convert between VTK and VTM formats | Python |
6 | Guides you through the conversion between VTK and VTU formats | Python |
Number | Description | Link |
---|---|---|
1 | Shows handling multiple objects in the actor-mapper setup | Python |
2 | Teaches you how to add text labels in your visualization | Python |
3 | Walks you through creating camera movements | Python |
4 | Shows various filters in action in vtk | Python |
5 | Guides you through creating lighting and shadows in your visualization | Python |
6 | Shows you how to animate your visualization pipeline | Python |
7 | Demonstrates scalar color mapping in vtk | Python |
Number | Description | Link |
---|---|---|
1 | Guides you to use the orientation marker widget | Python |
2 | Learn to create slicing planes in your visualization | Python |
3 | Tutorial on creating and using sliders in your visualization | Python |
Number | Description | Link |
---|---|---|
1 | Learn to create a 3D window with PyQt | Python |
2 | Shows you how to render vtk in matplotlib | Python |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.