vpSetClassifierTable(3)
π vpSetClassifierTable β the manual page, but make it cute π
okay bestie, so this is vpSetClassifierTable(3), a VolPack library function, and it's literally the girl who tells VolPack how see-through stuff should be. her whole job? specify an opacity transfer function. that's it. that's the vibe. β¨
β¨ NAME β¨
vpSetClassifierTable β specify an opacity transfer function π
β¨ SYNOPSIS β¨
#include <volpack.h>
vpResult
vpSetClassifierTable(vpc, param_num, param_field, table, table_size)
vpContext *vpc;
int param_num, param_field;
float *table;
int table_size;
β¨ ARGUMENTS β¨
vpcβ the VolPack context you got fromvpCreateContext. your girl. your main character. π«Άparam_numβ parameter number, and it's the one that IDs exactly which parameter of the opacity transfer function we're talking about.param_fieldβ field number, identifying which voxel field holds that parameter.tableβ the lookup table that defines the mapping from the voxel field value β the opacity. the glow-up pipeline, basically. πtable_sizeβ size oftable, in bytes. yes, bytes. don't come at me. πΈ
β¨ DESCRIPTION β¨
so vpSetClassifierTable is the one you call to specify lookup tables that define an opacity transfer function. and the opacity transfer function has to be in this exact form:
opacity = f0(param0) * f1(param1) * ... * fN(paramN)
where each factor is a function of one voxel field. (keep reading, because if you want more general classification models, there's a whole workaround below, iykyk.)
you call vpSetClassifierTable once for each factor, to specify the lookup table that defines that factor. then, once the function has been specified, opacities get computed by calling one of the classification functions: vpClassifyScalars, vpClassifyVolume, or vpClassifyScanline. π¦
and here's how the classifying actually works, no cap: to classify a voxel, those functions use the values in the fields of the voxel as indexes into the opacity transfer function tables, retrieve one value from each table, and multiply the values together to compute the opacity for that voxel. the opacity should be a number in the range 0.0-1.0, so normally each table contains numbers that are also in this range. π
the parameters of the opacity transfer function are numbered from zero, and the total number of parameters must be specified using vpSetVoxelSize before calling vpSetClassifierTable. important. periodt.
the number of parameters is independent of the number of voxel fields: some fields may not be used as parameters at all, and one field could be used multiple times (although that's inefficient, since all of the tables indexed by the same parameter could be merged into one table β just saying π«£).
each table should be a 1D array of numbers with one entry for each possible value of the corresponding voxel field. and the voxel field must contain an unsigned integer quantity. normally you'd declare each table like this:
float table[MAX_FIELD_VALUE + 1];
where MAX_FIELD_VALUE is the maximum possible value in the voxel field, as specified with vpSetVoxelField. the table may also be dynamically allocated, if you're feeling fancy.
β οΈ bestie, listen: VolPack will never free the table, even if the VolPack context is destroyed with vpDestroyContext. so the application is responsible for freeing that memory when appropriate. it's giving "you broke it, you bought it." π
the values in the table may be initialized or modified at any time before or after calling vpSetClassifierTable β but before calling one of the classification routines. and ooh, check it: see the function vpRamp for a convenient way to initialize tables with piece-wise linear ramps. π
now, classification functions that are not expressible in the form above? handled like this:
- first, write your own routine that computes the opacity for each voxel.
- next, quantize the opacities using somewhere between
8and16bits per voxel, and store the quantized values in one field of each voxel. - finally, define an opacity transfer function table that maps the quantized opacities into a floating point number in the range
0.0-1.0, and use that table to define a single-parameter opacity transfer function by callingvpSetClassifierTable.
and one more thing π β the minimum opacity threshold should be set at the same time as the opacity transfer function. see the VP_MIN_VOXEL_OPACITY argument to vpSetd. don't forget her, she gets lonely.
β¨ STATE VARIABLES β¨
the current classification function parameters can be retrieved with the following state variable codes (see vpGeti(3)):
VP_CLASSIFY_FIELD_COUNTVP_CLASSIFY_FIELDSVP_CLASSIFY_TABLESVP_CLASSIFY_TABLE_SIZESVP_MIN_VOXEL_OPACITY
β¨ ERRORS β¨
the normal return value is VP_OK. π
the following error return value is possible:
VPERROR_BAD_VALUEβ eitherparam_numorfield_numis out of range. (not me being out of range π)
β¨ SEE ALSO β¨
VolPack(3), vpCreateContext(3), vpClassifyScanline(3), vpClassifyScalars(3), vpClassifyVolume(3), vpRamp(3)
and that's the whole page, bestie, you ate it. π
β¨ this icon of a manual comes to you straight from VolPack β that's the source and version energy right there, printed on the footer of the original like a little signature, vpSetClassifierTable(3) and all. go classify something gorgeous. ππ¦π
π¦ where this page comes from
- debian bookworm: libvolpack1-dev 1.0b3-9 Β· BSD-3-Clause
- debian trixie: libvolpack1-dev 1.0b3-10 Β· BSD-3-Clause
- ubuntu jammy: libvolpack1-dev 1.0b3-9 Β· BSD-3-Clause
- ubuntu noble: libvolpack1-dev 1.0b3-9.1 Β· BSD-3-Clause
- ubuntu questing: libvolpack1-dev 1.0b3-11
- ubuntu resolute: libvolpack1-dev 1.0b3-11build1 Β· BSD-3-Clause
- ubuntu stonking: libvolpack1-dev 1.0b3-11build1 Β· BSD-3-Clause
- Copyright (c) 1994 The Board of Trustees of The Leland Stanford
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms