Man Linux: Main Page and Category List

vpCreateMinMaxOctree, vpMinMaxOctreeThreshold, vpDestroyMinMaxOctree - create/destroy a min-max octree for optimized rendering

#include <volpack.h> vpResultvpCreateMinMaxOctree(vpc,root_node_size,base_node_size)vpContext *vpc;introot_node_size,base_node_size;vpResultvpMinMaxOctreeThreshold(vpc,param_num,range)vpContext *vpc;intparam_num,range;vpResultvpDestroyMinMaxOctree(vpc)vpContext *vpc;

vpcVolPack context fromvpCreateContext.root_node_sizeNumber of voxels per side in the top level (largest nodes) of the octree. Not currently used.base_node_sizeNumber of voxels per side in the bottom level (smallest nodes) of the octree. Must be a power of 2.param_numIdentifying number of one parameter of the opacity transfer function.rangeRange threshold for one parameter of the opacity transfer function. If an octree node spans a larger range then it is subdivided.

These routines are used to create and destroy a min-max octree, an internal data structure that is used to accelerate classifying and rendering volume data in a 3D voxel array. The octree is a hierarchical data structure that contains minimum and maximum values for each voxel field. It does not duplicate the data in the voxel array. The octree is not used with preclassified volumes (see vpClassifyVolume(3)). Before creating an octree, declare a 3D voxel array usingvpSetVolumeSize,vpSetVoxelSize,vpSetVoxelFieldandvpSetRawVoxels,and initialize parameters for the opacity transfer function by callingvpSetClassifierTable. Then initialize the voxel data in the array. The lookup tables for the opacity transfer function do not need to be initialized. Now callvpMinMaxOctreeThresholdonce for each parameter to the opacity transfer function. The parameter number is the same number as the parameter number you would pass tovpClassifierTable.Therangeargument specifies a "small" range of values for the corresponding parameter. The opacity of a voxel should not vary much for voxels within this range of parameter space. Choosing a value which is too small or too large may result in a reduced performance benefit during rendering. The functionvpOctreeMaskcan be used to visualize the effectiveness of various parameter ranges. Note that you must choose the voxel field associated with each opacity transfer function parameter in advance of creating the octree (by callingvpSetClassiferTable), but the opacity transfer function itself does not need to be known since the lookup tables do not need to be initialized. In the current implementation all of the parameters must be one or two- byte voxel fields; four-byte fields are not allowed. Finally, callvpCreateMinMaxOctreeto actually compute the octree. The arguments specify the largest and smallest node size. These values can be used to trade off storage size of the octree for increased resolution. The octree is stored in the rendering context and is used automatically in subsequent calls tovpClassifyVolumeandvpRenderRawVolume.Only one octree may be stored in a context at a time. If an octree already exists whenvpCreateMinMaxOctreeis called then the old octree is destroyed. If the data in the voxel array changes then the min-max octree must be explicitly recomputed by callingvpCreateMinMaxOctreeagain before the next call tovpClassifyVolumeorvpRenderRawVolume.vpDestroyMinMaxOctreedestroys the current min-max octree and frees the associated storage.

The current octree parameters can be retrieved with the following state variable codes (see vpGeti(3)): VP_CLASSIFY_FIELD_COUNT, VP_CLASSIFY_FIELDS, VP_MMOCTREE_THRESHOLDS, VP_MMOCTREE_SIZE.

The normal return value for all three functions is VP_OK.vpMinMaxOctreeThresholdcan return the following error value: VPERROR_BAD_VALUE The parameter number is invalid.vpCreateMinMaxOctreecan return the following error values: VPERROR_BAD_VALUE The node size arguments are not a power of two. VPERROR_BAD_VOXEL The voxel size or the voxel fields have not been specified or have been incorrectly specified, or the number of parameters to the opacity transfer function has been incorrectly specified. VPERROR_BAD_VOLUME The volume array or volume dimensions have not been specified, or the size of the volume array does not match the volume dimensions. VPERROR_BAD_CLASSIFIER The fields specified as parameters to the opacity transfer function are invalid or do not have valid sizes. VPERROR_LIMIT_EXCEEDED The volume is too large, so the maximum size of the octree has been exceeded. Change the constant VP_MAX_OCTREE_LEVELS in volpack.h and recompile the VolPack library.

VolPack(3), vpCreateContext(3), vpClassifyVolume(3), vpOctreeMask(3), vpRenderRawVolume(3)