VTK Data Structure
Introduction
This chapter describes the Visualization Toolkit (VTK) data format developed by Kitware. VTK is an open source software system for 3D computer graphics, image processing and visualization. The VTK data format is the primary data structure used internally in Geocap for algorithms and visualization.
In this section:
Datasets
Datasets are usually geometrical representations of surface and body shapes in 3D space. In additon datasets may represent velocity fields, petrophysical parameters, seismic images and virtually any kind of recorded data.
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 into lines or triangles or, for example. The connecting structure are called cells. Cells define the topology, much like points define the geometry.
Points and cells may have associated attributes that are part of the dataset. Examples of attributes are temperature, permeability, velocity, and saturation.
Points
Points define the geometry of a dataset by positioning the data in 2D or 3D space. Datasets may contain anywhere from one point to several hundred millions.
Points with no interal structure are called freepoints.
Cells
Cells can connect points into geometrical shapes like lines and triangles. The shape of the cell defines the topological properties of the dataset. The primary cell types are points, lines, polygons and triangle strips. The point cell type is called a vertex. When dealing with a large number of points they are usually combined to form a polyvertex cell. A simple line connects two points, while a polygon connects several points using line segments. Triangle strips are adjacent triangles useful for creating irregular surfaces.
The primary cell types
Attributes and field data
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. The scalars follows the geometry in this case.
POINT X Y Z scalars TEMPERATURE PRESSURE 0 3.4 234.3 45.12 45.12 0.43 45.6 1 5.6 290.5 55.63 55.63 0.44 45.5 2 6.67 300.3 78.00 78.00 0.45 45.3 ... ...
An attribute always has a name. They are also called field data as they are saved as field data in a vtk dataset. A similar list will be produced by Table View that is found on the right click menu for every dataset in the project.
Scalars
A special attribute type in Geocap is called scalars. When a structure is mapped, the colors of the map are according to the scalars. The scalar values can be the geometry itself. The map colors will then show the geometry. Otherwise the map will have colors from the scalar attribute.
VTK Data types
The main datatypes in Geocap are polydata (points and lines), grids (structures points), and images.
Polydata
A dataset of type polydata may contain any cell type except 3D cells.
Examples of point data:
- Well positions
- Single and multibeam sonar data
- Bathymetry data
Examples of line data:
- Seismic surveys
- Fault lines
- Well data (including all log attributes)
Examples of surface data
- Triangles and triangle strips.
Triangles are often stitched together to form triangle strips that area suitable for displaying irregular surfaces.
The Vtk data format allows for mixing cell types in the same dataset. In practice, polydata sets in Geocap contain only one cell type.
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.
The size of a grid is determined by its dimensions and increments. The dimensions are the number of grid nodes in each direction. The node count in the X- and Y-direction are called rows and columns, respectively. The increment is the spacing between each grid node. The increments are uniform along a given axis, although the X- and Y-axes may have different increments.
Grids use an implicit point representation. This means that the xy coordinates of the points in 2D/3D space are not stored directly in the dataset. Rather, the xy position is calculated by multiplying the node index with the grid increment. Only the node values are stored explicitely.
The following listing of a digital elevation model (DEM) shows how the z-values (height) are positioned in separate grid nodes, 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 2.5d grid and is the form just described.
- Cube grid. Also called cube or 3d grid.
2d grid to the left and 3d grid to left
Undefined values in grid
A grid may have regions that is not part of the grid surface (or cube body for 3d grids). Geocap uses a value called undef to indicate those grid nodes. They play an important part in the grid definition and layout. A Table View listing of a grid will list the undefined values as void.
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.
The Amazon rainforest (NASA)