Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

SHADE_VOLUME


Syntax | Arguments | Keywords | Examples | Version History | See Also

Given a 3-D volume and a contour value, SHADE_VOLUME produces a list of vertices and polygons describing the contour surface. This surface can then be displayed as a shaded surface by the POLYSHADE procedure. Shading is obtained from either a single light-source model or from user-specified values.

SHADE_VOLUME computes the polygons that describe a three dimensional contour surface. Each volume element (voxel) is visited to find the polygons formed by the intersections of the contour surface and the voxel edges. The method used by SHADE VOLUME is that of Klemp, McIrvin and Boyd, 1990: "PolyPaint-A Three-Dimensional Rendering Package," American Meteorology Society Proceedings, Sixth International Conference on Interactive Information and Processing Systems. This method is similar to the marching cubes algorithm described by Lorenson and Cline, 1987: "Marching Cubes: A High Resolution 3D Surface Construction Algorithm," Computer Graphics 21, 163-169.

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

Syntax

SHADE_VOLUME, Volume, Value, Vertex, Poly [, /LOW] [, SHADES=array] [, /VERBOSE] [, XRANGE=vector] [, YRANGE=vector] [, ZRANGE=vector]

Arguments

Volume

A three-dimensional array that contains the dataset to be contoured. If the Volume array is dimensioned (D0, D1, D2), the resulting vertex coordinates are as follows:

0 < X < D0 - 1; 0 < Y < D1 - 1; 0 < Z < D2 - 1.

If floating-point NaN values are present in Volume, then SHADE_VOLUME may generate inconsistent surfaces and may return NaN values in the Vertex argument. The surfaces generated by SHADE_VOLUME may also vary across platforms if NaN data is present in the Volume parameter.

Value

The scalar contour value. This value specifies the constant-density surface (also called an isosurface) to be rendered.

Vertex

The name of a variable to receive the vertex array. On output, this variable is set to a (3, n) floating-point array, suitable for input to POLYSHADE.

Poly

A named variable to receive the polygon list, an n-element, longword array. This list describes the vertices of each polygon and is suitable for input to POLYSHADE. The vertices of each polygon are listed in counterclockwise order when observed from outside the surface. The vertex description of each polygon is a vector of the form: [n, i0i1, ..., in-1] and the Poly array is the concatenation of the lists of each polygon. For example, when rendering a pyramid consisting of four triangles, Poly would contain 16 elements, made by concatenating four, four-element vectors of the form [3, V0V1V2]. V0, V1, and V2 are the indices of the vertices describing each triangle.

Keywords

LOW

Set this keyword to display the low side of the contour surface (i.e., the contour surfaces enclose high data values). If this keyword is omitted or is 0, the high side of the contour surface is displayed and the contour encloses low data values. If this parameter is incorrectly specified, errors in shading will result.

SHADES

An optional array, converted to byte type before use, that contains the user-specified shading color index for each voxel. This array must have the same dimensions as Volume. On exit, this array is replaced by another array, that contains the shading value for each vertex, contained in Vertex.

Warning
When using the SHADES keyword on True Color devices, we recommend that decomposed color support be turned off, by setting DECOMPOSED=0 for DEVICE.

VERBOSE

Set this keyword to print a message indicating the number of polygons and vertices that are produced.

XRANGE

An optional two-element vector that contains the limits, over the first dimension, of the sub-volume to be considered.

YRANGE

An optional two-element vector that contains the limits, over the second dimension, of the sub-volume to be considered.

ZRANGE

An optional two-element vector containing the limits, over the third dimension, of the sub-volume to be considered.

Examples

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

PRO SHOWVOLUME, vol, thresh, LOW = low 
   ; Get the dimensions of the volume: 
   s = SIZE(vol) 
   ; Error, must be a 3-D array: 
   IF s[0] NE 3 THEN MESSAGE, 'Error: vol must be a 3-D array' 
   ; Establish the 3-D transformation and coordinate ranges: 
   SCALE3, XRANGE=[0, S[1]], YRANGE=[0, S[2]], ZRANGE=[0, S[3]] 
   ; Default = view high side of contour surface: 
   IF N_ELEMENTS(low) EQ 0 THEN low = 0 
   ; Produce vertices and polygons: 
   SHADE_VOLUME, vol, thresh, v, p, LOW = low 
   ; Produce image of surface and display: 
   TV, POLYSHADE(v, p, /T3D) 
END 

Version History

Introduced: Pre 4.0

See Also

INTERVAL_VOLUME, IVOLUME, POLYSHADE, SHADE_SURF, XVOLUME


Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]