| iTool User's Guide: Working with Volumes |

## Displaying Volumes

The iVolume tool's primary purpose is to visualize volume data, though the tool is capable of much more once the data is displayed. The iVolume tool also allows you to manipulate and edit the displays. The first task is to display the volume data.

Before displaying, volume data must be loaded into the tool. Here is a simple example of one way to load in some data.

At the IDL command line, enter:

    file = FILEPATH('head.dat', $
       SUBDIRECTORY = ['examples', 'data'])
    data = READ_BINARY(file, DATA_DIMS = [80, 100, 57])
    IVOLUME, data

Note The `examples/data` directory of your IDL 6.3 distribution contains a text file named `index.txt`. This file lists all data files available in the example directory and also lists their dimensions and values.

Note IDL converts and stores volume data in a BYTE array. Thus, all incoming volume data is converted to BYTE type. This could alter the volume data values if the incoming data cannot accurately be stored as BYTE data.

### Multi-Channel Volumes

The data in the previous example is a single-channel volume which is volume data specified in a single parameter. This is the simplest and most common way to display volume data. The iVolume tool also supports two-channel and four-channel volume rendering. Two-channel rendering allows you to combine or blend two volume arrays together. Four-channel rendering is useful when your volume data is composed of a volume array for each of the red, green, blue, and alpha display channels. Note that the dimensions of all the volume arrays used in multi-channel volume rendering must be the same.

In the following example, the second volume array of a two-channel volume is used as a mask to cut out a portion of the volume to create a hole. With the `head.dat` data already loaded from the`examples/data` directory, a mask volume is created and displays the result:

    mask = BYTARR(80, 100, 57)
    mask[*] = 255
    mask[30:50, *, 20:30] = 0
    IVOLUME, data, mask

A rectangular hole through the middle of the head is created, making portions of the inside more visible.

The following is an example of a four-channel volume:

    red = BYTARR(20,20,20)
    green = BYTARR(20,20,20)
    blue = BYTARR(20,20,20)
    alpha = BYTARR(20,20,20)

    red[10:*,*,*]=255
    green[*,10:*,*]=255
    blue[*,*,10:*]=255
    alpha[*] = 128
    IVOLUME, red, green, blue, alpha

### Rendering Volumes

Volume data does not automatically appear in the tool window since volume rendering can be a time consuming operation. To render the volume, click the Render button on the tool. Auto render is available but not set by default since it can slow down your iTool session if you have simultaneous operations.

Note Volume data is only rendered if the volume data space is selected. Thus, if you have multiple volumes in your data space, auto render must be turned on in order to render both simultaneously.

The data loaded earlier can be displayed by clicking the Render button.

Figure 14-1: Rendered MRI Head Volume Data

Figure 14-1: Rendered MRI Head Volume Data

#### Rendering Quality

The volume can be rendered in two quality modes:

- Low — Done with a stack of 2D texture-mapped semi-transparent polygons. The polygons are oriented so that the flat sides face the viewer as directly as possible. On most systems, Low-quality mode renders faster than High-quality mode, but not as accurately.

- High — Done with the IDLgrVolume ray-casting volume renderer. This quality mode is CPU-intensive and will usually take much longer than the Low-quality mode.

#### Extents

Since the volume is not always rendered, iVolume draws volume extents to help you locate and select the volume. You can select the volume by selecting on the extents, without rendering the volume. By default, iVolume draws a translucent solid cube with internal extents. You can also select a wire frame, or no extents within the visualization browser.

Note Use caution when turning off extents. If extents are turned off and auto render is also off, you may need to use the Visualization Browser to select the volume again.

IDL Online Help (March 01, 2006)