 |
vlmget_slice4d
NAME
vlmget_slice4d - Reads a slice of data from a
ParVox voxel data file.
SYNOPSIS
#include <vlmeta.h>
int vlmget_slice4d(int ncid,vlmeta_voxel4d * vdata,
long voxel_start[], long voxel_count[], int dtype);
DESCRIPTION
Vlmget_slice4d reads a slice of data values from a
ParVox voxel data file. The handle ncid, which is obtained by a
previous vlmopen_vox call, points to the file to read from. Vlmget_slice4d
reads in the header data in the vlmeta_voxel4d structure vdata and
allocates memory for the data at the vldata->voxel_data member
if it does not exist. The function then reads from the data location
starting from voxel_start and extending voxel_count
distance. Dtype indicates the format the file is in, either
VL_RAW or VL_NETCDF.
When selecting a slice to read, the arrays
voxel_start and voxel_count are 4 dimensional
vectors in the following order: variable ID, depth (k), height (j),
and width (i). To put it another way, voxel_start[0] would
be the variable number (0 if there is only one), voxel_start[1]
would be the value in k dimension, and so on. Note that voxel_count
is the extent to read in each direction, therefore no values in
voxel_count should be 0. Example: given a dataset
of one variable and the size 640 × 480 × 128, suppose we
want to read a slice 2 units thick in the k direction, say from
(0, 0, 4) to (639, 479, 5). To read this slice, vlmget_slice4d will
need to be called with these values in the arrays:
voxel_start[0] = 0,
voxel_start[1] = 4, voxel_start[2] = 0,
voxel_start[3] = 0
voxel_count[0] = 1,
voxel_count[1] = 2, voxel_count[2] = 480,
voxel_count[3] = 640
There are a few pitfalls to look out for: first,
the voxel_count[] array should contain the extent in each
direction, not the absolute ``corner point''. For example, to read one
variable, voxel_count[0] = 1. Second, note the order in the
array. It is in (variable, k, j, i) order.
SEE ALSO
vlmopen_vox,
vlmeta_voxel4d,
ParVox Tutorial: Input Data Format
DIAGNOSTICS
Upon successful completion, the value of 0 is returned.
Otherwise, a value of -1 is returned.
|
 |