GRID_4D Function

Grids a 3D array containing intensity values, given random 4D coordinates (this function works best with sparse data points).

Usage

    result = GRID_4D(points, grid_x, grid_y, grid_z)

Input Parameters

points—A (4, n) array containing the random 4D points to be gridded. Typically, points(0, *) contains the x values, points(1, *) contains the y values, points(2, *) contains the z values, and points(3, *) contains the intensity values. (You may, however, choose to put other variables in these four vectors.)

grid_x—The x dimension of the grid. The x values are scaled to fit this dimension.

grid_y—The y dimension of the grid. The y values are scaled to fit this dimension.

grid_z—The z dimension of the grid. The z values are scaled to fit this dimension.

Returned Value

result—A gridded, 3D array containing intensity values.

Keywords

Order—The order of the weighting function to use for neighborhood averaging. Points are weighted by the function:

    w = 1.0 / (dist ^ Order)

where dist is the distance to the point. (Default: 2)

XMax—The x-coordinate of the right edge of the grid. If omitted, maps the maximum x value found in the points(0, *) array to the right edge of the grid.

XMin—The x-coordinate of the left edge of the grid. If omitted, maps the minimum x value found in the points(0, *) array to the left edge of the grid.

YMax—The y-coordinate of the top edge of the grid. If omitted, maps the maximum y value found in the points(1, *) array to the top edge of the grid.

YMin—The y-coordinate of the bottom edge of the grid. If omitted, maps the minimum y value found in the points(1, *) array to the grid’s bottom edge.

ZMax—The z-coordinate of the front edge of the grid. If omitted, maps the maximum z value found in the points(2, *) array to the grid’s front edge.

ZMin—The z-coordinate of the back edge of the grid. If omitted, maps the minimum z value found in the points(2, *) array to the grid’s back edge.

Discussion

GRID_4D uses an inverse distance averaging technique to interpolate missing data values for 4D gridding. The gridded array returned by GRID_4D is suitable for use with SHADE_VOLUME and VOL_REND.

GRID_4D is similar to FAST_GRID4, but works best with sparse data points (say, less than 1000 points to be gridded) and is stable when extrapolating into large void areas. (FAST_GRID4 works best with dense data points; it is considerably faster, but slightly less accurate, than GRID_4D.)

Examples

These commands show 4D gridding with sparse data points and a cut-away.

; Generate the data to be used for shading.
points = INTARR(4, 10)
points(*, 0) = [1, 1, 2, 86]
points(*, 1) = [1, 1, 3, 44]
points(*, 2) = [9, 9, 5, 37]
points(*, 3) = [5, 4, 7, 99]
points(*, 4) = [4, 0, 6,  9]
points(*, 5) = [0, 9, 9, 32]
points(*, 6) = [3, 5, 5,  2]
points(*, 7) = [6, 6, 5, 55]
points(*, 8) = [0, 0, 5, 66]
points(*, 9) = [9, 0, 0, 44]
; Grid the generated data.
ival = GRID_4D(points, 32, 32, 32, Order=4.0)
ival = BYTSCL(ival)
block = BYTARR(30, 30, 30)
block(*, *, *) = 255
; Pad the data with zeroes.
block = VOL_PAD(block, 1)
; Cut away a section of the block by setting the desired 
; elements to zero.
block(0:16, 0:16, 16:31) = 0
; Set up the viewing window and load the color table.
WINDOW, 0, Colors=128
LOADCT, 3
CENTER_VIEW, Xr=[0.0, 31.0], Yr=[0.0, 31.0], $
   Zr=[0.0, 31.0], Ax=(-60.0), Az=45.0, Zoom=0.6
; Change the direction of the light source for shading.
SET_SHADING, Light=[-1.0, 1.0, 0.2]
; Compute the 3D contour surface.
SHADE_VOLUME, block, 1, vertex_list,  $
   polygon_list, Shades=ival, /Low
; Render the cut-away block with light source shading.
img1 = POLYSHADE(vertex_list, polygon_list, /T3d)
; Render the cut-away block shaded by the gridded data.
img2 = POLYSHADE(vertex_list, polygon_list, Shades=ival, $
   /T3d)
; Display the resulting composite image of the light 
; source-shaded block and the data-shaded block.
TVSCL, (FIX(img1) + FIX(img2))

For another example, see the vol_demo4 demonstration program in:

    (UNIX) <wavedir>/demo/arl

    (WIN) <wavedir>\demo\arl

Where <wavedir> is the mainPV‑WAVE directory.

See Also

FAST_GRID2, FAST_GRID3, FAST_GRID4, GRID_2D, GRID_3D, GRID_SPHERE