Visualizing with VTK: A Tutorial
n this tutorial we introduce basic concepts behind the Visualization Toolkit (VTK). An overview of the system, plus some detailed examples, will assist you in learning this system. The tutorial targets researchers of any discipline who have 2D or 3D data and want more control over the visualization process than a turn-key system can provide. It alsoassists developers who would like to incorporate VTK into an application as a visualization or data processing engine. Although this tutorial can only provide an introduction to this extensive toolkit, we’ve provided references to additional material.
William J. Schroeder, Lisa S. Avila, and William Hoffman Kitware
What is VTK?
VTK1 is an open-source (see the sidebar “Open SourceBreakout”), portable (WinTel/Unix), object-oriented software system for 3D computer graphics, visualization, and image processing. Implemented in C++, VTK also supports Tcl, Python, and Java language bindings, permitting complex applications, rapid application prototyping, and simple scripts. Although VTK doesn’t provide any user interface components, it can be integrated with existing widget sets suchas Tk or X/Motif. VTK provides a variety of data representations including unorganized point sets, polygonal data, images, volumes, and structured, rectilinear, and unstructured grids. VTK comes with readers/importers and writers/exporters to exchange data with other applications. Hundreds of data processing ﬁlters are available to operate on these data, ranging from image convolution to Delaunaytriangulation. VTK’s rendering model supports 2D, polygonal, volumetric, and texture-based approaches that can be used in any combination. VTK is one of several visualization systems available today. AVS2 was one of the first commercial systems available. IBM’s Data Explorer (DX),3 originally a commercial product, is now open source and known as OpenDX. NAG Explorer4 and Template Graphics Amira(see http://www.tgs.com/Amira/index.html) are other well-known commercial systems. VTK is a general-purpose system used in a variety of applications, as seen in Figure 1. Because VTK is open source, faculty at many universities—including Rens-
selaer Polytechnic Institute, State University of New York at Stony Brook, the Ohio State University, Stanford, and Brigham and Women’s Hospital use VTK toteach courses and as a research tool. National labs such as Los Alamos are adapting VTK to large-scale parallel processing. Commercial ﬁrms are building proprietary applications on top of the open-source foundation, including medical visualization, volume visualization, oil exploration, acoustics, ﬂuid mechanics, ﬁnite element analysis, and surface reconstruction from laser-digitized, unorganizedpoint-clouds. VTK began in December 1993 as companion software to the text The Visualization Toolkit: An Object-Oriented Approach to 3D Graphics by Will Schroeder, Ken Martin, and Bill Lorensen (Prentice Hall). In 1998 the second edition of the text appeared, with additional authors Lisa Avila, Rick Avila, and Charles Law. Since that time a sizable community has grown up around the software,including dozens of others as developers, often submitting bug fixes or full-blown class implementations. These community efforts have helped the software evolve. For example, David Gobbi in the Imaging Research Laboratories at the John P. Robarts Research Institute, University of Western Ontario, has reworked VTK’s transformation classes and is now an active developer.
VTK consistsof two major pieces: a compiled core (implemented in C++) and an automatically generated interpreted layer. The interpreted layer currently supports Tcl, Java, and Python.
Data structures, algorithms, and time-critical system functions are implemented in the C++ core. Common design patterns such as object factories and virtual functions insure portability and extensibility. Since VTK...