Introduction
This chapter describes the Visualization Toolkit (VTK) data format. This data format is used by the VTK visualization toolkit developed by Kitware. VTK is a software system for 3D computer graphics, image processing and visualization. The VTK data format is the primary data structure used internally in Geocap, and as such is a basic component of more complex data structures such as those found in the petroleum or GIS industry. The VTK format combines a powerful data representation with a structure well suited to visualization.
Work in Geocap can be undertaken without detailed knowledge of VTK, although familiarity with concepts like data types, grids, and data attributes will enhance your understanding of data operations and display.
On this page:
Coordinate Systems
Before data structures are discussed, it is useful to review the basics of coordinate systems. A coordinate system maps a tuple of numbers to a point in mathematical space. In Geocap we are mainly concerned with two and three-dimensional space, customarily denoted by the X, Y, and Z axes. Two and three dimensional space is commonly referred to as 2D and 3D space.
Datasets
Datastes are the basic entities of all operations related to data manipulation and display. They are also the building blocks that constitute a project. In Geocap, datasets are often, but not always, geometrical representations of bodies in 3D space. A dataset may also represent less tangible entities like velocity fields, petrophysical parameters and seismic images.
A dataset consists of geometry, topology, and attributes. The geometry part is essentially a collection of points in 2D or 3D space. Topology defines the structure of the dataset, or how the points are connected. Points may be connected in a triangle, for example. A triangle is a so-called cell. Cells define the topology, much like points define the geometry. Cells will be covered in more detail shortly. Even though the points may change their positions (changing their geometry) they would still form a triangle, thus retaining their topological property. Finally, attributes are auxiliary data associated with the geometry (points) or topology (cells). Attributes are quantities that exist in the spacial positions determined by the geometry. Examples of attributes are temperature, permeability, velocity, and saturation. Attributes will also be covered in more detail shortly.
Points in a dataset are often structured according to certain rules and regularities. These properties determine the type of the dataset, also called datatype. The main datatypes in Geocap are polydata, grids, and images.
Points
Points define the geometry of a dataset, positioning the data in 2D or 3D space. Datasets may contain anywhere from one point to millions of points. A single point is denoted by a tuple containing two or three components, depending on whether the point is positioned in 2D or 3D space. Moreover, points may be arranged in a regular or irregular manner. A regular lattice arrangement is called a grid, or structured points. Irregularly positioned points form a dataset of type polydata, which will be covered in more detail shortly.
Cells
Cells connect points into geometrical shapes like lines and triangles. The shape of the cell defines the topological properties of the dataset. Geocap uses only a subset of the cell types available in VTK. The cell types used are points, lines, polygons and triangle strips. The point cell type is actually called a vertex. When dealing with a large number of points they are usually combined to form a polyvertex cell. A line simply connects two points, while a polygon connects several points using line segments. Triangle strips are adjacent triangles useful for creating irregular surfaces.
Attributes
Attributes are values attached to the points or cells of the dataset. They represent additional information, or spatial quantities, dispersed in space according to the geometry (points or cells) to which they are attached. An attribute is a point attribute if it is attached to the points of the dataset, and a cell attribute when attached to the cells. Common point attributes found in Geocap are height, RGB components in an image, and seismic amplitude. Examples of a more general scientific nature would be velocity and temperature.
It is useful to think of data attributes as "columns", where each row corresponds to the points to which it is associated. The following listing shows temperature and pressure distributed as separate values for a set of points.
POINT X Y Z TEMPERATURE PRESSURE 0 3.4 234.3 45.12 0.43 45.6 1 5.6 290.5 55.63 0.44 45.5 2 6.67 300.3 78.00 0.45 45.3 ... ...
An attribute always has a name, and are sometimes called field data.
VTK Data types
Polydata
A dataset of type polydata may contain any cell type except 3D cells. Triangles are often stitched together to form triangle strips that are suitable for displaying irregular surfaces. In practice, most polydatasets in Geocap contain only one cell type.
Two commonly used polydata types: triangle surface and irregular points
Polydata has a so-called explicit point representation. This means that each point's coordinate values are contained in the dataset. Since poly data points have no inherent structure and thus may appear anywhere in space, we need to store their actual coordinate values in order to infer their position. A common way of representing data is column format. The X, Y, Z coordinates are displayed in separate columns along with any additional data.
Grid
A grid is a regular lattice of points aligned with the coordinate axes. In Geocap this type of grid is also referred to as structured points, while other sources use the term uniform grid.
The size of a grid is determined by its dimensions and increments. The dimensions are the number of grid cells in each direction. The cell count in the X- and Y-direction are called rows and columns, respectively. The increment is the spacing between each grid cell. The increments are uniform along a given axis, although the X- and Y-axes may have different increments.
A simple illustration of a grid
Grids use an implicit point representation. This means that the point coordinates in 2D/3D space are not stored directly in the dataset. Rather, the position is calculated by multiplying the cell index with the grid increment.
The following listing of a digital elevation model (DEM) shows how the z-values (height) are positioned in separate grid cells, each with separate row/column values. Row and column positions are customarily denoted with a (i, j) index.
POINT i j HEIGHT 0 0 0 34.3 1 1 0 34.4 2 2 0 34.5 3 0 1 34.2 4 1 1 34.3 5 2 1 34.6 ... ...
With a grid increment of 4 meters point 5 would be in position (x, y) = (2*4, 4) = (8, 4). Note that the origo need not be in position (0, 0, 0).
There are two main grid forms of type structured points in Geocap:
- Surface grid. Also called 2d grid and is the form just described.
- Cube grid. Also called cube or 3d grid.
Images
Images are similar to grids. In fact, they share the same data structure. They differ, however, in that images are expected to show colors or gray-tones. Each grid cell therefore represents an image pixel, and gets its color from the associated attribute data. Color images would therefore contain three data attributes for each point, namely the red, green, and blue color components. Each value is in the 0-255 range. This is depicted in the following listing.
POINT I J RED GREEN BLUE 0 0 0 120 210 77 1 1 0 73 56 27 2 2 0 15 110 99 3 0 1 84 57 51 4 1 1 51 72 11 5 2 1 67 11 87 ... ...
An image consisting of a rectangular array of pixels is an example of raster graphics, as opposed to the vector graphics created by polydata.