The PROJECT_VOL function returns a two-dimensional image that is the projection of a 3D volume of data onto a plane (similar to an X-ray). The returned image is a translucent rendering of the volume (the highest data values within the volume show up as the brightest regions in the returned image). Depth queuing and opacity may be used to affect the image. The volume is projected using a 4x4 matrix, so any type of projection may be used including perspective. Typically the system viewing matrix (!P.T) is used as the 4x4 matrix.

Note that the VOXEL_PROJ procedure performs many of the same functions as this routine, and is faster.

This routine is written in the IDL language. Its source code can be found in the file ```
project_vol.pro
```

in the ```
lib
```

subdirectory of the IDL distribution.

A 3D array of any type except string or structure containing the three dimensional volume of data to project.

A long integer specifying the number of rays to project along the X dimension of the image. The returned image will have the dimensions *
X_sample*
by *
Y_sample*
.

Set this keyword to indicate that the image should be created using depth queuing. The depth queuing should be a single floating-point value between 0.0 and 1.0. This value specifies the brightness of the farthest regions of the volume relative to the closest regions of the volume. A value of 0.0 will cause the back side of the volume to be completely blacked out, while a value of 1.0 indicates that the back side will show up just as bright as the front side. The default is 1.0 (indicating no depth queuing).

A 3D array of any type except string or structure, with the same size and dimensions as *
Vol*
. This array specifies the opacity of each cell in the volume. OPAQUE values of 0 allow all light to pass through. OPAQUE values are cumulative. For example, if a ray emanates from a data value of 50, and then passes through 10 opaque cells (each with a data value of 0 and an opacity value of 5) then that ray would be completely blocked out (the cell with the data value of 50 would be invisible on the returned image). The default is no opacity.

Use the T3D routine to set up a viewing projection and render a volume of data using PROJECT_VOL. First, create some data:

FOR I=0, 10 DO vol = SMOOTH(vol, 3)

vol = BYTSCL(vol(3:37, 3:37, 3:37))

opaque = RANDOMU(S, 40, 40, 40)

FOR I=0, 10 DO opaque = SMOOTH(opaque, 3)

opaque = BYTSCL(opaque(3:37, 3:37, 3:37), TOP=25B)

xmin = 0 & ymin = 0 & zmin = 0

xmax = 34 & ymax = 34 & zmax = 34

!X.S = [-xmin, 1.0] / (xmax - xmin)

!Y.S = [-ymin, 1.0] / (ymax - ymin)

!Z.S = [-zmin, 1.0] / (zmax - zmin)

T3D, TRANSLATE=[-0.5, -0.5, -0.5]

T3D, TRANSLATE=[0.5, 0.5, 0.5]

WINDOW, 0, XSIZE=512, YSIZE=512

Generate and display the image: