SHADE_VOLUME Procedure

Given a 3D volume and a contour value, produces a list of vertices and polygons describing the contour surface.

Usage

SHADE_VOLUME, volume, value, vertex, poly 

Input Parameters

volume—An array with three dimensions containing the dataset to be contoured. If the volume array is dimensioned (D0, D1, D2), the resulting vertices range as follows:

In X, they range between 0 and D0 – 1.

In Y, they range between 0 and D1 – 1.

In Z, they range between 0 and D2 – 1.

value—A scalar containing the contour value.

Output Parameters

vertex—The name of a variable to receive the vertex array. This variable will be set to a (3, n) floating-point array, suitable for input to the MESH or POLYSHADE procedure.

poly—The name of a variable to receive the polygon list, an m-element longword array. This list describes the vertices of each polygon and is suitable for input to MESH or POLYSHADE.

Keywords

Low—If present and nonzero, indicates that the low side of the contour surface is to be displayed and that the contour surfaces enclose high data values. Otherwise, it is assumed that the high side of the contour surface is to be displayed and that the contour encloses low data values. If this parameter is incorrectly specified, errors in shading will result.

Shades—An array with the same dimensions as volume. On input, it contains the user-specified shading color index for each volume element (voxel), and is converted to byte type before use. On output, this input array is replaced by another array containing the shading value for each vertex, contained in vertex.

Discussion

SHADE_VOLUME computes the polygons that describe a three-dimensional contour surface. Each voxel is visited to find the polygons formed by the intersections of the contour surface and the voxel edges.

You can obtain shading from either a single light-source model or from the values you specify with Shades.

The surface produced by SHADE_VOLUME may then be displayed as a shaded surface with the POLYSHADE procedure.

This routine is limited to processing datasets that will fit in memory.

Example

The following procedure shades a volume passed as a parameter. It uses SURFACE to establish the viewing transformation. It then calls SHADE_VOLUME to produce the vertex and polygon lists, and POLYSHADE to draw the contour surface.

; Display the contour surface of a volume.
PRO ShowVolume, vol, thresh, Low=low
   ; Get the dimensions.
   s = SIZE(vol)
   ; Flag an error if s is not a 3D array.
   IF s(0) NE 3 THEN PRINT, 'Error'
   ; Use SURFACE to establish 3D transformation and 
   ; coordinate ranges.
   SURFACE, FLTARR(2,2), /Nodata, /Save, $
      XRange=[0,s(1)-1], YRange=[0,s(2)-1], ZRange=[0,s(3)-1]
   ; Make default to view the high side of the contour surface.
   IF N_ELEMENTS(low) EQ 0 THEN low = 0
   ; Produce the vertices and polygons.
   SHADE_VOLUME, vol, thresh, v, p, Low=low
   ; Produce the image of the surface and display.
   TV, POLYSHADE(v, p, /T3D)
END

Note:

For another example demonstrating SHADE_VOLUME, see the POLYSHADE function.

See Also

POLYSHADE, SURFACE, ISOSURF

For information on volume visualization, see the PV‑WAVE User Guide.

The method used by SHADE_VOLUME is that described by Klemp, McIrvin and Boyd in “PolyPaint—A Three-Dimensional Rendering Package,” American Meteorology Society Proceedings, Sixth International Conference on Interactive Information and Processing Systems, 1990.