{"id":25019632,"url":"https://github.com/djeada/vtk-examples","last_synced_at":"2025-07-03T05:02:14.645Z","repository":{"id":114372387,"uuid":"385703825","full_name":"djeada/Vtk-Examples","owner":"djeada","description":"Explore the world of 3D graphics and visualization with VTK examples in Python.","archived":false,"fork":false,"pushed_at":"2025-05-20T21:17:36.000Z","size":1482,"stargazers_count":44,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-16T01:42:28.599Z","etag":null,"topics":["3d-graphics","case","stl","visualization","vtk"],"latest_commit_sha":null,"homepage":"https://adamdjellouli.com/articles/vtk_examples","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djeada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-13T18:44:43.000Z","updated_at":"2025-06-09T10:02:07.000Z","dependencies_parsed_at":"2024-02-03T19:25:28.277Z","dependency_job_id":"930827d2-2b3c-41b4-97fb-c7bd47a93965","html_url":"https://github.com/djeada/Vtk-Examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/djeada/Vtk-Examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FVtk-Examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FVtk-Examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FVtk-Examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FVtk-Examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djeada","download_url":"https://codeload.github.com/djeada/Vtk-Examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djeada%2FVtk-Examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263264642,"owners_count":23439247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-graphics","case","stl","visualization","vtk"],"created_at":"2025-02-05T11:51:16.191Z","updated_at":"2025-07-03T05:02:14.616Z","avatar_url":"https://github.com/djeada.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VTK - Visualization Toolkit Python Examples\n\nExplore the world of 3D graphics and visualization with VTK examples in Python.\n\n![Screenshot from 2024-02-10 21-38-23](https://github.com/djeada/VTK-Examples/assets/37275728/d843d55f-ab7a-4830-a762-34cc71041fdc)\n\n## Demo\nTo watch the Short, just click on the thumbnail. That will open the YouTube Shorts player so you can view the video instantly. Enjoy!\n\n[![Watch the Short on YouTube](https://img.youtube.com/vi/Qgoh9NbNqdc/maxresdefault.jpg)](https://youtube.com/shorts/Qgoh9NbNqdc?feature=share)\n\n[![Watch the Short on YouTube](https://img.youtube.com/vi/0jAN9Q-GGCk/maxresdefault.jpg)](https://youtube.com/shorts/0jAN9Q-GGCk?feature=share)\n\n## Overview\n\nThe Visualization Toolkit, or VTK, is a cornerstone in the field of 3D graphics and scientific visualization:\n\n- **What is VTK?**\n  - VTK is an advanced 3D graphics and visualization software library that has been empowering scientific and data visualization, 3D graphics, and image processing.\n\n- **The Toolkit's Features:**\n  - It offers an extensive collection of algorithms, providing hundreds of tools tailored for various visualization needs.\n\n- **Development and Maintenance:**\n  - Since 1993, Kitware Inc. has been the driving force behind VTK, ensuring continuous development and maintenance.\n\n- **Open-Source and Cross-Language:**\n  - Being open-source, VTK invites collaboration and expansion. While it's primarily written in C++, it also offers Python, Java, and Tcl bindings.\n\n## Getting Started with VTK\n\n### Installation Guide\n\nFor getting VTK up and running on your system:\n\n- **Platform-Specific Instructions:**\n  - Visit the [official VTK download page](https://vtk.org/download/) for detailed installation guides on Windows, Linux, and macOS.\n\n### Basic Workflow in VTK\n\nTo harness the power of VTK effectively, follow this basic workflow:\n\n1. **Data Input and Representation:** Your first step involves choosing the appropriate data structure for your dataset.\n\n2. **Data Manipulation and Processing:** Next, apply a variety of filters and algorithms to manipulate and process the data as needed.\n\n3. **Visualization and Rendering:** For the visual representation of data, make use of mappers, actors, and renderers.\n\n4. **Interaction and Exporting:** Lastly, incorporate interactive elements into your visualization and utilize export functionalities as required.\n\n## Running the Examples\n\n### Setting Up Your Environment\n\nTo begin with your project, it's important to set up your environment properly. Here's how:\n\n1. **Creating a Virtual Environment:** Use `virtualenv` or `conda` for isolating your project dependencies. This helps in managing packages specific to this project without affecting others.\n\n2. **Activating and Installing Dependencies:** Once the virtual environment is created, activate it. Then, install all the required packages using the following command:\n\n```\npip install -r requirements.txt\n```\n\n### Executing Scripts\n\nRunning the scripts is straightforward. Just follow these steps:\n\n- Navigate to the script's directory within the `src/` folder. For example, if you're looking to run a script about basic shapes:\n\n```\ncd src/01_basic_shapes\npython circle.py\n```\n\n- The above command will execute the `circle.py` script, which demonstrates creating a simple circle using VTK.\n\n### Using an Integrated Development Environment (IDE)\n\nIf you prefer using an IDE like Visual Studio Code or PyCharm, here's what you need to do:\n\n1. **Project Setup:** Open your chosen IDE and load the project folder. This will make all your project files accessible in one place.\n\n2. **Interpreter Configuration:** Configure the Python interpreter in your IDE to point to the virtual environment you created earlier. This ensures that your IDE uses the correct Python version and dependencies.\n\n3. **Running Scripts:** Select the script you want to run. Use your IDE's tools (often a \"Run\" button) to execute the script.\n\n4. **Debugging:** Leverage your IDE's debugging features like breakpoints and step-through debugging to analyze your scripts more closely.\n\n## Basic Shapes\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Demonstrates the steps to create a perfectly round circle | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/circle.py) |\n| 2 | Describes the process of generating a 3D cone | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/cone.py) |\n| 3 | Explore how to make a simple cube in 3D space | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/cube.py) |\n| 4 | Learn to draw a cylinder using vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/cylinder.py) |\n| 5 | Get started with glyph production in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/glyph.py) |\n| 6 | Tutorial on creating a 2D square | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/square.py) |\n| 7 | Guides you through the creation of a simple triangle | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/01_basic_shapes/triangle.py) |\n\n## Advanced Shapes\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | A detailed example of creating a 3D box that encloses other objects | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/enclosing_box.py) |\n| 2 | Shows how to construct an isosurface in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/isosurface.py) |\n| 3 | Delves into creating scenes with multiple dependent objects | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/multiple_dependent_objects.py) |\n| 4 | Explores creating complex scenes with multiple independent objects | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/multiple_independent_objects.py) |\n| 5 | Introduction to the creation of streamlines in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/streamlines.py) |\n| 6 | Teaches you how to use triangulation techniques in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/triangulation.py) |\n| 7 | Explores the world of volume rendering in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/volume_rendering.py) |\n| 8 | A comparison of different visualization techniques in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/visualization_techniques_comparison.py) |\n| 9 | Demonstrates how to visualize flow simulation data | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/02_advanced_shapes/flow_simulation_visualization.py) |\n\n## Structures and Datasets\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Shows you how to manipulate points in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/points.py) |\n| 2 | Dives into the workings of cells within vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/cells.py) |\n| 3 | An overview of handling fields in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/fields.py) |\n| 4 | Detailed example of working with multiblock datasets | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/multiblock_dataset.py) |\n| 5 | Covers the basics of poly data structures in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/poly_data.py) |\n| 6 | Teaches you how to work with structured grids | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/structured_grid.py) |\n| 7 | Guides you through the intricacies of unstructured grids | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/unstructured_grid.py) |\n| 8 | Introduction to structured mesh concepts in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/structured_mesh.py) |\n| 9 | Explores the creation and manipulation of unstructured meshes | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/03_structures_and_datasets/unstructured_mesh.py) |\n\n## Input and Output\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Introduction to working with OBJ files in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_obj.py) |\n| 2 | Learn to read and write STL files with vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_stl.py) |\n| 3 | Overview of handling VTK file format | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_vtk.py) |\n| 4 | Guides you through the usage of VTM file format | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_vtm.py) |\n| 5 | Explores handling VTU file formats with vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_vtu.py) |\n| 6 | Walkthrough of handling Exodus II files | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_exodus_ii.py) |\n| 7 | Tutorial on interacting with OpenFOAM files | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/04_input_output/io_openfoam.py) |\n\n## Data Conversion\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Interface for data conversion utilities | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/05_data_conversion/converter_interface.py) |\n| 2 | Learn to convert between STL and VTK formats | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/05_data_conversion/stl_vtk.py) |\n| 3 | Demonstrates conversion between VTK and OBJ formats | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/05_data_conversion/vtk_obj.py) |\n| 4 | Teaches conversion between STL and OBJ formats | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/05_data_conversion/stl_obj.py) |\n| 5 | Shows you how to convert between VTK and VTM formats | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/05_data_conversion/vtk_vtm.py) |\n| 6 | Guides you through the conversion between VTK and VTU formats | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/05_data_conversion/vtk_vtu.py) |\n## Visualization Pipeline\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Shows handling multiple objects in the actor-mapper setup | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/actor_mapper_multiple_objects.py) |\n| 2 | Teaches you how to add text labels in your visualization | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/adding_text_labels.py) |\n| 3 | Demonstrates scalar color mapping in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/scalar_color_mapping.py) |\n| 4 | Walks you through creating camera movements | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/camera_movement.py) |\n| 5 | Shows various filters in action in vtk | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/filters_in_action.py) |\n| 6 | Guides you through creating lighting and shadows in your visualization | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/lighting_and_shadows.py) |\n| 7 | Shows you how to animate your visualization pipeline | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/06_visualization_pipeline/pipeline_animation.py) |\n\n## Interactive Widgets\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Guides you to use the orientation marker widget | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/07_interactive_widgets/orientation_marker.py) |\n| 2 | Tutorial on creating and using sliders in your visualization | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/07_interactive_widgets/slider.py) |\n| 3 | Learn how to interact with simple buttons in your visualization | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/07_interactive_widgets/simple_button.py) |\n| 4 | Demonstrates creating interactive planes intersection | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/07_interactive_widgets/planes_intersection.py) |\n\n## Integrations with External Tools\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | Learn to integrate VTK with Qt to create a 3D sphere visualization | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/08_integration_with_ui/qt_sphere.py) |\n| 2 | Demonstrates the use of Matplotlib for creating a 3D sphere using VTK | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/08_integration_with_ui/matplotlib_sphere.py) |\n| 3 | Shows how to create surface plots using VTK and Matplotlib | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/08_integration_with_ui/matplotlib_surface_plot.py) |\n\n## Computational Fluid Dynamics (CFD)\n\n| Number | Description | Link |\n| --- | --- | --- |\n| 1 | 1D heat convection problems | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/heat_convection_solver_1d.py) |\n| 2 | 1D fixed end heat transfer | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/fixed_end_heat_transfer_1d.py) |\n| 3 | 1D convective end heat transfer | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/convective_end_heat_transfer_1d.py) |\n| 4 | 1D enhanced heat transfer | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/enhanced_heat_transfer_solver_1d.py) |\n| 5 | 2D heat conduction problems | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/heat_conduction_solver_2d.py) |\n| 6 | 2D enhanced heat transfer | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/enhanced_heat_transfer_solver_2d.py) |\n| 7 | Simple fluid flow | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/fluid_flow_simulator.py) |\n| 8 | Fluid flow around an obstacle | [Python](https://github.com/djeada/VTK-Examples/blob/main/src/09_cfd/obstacle_flow_simulation.py) |\n\n## References\n\n* [PyScience: VTK](https://pyscience.wordpress.com/tag/vtk/)\n* [Program Creek: VTK](https://www.programcreek.com/python/index/480/vtk)\n* [Visualization Course 2014](https://www.cb.uu.se/~aht/Vis2014/)\n* [Data Visualization Course, SJTU](https://www.cs.sjtu.edu.cn/~shengbin/course/datavis/)\n\n## How to Contribute\n\nWe encourage contributions that enhance the repository's value. To contribute:\n\n1. Fork the repository.\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`).\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).\n4. Push to the branch (`git push origin feature/AmazingFeature`).\n5. Open a Pull Request.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE) - see the LICENSE file for details.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=djeada/Vtk-Examples\u0026type=Date)](https://star-history.com/#djeada/Vtk-Examples\u0026Date)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjeada%2Fvtk-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjeada%2Fvtk-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjeada%2Fvtk-examples/lists"}