Isosurface Generation Using VTK







1. Introduction


The hardest part about using VTK is figuring out what filters to use and what they do.  It takes some adjusting to program for a pipeline, but just like with most anything else; you will wonder why you made all that fuss in the first place.


The purpose of this tutorial is the following:

  • Learn VTK pipeline basics
  • Learn about some VTK filters for use with isosurface generation
  • Learn to program VTK using Python and Tkinter


Python is a wonderful language because it is interpreted which means that when you use the command line interpreter, each command is executed when you press the enter key.  This tutorial will utilize this functionality of Python so that you can see what is happening when different VTK filters are tried.  If you are looking to download a version of Python, you can visit or, which has a nice Python IDE for Windows PCs.  The basic Python installation from has a basic text editor named IDLE that has syntax highlighting and some other nice features.


The GUI toolkit that will be used with Python and VTK is named Tkinter.  Tkinter comes with the Python installation and is an acceptable choice if you are not doing anything too complicated.  However, when a toolkit does not even have support for a simple listbox with scrollbars, it would seem that better GUI toolkits are available.  The author recommends using wxWindows which can be downloaded from  Here you can download a cross-platform GUI (Windows, Linux, Mac) that is supported by VTK.  The only difficulty is that if you are using the CD from the book The Visualization Toolkit, it will not have the most recent version of Python that supports wxPython.  For this reason, if you choose to use wxPython, you will have to compile VTK from source using CMake, which can be annoying if you are not experienced with compiling more complex projects.  However, by taking time to do this, you will be able to revel in the functionality and beauty of a modern GUI toolkit instead of a limited Tk GUI descendent.


If you are a big fan of Java and you are disappointed by the fact that this VTK isosurface tutorial uses Python, you may still be in luck.  It is possible to have the power of Java and Python rolled into one package...namely Jython.  Python is built on top of C/C++.  Jython is a Java implementation of Python.  This gives you the flexibility of Python with the power of Java, which would also mean that you would have the Swing UI at your disposal.  The author is not really experienced with Jython, but the installation is fairly straightforward if you already have Java installed.  To download Jython, you can visit


As you progress through this tutorial, try to draw flowcharts (or if you do not like that word, diagrams with arrows) that illustrate how data is flowing through the pipeline(s) that you create.  Since parts of your pipeline might change a lot, you might want to have some index cards with the VTK classes on them (and on back maybe a list of some important functions and what they do) that would allow you to avoid drawing stuff but still allow you to have some sort of graphical representation of the pipeline.


Before continuing with this tutorial, please make sure that you have the following software packages properly configured:

  • VTK has a directory in your Python installation
  • Your Python interpreter is functional
  • Any other VTK DLLs (if you are using Windows) are in the correct locations


If you are viewing this tutorial with an Internet connection, do not hesitate to take advantage of the additional hyperlinked material.  Links that are local to this tutorial will appear as standard hyperlinks which are underlined and typically colored blue.  If there are links that are only available on the Internet, they will be boldfaced in addition to underlined.



<<< Previous

Table of Contents



Table of Contents



Next >>>

Using Python and Tkinter