The Visualization Toolkit



The Visualization Toolkit (VTK) is an open-source software system for image processing, 3D graphics and visualization. VTK includes many advanced algorithms (e.g., surface reconstruction, implicit modeling, decimation) and rendering techniques (e.g., volume rendering, LOD control).

VTK is used by academicians for teaching and research; by government research institutions such as Los Alamos National Lab in the US or CINECA in Italy; and by many commercial firms who use VTK to build or extend products. VTK has grown to a world-wide user base in the commercial, academic and research communities since its initial release in 1994.

This README is written for VTK version 4.2 and greater. For more information, additional resources and the FAQ see the web page at VTK.


The VTK 4.2 source code repository is organized into four major sections. There are hundreds of testing examples located in the Testing/ directory under each source code directory (e.g., Graphics/Testing). These are undocumented tests but can be helpful in some cases.


The ideal way to learn about the software is from two books, The Visualization Toolkit An Object-Oriented Approach To 3D Graphics and The Visualization Toolkit User's Guide, both published by Kitware. The latest on-line Doxygen man pages are also available here.


The Visualization Toolkit can be built on Unix, PC (Windows 95/98/NT/2000/XP) and Mac OSX Jaguar (or greater) systems. VTK uses CMake for its build process. To build VTK for UNIX or Windows, you will first have to download and install CMake. The following instructions assume that CMake is already installed.

Unix Installation

The following instructions only apply to UNIX systems. First we will give you the quick and dirty way to build VTK. Begin by telling CMake what C and C++ compilers you will be using. This can avoid many build problems. On most systems you can pass this information to CMake in the following way:

  env CXX=/your/C++/compiler CC=/your/c/compiler cmake
otherwise you must set the CXX and CC environment variables and then run ccmake (or cmake -i).

If you will be using C++ as your development language (no Tcl/Tk, Python or Java support):

  1) untar the src files into directory vtk-src-unix
  2) untar the data files into directory VTKData
  3) cd vtk-src-unix
  4) cmake -i (run cmake in wizard mode, where you have to answer questions about the build)
     ccmake (run the terminal based interface to cmake where you interactively change build options)
  5) change build options if necessary
  6) make
Note that this will create the binaries (i.e., object code, libraries, and executables) in the same directory as the source code. You can also build VTK out of source in a separate directory (this is particularly convenient when building VTK on multiple architectures). Instead of running CMake from the vtk-src-unix directory, create a new directory with enough disk space (not in the vtk-src-unix tree) such as vtk-solaris. cd into this directory and then run CMake similar to the following example:
  ls /home/foo
    vtk-src-unix VTKData vtk-solaris
  cd vtk-solaris

  ccmake /home/foo/vtk-src-unix
  cmake -i /home/foo/vtk-src-unix
This will create makefiles in the vtk-solaris directory. Then you can run make in vtk-solaris to compile VTK. Repeat this process for each architecture you wish to build.

Note: For your convenience, we have installed VTK on the Unix system in CIS environment. The root directory is /usr/class/graphics/VTK-4.2. The source code and the compilation files (i.e., object code, libraries and executables) are in /usr/class/graphics/VTK-4.2/vtk-src-unix and /usr/class/graphics/VTK-4.2/vtk-solaris respectively. Please note that we assume you will be using C++ as your development language so we only build VTK source code under C++ compiler. If you wanna to use the header files and libraries in VTK, they are located at /usr/class/graphics/VTK-4.2/include/vtk and /usr/class/graphics/VTK-4.2/lib/vtk respectively.

If you want to build the Tcl-based VTK interpreter then you will need to have Tcl and Tk (8.2 or newer). Look to Tcl Developer Xchange for information about getting Tcl and Tk. To turn on Tcl wrapping, set VTK_WRAP_TCL to ON during the configuration process (as a post-build step, you might want to check the /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Tcl/README file). You will then have to set the values for Tcl/Tk include directories and libraries. 

If you want to use VTK from Python you will need to have Python installed. To turn on Python wrapping, set VTK_WRAP_PYTHON to ON during the configuration process and then set the values for the Python related directories and libraries. If you want to use Tkinter with VTK-Python then you should also turn on Tcl wrapping by setting VTK_WRAP_TCL to ON. Make sure that the Tcl/Tk libraries that you set correspond to the same version used by Tkinter. Note that the VTK-Python modules are not installed by default via make install. The /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Python/README.txt file documents the installation procedure and the VTK-Python modules.

Cygwin Installation

The build process for Cygwin is almost exactly the same as the UNIX build process if you will be using C++ as your development language (no Tcl/Tk, Python or Java support):

  1) untar the src files
  2) untar the data files
  3) cd vtk-src-unix
  4) cmake -i (run cmake in wizard mode, where you have to answer questions about the build)
     ccmake (run the terminal based interface to cmake where you interactively change build options)
  5) change build options if necessary
  6) make

PC Installation

The PC build process uses the CMake GUI CMakeSetup. Then you use the compiler make utility to compile as follows:

  1) Install the VTK 4.2 distribution by unzipping into the appropriate directory.

  2) Execute CMakeSetup. This will pop-up a little GUI that allows you to tailor the build. It then starts building 
     .dsw and .dsp files for Microsoft, or makefiles for Borland. You'll have to tell CMakeSetup where you've placed 
     your VTK source code, and where to build the object code and dll's (we'll call it "vtkbin").

  3) When CMakeSetup completes, start up msdev and load VTK.dsw. Select ALL_BUILD project, and build it.
We recommend a 300MByte minimum swap size or you'll have trouble during the link phase.

Common Problems

Getting Data and Test Images

Many of the examples require data. There are two ways to get data. The first is to download from /usr/class/graphics/VTK-4.2/vtk-src-unix/VTKData. The second is to access the data via CVS checkout. The CVS checkout also includes many test images used by the testing process (see here). These can be used if you wish to test VTK or submit testing dashboards.
  1) Download the data from /usr/class/graphics/VTK-4.2/vtk-src-unix/VTKData

  2) Checkout the data from CVS using the folling commands:
     cvs -d login (respond with password vtk)
     cvs -d checkout VTKData

Running VTK

Many C++ examples will be compiled if BUILD_TESTING and/or BUILD_EXAMPLES are enabled in CMake. To run these C++ examples just type their name. (They will be found in the binary build directory.) If you have built shared libraries, make sure the PATH environment variable (Windows) or the LD_LIBRARY_PATH (Unix) point to the shared libraries. If you have enabled Tcl wrapping, you will want to set TCLLIBPATH to point to the VTK/Wrapping/Tcl directory and check the instructions located in the /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Tcl/README file. You will then run the VTK executable found in the bin directory where the code was compiled. Assuming that the executable VTK is in your path, or has been aliased, you would type:
  vtk mace.tcl
Note that most Tcl scripts allow you to type "u" in the render window to obtain an interpreter. You can use the interpreter to modify the application at run-time.

If you have enabled Python Wrapping you should read the instructions located in the /usr/class/graphics/VTK-4.2/vtk-src-unix/Wrapping/Python/README.txt file.

Adding A New Class

There are several ways to extend VTK. The simplest way is, in your own code, create classes that inherit from the appropriate VTK classes. This does not provide the benefit of wrapping the C++ class into Tcl, Java, and Python. If you would like your class to be wrapped into these languages, you will have to add your class to the VTK build. This is the recommended procedure.
  1) Create a new directory called VTK/Local.
  2) Create a file called LocalUserOptions.cmake in VTK/. In that file,add the command SUBDIRS(Local).
     This will add the Local directory to the build.
  3) Create the .cxx and .h file for the new class in VTK/Local. Make sure that you use VTK conventions to
     insure that the wrapping occurs correctly. Complex code may break the wrapper parser; use //BTX and //ETX
     around the  code to fix this.
  4) Create a CMakeLists.txt in VTK/Local. You can model it after a CMakeList.txt file found in another 
     directory (like VTK/IO/CMakeLists.txt).
  5) Rerun ccmake (Unix) or CMakeSetup.exe (Windows).
  6) Then make/gmake (Unix) or msdev (Windows).

Getting Help / Mailing List

If you run into problems, you may either contact me or post your questions to VTK mailing list. Click here to join the list.

Maintained by Chaoli Wang (