## Overview of Volume Visualization

### Examples of Volume Data

Volume visualization is the creation of graphical representations of data sets that are defined on three-dimensional grids. Volume data sets are characterized by multidimensional arrays of scalar or vector data. These data are typically defined on lattice structures representing values sampled in 3-D space. There are two basic types of volume data:

• Scalar volume data contains single values for each point.

• Vector volume data contains two or three values for each point, defining the components of a vector.

An example of scalar volume data is that produced by `flow`. The flow data represents the speed profile of a submerged jet within an infinite tank. Typing

`[x,y,z,v] = flow;`

produces four 3-D arrays. The `x`, `y`, and `z` arrays specify the coordinates of the scalar values in the array `v`.

The `wind` data set is an example of vector volume data that represents air currents over North America. You can load this data in the MATLAB® workspace with the command:

`load wind`

This data set comprises six 3-D arrays: `x`, `y`, and `z` are the coordinate data for the arrays `u`, `v`, and `w`, which are the vector components for each point in the volume.

### Selecting Visualization Techniques

The techniques you select to visualize volume data depend on what type of data you have and what you want to learn. In general:

• Scalar data is best viewed with isosurfaces, slice planes, and contour slices.

• Vector data represents both a magnitude and direction at each point, which is best displayed by stream lines (particles, ribbons, and tubes), cone plots, and arrow plots. Most visualizations, however, employ a combination of techniques to best reveal the content of the data.

The material in these sections describes how to apply a variety of techniques to typical volume data.

#### Interpolating and Gridding Data

MATLAB provides functions that enable you to interpolate and restructure your data in preparation for visualization. See these sections for more information:

### Steps to Create a Volume Visualization

Creating an effective visualization requires a number of steps to compose the final scene. These steps fall into four basic categories:

1. Determine the characteristics of your data. Graphing volume data usually requires knowledge of the range of both the coordinates and the data values.

2. Select an appropriate plotting routine. The information in this section helps you select the right methods.

3. Define the view. The information conveyed by a complex three-dimensional graph can be greatly enhanced through careful composition of the scene. Viewing techniques include adjusting camera position, specifying aspect ratio and project type, zooming in or out, and so on.

4. Add lighting and specify coloring. Lighting is an effective means to enhance the visibility of surface shape and to provide a three-dimensional perspective to volume graphs. Color can convey data values, both constant and varying.

### Volume Visualization Functions

MATLAB functions enable you to apply a variety of volume visualization techniques. The following tables group these functions into two categories based on the type of data (scalar or vector) that each is designed to work with. The reference page for each function provides examples of the intended use.

#### Functions for Scalar Data

FunctionPurpose

`contourslice`

Draw contours in volume slice planes

`isocaps`

Compute isosurface end-cap geometry

`isocolors`

Compute the colors of isosurface vertices

`isonormals`

Compute normals of isosurface vertices

`isosurface`

Extract isosurface data from volume data

`patch`

Create a patch (multipolygon) graphics object

`reducepatch`

Reduce the number of patch faces

`reducevolume`

Reduce the number of elements in a volume data set

`shrinkfaces`

Reduce the size of each patch face

`slice`

Draw slice planes in volume

`smooth3`

Smooth 3-D data

`surf2patch`

Convert surface data to patch data

`subvolume`

Extract subset of volume data set

#### Functions for Vector Data

Function

Purpose

`coneplot`

Plot velocity vectors as cones in 3-D vector fields

`curl`

Compute the curl and angular velocity of a 3-D vector field

`divergence`

Compute the divergence of a 3-D vector field

`interpstreamspeed`

Interpolate streamline vertices from vector-field magnitudes

`streamline`

Draw stream lines from 2-D or 3-D vector data

`streamparticles`

Draw stream particles from vector volume data

`streamribbon`

Draw stream ribbons from vector volume data

`streamslice`

Draw well-spaced stream lines from vector volume data

`streamtube`

Draw stream tubes from vector volume data

`stream2`

Compute 2-D stream line data

`stream3`

Compute 3-D stream line data

`volumebounds`

Return coordinate and color limits for volume (scalar and vector)