VTK Python Tutorial Series: What is VTK?

An image of a CT scan.

A brief introduction to VTK, a library to create 3D visualisations. This is the first post in a series on the VTK toolkit.

This post is the first in a series on the VTK toolkit. It will provide an overview of VTK and all of the skills and ideas necessary to start using the toolkit to create beautiful, sophisticated scientific visualisations. This includes:

We also include examples along the way (here and here), with a summary of important commands here.

This series assumes a very basic working knowledge of the Python programming language. For those new to Python there are many great books on the language. Introducing Python[1] from O’Reilly is a great place to start.

Full code listings for the examples presented below are available from Github.[2]

The VTK[3] toolkit is a 3D graphics library that allows the developer to create advanced visualisations of scientific data. There are other plotting libraries for Python of which matplotlib is the most popular. VTK is a different, more powerful framework. It provides a 3D graphics system that can render 3D scalar, vector, and higher order tensor field data. It accepts and can manipulate data in various structures and formats.

This added power comes at the price of a more challenging learning curve. To a significant degree this is the result of poor documentation and tutorials rather than the library itself. This tutorial helps to address this. It will guide you through the foundational ideas necessary to understand how VTK reads data, how to process it, and how to create interactive 3D graphical representations of that data.

Important commands will be described throughout this tutorial and summarised in this article.

To provide your feedback—​including on errors, typos, or anything else—​visit the Compilatrix website for more information and its contact form[4] to provide feedback.

Continue here for instructions on how to setup VTK with Python and an overview to get started with the library.


1. Disclaimer: Commissions earned on affiliate links.
3. Visualization Toolkit (VTK)