Data Structures in the Visualization Toolkit
Stefan Bruckner
∗
Seminar Paper
The Institute of Computer Graphics and Algorithms
Vienna University of Technology, Austria
Abstract
The Visualization Toolkit (VTK) is an open-source toolkit for data
visualization. It is based on a data-flow model and features a rich
library. This paper examines VTK’s visualization model and the
underlying data structures. Practical examples are provided.
Keywords: Visualization Toolkit, VTK, Visualization Networks,
Data structures
1 Introduction
The Visualization Toolkit (VTK) is a widely used package for vari-
ous visualization tasks. It offers an object-oriented API which can
be integrated in many common development environments. Lan-
guage bindings for popular interpreted languages (currently TCL,
Python and Java) allow rapid-prototyping while C++ can be used to
develop high-performance applications.
A main feature of the toolkit is its simple and well-structured
nature which incorporates popular object-oriented design patterns.
Since VTK is open-source it is easy for developers to extend its
functionality and add new components [1].
This paper examines VTK’s object model and gives examples for
taking advantage of it.
In Section 2 VTK’s visualization pipeline is introduced. The dif-
ference between process and data objects is discussed and VTK’s
data structures are examined. Section 3 gives practical examples
for using VTK. The paper is concluded in Section 4.
2 Visualization Model
2.1 Overview
The Visualization Toolkit uses a data-flow approach to transform
information into graphical data. This architecture is commonly re-
ferred to as a visualization network.
A network is essentially a graph that defines the flow of data
through a series of modules that process the data into a picture that
can be viewed on the screen.
At the top of all networks is some kind of data input module
that reads data files into the network. Next may come a series of
filter modules that preprocess the data (e.g., extract a single scalar
element from a vector of data values, crop or thin out the data to a
more manageable size, take a single 2D plane from a 3D volume,
etc.). This is followed by one or more mapper modules that turn the
data into a picture or write data to a file or stream.
Similar to other data-flow based systems, such as AVS [2] and
Data Explorer [3], the VTK visualization model consists of two ba-
sic types of objects: process objects and data objects.
Process objects: Process objects are the algorithmic portions of
the visualization network. They are further characterized as
∗
stefan.bruckner@chello.at
Process A
Dataset A
Process B
Process C
Dataset B
Figure 1: Process and data objects (Data-flow chart)
source objects (e.g., a file containing geometric data), filter
objects (e.g., triangulation of the input data) and mapper ob-
jects (e.g., rendering the triangulated data).
Data objects: Data objects represent the actual data that flow
through the visualization network. The basic data object in
VTK is a dataset which is composed of cells. Cells are topo-
logical organizations of points and form the atoms of the
dataset.
Building a visualization network involves setting up and con-
necting process and data objects. The process objects perform al-
gorithmic operations on data as it flows through the network. The
main advantage of this architecture is its flexibility and the ability
to easily add new algorithms and data representations.
2.2 Process objects
Process objects can be one of three types: sources, filters, and map-
pers. Source objects are found at the beginning of the pipleline.
They generate one or more output datasets. A source object may
be a reader for a particular file type or it may even generate its own
data, such as a sphere source. The output of this source object is
then connected to the input of another process object. The act of
connecting the input of one process object to the output of another
process object is how the pipeline is built (Figure 1). For instance,
to connect the output of filter A to the input of filter B, a construct of
the following form is used: B.SetInput(A.GetOutput());
Each process object has only one output. However, fanning of
the output is allowed since multiple process objects can set their
input to be the output of the same process object. The pipeline ter-
minates with mappers. A mapper ”maps” its input to the screen
(renders it). The mapper itself is one component of an object called
a vtkActor. A vtkActor represents a geometrical object and
its attributes. Other information in a vtkActor includes the ob-
ject’s appearance attributes (vtkProperty), and its location in
space. As a result, the user will instantiate a vtkActor for each
mapper in the VTK pipeline. The user will then set any attributes
of each vtkActor and add each vtkActor to what is called a
vtkRenderWindow. The vtkRenderWindow will then dis-
play all of its actors in a window on the screen.
Building VTK pipelines is simple, but one also needs to under-
stand how a VTK pipeline executes. VTK uses a model that has an
implicit control of execution. Execution only occurs when output is