vpExtract(3)
π vpExtract(3) π
okay bestie, welcome to the glow-up of vpExtract β a lil library function from the Library Functions Manual section, and yes she's serving volume-slicing realness π«Ά
β¨ NAME β¨
vpExtract β extract one field from a rectangular region of a volume π
πΈ SYNOPSIS πΈ
#include <volpack.h>
vpResult
vpExtract(vpc, volume_type, x0, y0, z0, x1, y1, z1, field, dst,
dst_size, dst_xstride, dst_ystride, dst_zstride)
vpContext *vpc;
int volume_type;
int x0, y0, z0;
int x1, y1, z1;
int field;
void *dst;
int dst_size;
int dst_xstride, dst_ystride, dst_zstride;
π ARGUMENTS π
vpcβ the VolPack context you got fromvpCreateContext. your main character β¨volume_typeβ a code that says which volume data structure we're pulling the region out of. the options areVP_RAW_VOLUME,VP_CLASSIFIED_VOLUME,VP_CLX_VOLUME,VP_CLY_VOLUMEorVP_CLZ_VOLUME.x0,y0,z0β origin corner of the extracted region, in the voxel array.x1,y1,z1β the opposite corner of the extracted region, in the voxel array.fieldβ a voxel field number that says which field to extract, OR one of these special codes:VP_OPACITY_FIELD,VP_CORRECTED_OPAC_FIELD,VP_COLOR_FIELD. iykyk πdstβ the destination array, aka where the goodies land πdst_sizeβ size of the destination array, in bytes.dst_xstride,dst_ystride,dst_zstrideβ strides (in bytes) for the X, Y and Z dimensions of the destination array.
π¦ DESCRIPTION π¦
so, vpExtract is the girl who goes into a rectangular region of either the 3D voxel array or the preclassified volume, yoinks one field out of it, and drops the result into a separate array. she can also hand you computed voxel opacities or colors, no cap π
the volume_type argument picks which data structure we're extracting the region from. the choices, bestie:
VP_RAW_VOLUMEβ extract from the 3D voxel array (seevpSetRawVoxels(3)).VP_CLASSIFIED_VOLUMEβ extract from the preclassified volume (seevpClassifyVolume(3)). heads up: there are three copies of the voxel data in the preclassified volume, one for each principal viewing axis. the copy that gives the fastest access (aka the best memory stride) gets selected. periodt.VP_CLX_VOLUMEβ extract from the preclassified volume used for X-axis viewing.VP_CLY_VOLUMEβ extract from the preclassified volume used for Y-axis viewing.VP_CLZ_VOLUMEβ extract from the preclassified volume used for Z-axis viewing.
lowkey important: those last three volume_type choices are usually only used for debugging π
the next six arguments are the coordinates of the corners of the extracted region in the volume. these coordinates are indexes into the array, fr fr.
the field argument picks which voxel field gets extracted. any of the voxel field numbers you previously specified with vpVoxelField works here. and the output array must be sized appropriately for the region's dimensions and the size of the extracted field, okay? don't skip that part π
these special constants can also be used instead of a voxel field number:
VP_OPACITY_FIELDβ return voxel opacities for the voxels in the indicated region. if the 3D voxel array is selected, the opacities are computed on-the-fly using the current opacity transfer function, and the minimum opacity threshold is ignored. if the preclassified volume is selected, then the precomputed opacities get extracted, and opacities below the minimum opacity threshold at the time the volume was classified are set to0. the output array should be typeunsigned char, and opacities are stored as a number between0(transparent) and255(opaque). β¨VP_CORRECTED_OPAC_FIELDβ same as theVP_OPACITY_FIELDoption, except the voxel opacities get corrected for the current view transformation. the opacity transfer function is assumed to produce the opacity of a voxel viewed perpendicular to one face of the volume with no scale factor. so if the voxel has been scaled or rotated with respect to the viewer, then the apparent opacity must be corrected. she's doing math for you, be grateful πVP_COLOR_FIELDβ return voxel colors for voxels in the indicated region. colors are computed on-the-fly using the current shading, lighting and material parameters. the output array should be typeunsigned char, and each color channel is stored as a number between0(off) and255(full intensity). the number of color channels per pixels is determined by the current shading parameters. (not currently supported for preclassified volumes, bestie, sorry π)
the remaining arguments specify the output array, its size (for error checking, she's thorough), and the stride for each dimension β that's so you can pad the end of scanlines or store the result in a higher-dimension array. slay π
π ERRORS π
the normal return value is VP_OK. the following error return values are possible:
VPERROR_BAD_VALUEβ the volume coordinates are out of bounds or invalid (x0 > x1, etc.), or the field number is invalid.VPERROR_BAD_SIZEβ the destination array size is incorrect.VPERROR_BAD_VOLUMEβ the volume data does not exist.VPERROR_BAD_OPTIONβ thevolume_typeargument is invalid.VPERROR_BAD_VOLUMEβ the volume size or data is missing or invalid.VPERROR_BAD_VOXELβ the voxel fields are incorrectly defined.VPERROR_BAD_CLASSIFIERβ the opacity transfer function is incorrectly specified.VPERROR_BAD_SHADERβ the shading parameters have been incorrectly specified.VPERROR_SINGULARβ one or more of the view transformation matrices is singular.
not me listing VPERROR_BAD_VOLUME twice β that's literally what the page says, so it stays, bestie π
π SEE ALSO π
VolPack(3), vpCreateContext(3)
and that's the whole page, angel π brought to you by VolPack, filed under vpExtract(3) β go extract something iconic, you absolute legend ππ¦β¨
π¦ where this page comes from
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 43: volpack 1.0c7-35.fc43 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- fedora 44: volpack 1.0c7-36.fc44 Β· BSD-3-Clause
- Copyright (c) 1995-2008, Stanford University
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms