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 in the lib subdirectory of the IDL distribution.

Calling Sequence

Return = PROJECT_VOL( Vol, X_Sample, Y_Sample, Z_Sample )



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 .


A long integer specifying the number of rays to project along the Y dimension of the image. To preserve the correct aspect ratio of the data, Y_sample should equal X_sample .


A long integer specifying the number of samples to take along each ray. Higher values for X_sample , Y_sample , and Z_sample increase the image resolution as well as execution time.



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.


A 4x4 floating-point array to use as the transformation matrix when projecting the volume. The default is to use the system viewing matrix (!P.T).


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

vol = RANDOMU(S, 40, 40, 40)

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)

Set up the view:

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, SCALE=[0.7, 0.7, 0.7]

T3D, ROTATE=[30, -30, 60]

T3D, TRANSLATE=[0.5, 0.5, 0.5]


Generate and display the image:

img = PROJECT_VOL(vol, 64, 64, 64, DEPTH_Q=0.7, $

  OPAQUE=opaque, TRANS=(!P.T))

TVSCL, img

See Also