SoTransferFunction(3)

πŸ“¦ version 2.1.0, in fedora 43, fedora 44

✨ SoTransferFunction ✨

okay bestie, welcome to the glow-up zone πŸ’… this one lives in the SIMVoleon library, it's a Library Functions Manual page, and it's literally all about the transfer function definition. she's giving main character energy in the volume rendering world, no cap 🌈


πŸ“› NAME πŸ“›

SoTransferFunction β€” contains the transfer function definition. that's it, that's the whole name section, periodt πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <VolumeViz/nodes/SoTransferFunction.h>

Inherits SoVolumeRendering.

🌸 Public Types 🌸

enum PredefColorMap { NONE = 0, GREY, GRAY = GREY, TEMPERATURE, PHYSICS,
    STANDARD, GLOW, BLUE_RED, SEISMIC }
enum ColorMapType { ALPHA, LUM_ALPHA, RGBA }

πŸ¦‹ Public Types inherited from SoVolumeRendering πŸ¦‹

enum HW_Feature { HW_VOLUMEPRO, HW_3DTEXMAP, HW_TEXCOLORMAP,
    HW_TEXCOMPRESSION }
enum HW_SupportStatus { NO, YES, UNKNOWN }

πŸ’œ Public Member Functions πŸ’œ

void reMap (int low, int high)
SbBool hasTransparency (void) const

✨ Public Member Functions inherited from SoVolumeRendering ✨

HW_SupportStatus isSupported (HW_Feature feature)

🫢 Static Public Member Functions 🫢

static void initClass (void)

πŸŽ€ Static Public Member Functions inherited from SoVolumeRendering πŸŽ€

static void init (void)
static void initClass (void)
static void setReadAlternateRep (SbBool flag)
static void setWriteAlternateRep (SbBool flag)
static SbBool getReadAlternateRep (void)
static SbBool getWriteAlternateRep (void)
static void setDelayedRendering (SbBool flag)
static SbBool getDelayedRendering (void)

πŸ‘‘ Public Attributes πŸ‘‘

SoSFInt32 shift
SoSFInt32 offset
SoSFEnum predefColorMap
SoSFEnum colorMapType
SoMFFloat colorMap

🧚 Protected Member Functions 🧚

virtual void doAction (SoAction *action)
virtual void GLRender (SoGLRenderAction *action)
virtual void callback (SoCallbackAction *action)
virtual void pick (SoPickAction *action)

πŸ’€ Friends πŸ’€

class SoTransferFunctionP

πŸ“– Detailed Description πŸ“–

Contains the transfer function definition.

so like. this node sets up the mapping from voxel data values to actual on-screen color values and transparency / opaqueness. it's the whole vibe-translator between "here's a number" and "here's a color, bestie" 🌈

she comes with a set of pre-defined color maps β€” the kind you see all the time in e.g. seismic visualization β€” and the option to set up one's own free-form color map lookup table. how? by setting SoTransferFunction::predefColorMap to NONE, and then doing it yourself πŸ’… iykyk.


🌸 Member Enumeration Documentation 🌸

πŸ’– enum SoTransferFunction::PredefColorMap πŸ’–

Predefined color transfer functions, each containing exactly 256 colors. (yes, exactly 256, don't try to be different βœ‹)

Enumerator

  • NONE β€” if this is set, the SoTransferFunction::colorMap field must be used. no pre-made map for you, you're on your own (respectfully) 🫑
  • GREY β€” default transfer function color map. The checker board indicates that this gradient is partly transparent. lowkey iconic.
  • GRAY β€” same as GREY. literally the same thing, just spelled differently, we love options πŸ’…
  • TEMPERATURE β€” this gradient is fully opaque.
  • PHYSICS β€” this gradient is fully opaque.
  • STANDARD β€” this gradient is fully opaque.
  • GLOW β€” this gradient is fully opaque. ✨
  • BLUE_RED β€” this gradient is fully opaque.
  • SEISMIC β€” this gradient is partly transparent.

πŸ’™ enum SoTransferFunction::ColorMapType πŸ’™

Type of colormap array. Defines the possible values for the SoTransferFunction::colorMapType field. so basically, this tells the node how to read your array 🌈

Enumerator

  • ALPHA β€” each color entry in the transfer function has only one component, so the SoTransferFunction::colorMap field should consist of exactly 256 float values, each value representing a transparency value. The RGB colors will all be set to [1,1,1], i.e. all white. 🀍
  • LUM_ALPHA β€” each transfer function color map entry in SoTransferFunction::colorMap has two components, ie. two floats, so the field should contain exactly 256*2 = 512 values. The first float value of each pair is taken to be an intensity / grey color value, and the second float of each pair is a transparency value (as for the ALPHA enum).
  • RGBA β€” four floats are used to specify each color of the transfer function. SoTransferFunction::colorMap should consist of exactly 256*4 = 1024 float values. Each quadruple consist of intensity values for red, green, and blue, and then the fourth value is an alpha value, as for LUM_ALPHA and ALPHA. πŸ’…
math check bestie: 256, 512, 1024. get those numbers wrong and the vibe check fails, fr fr 😭

πŸ›  Member Function Documentation πŸ› 

🎯 void SoTransferFunction::reMap (int low, int high)

Set two thresholds, where all transfer function mappings that ends up below the low value or above the high value are set to be completely transparent. so anything outside your little window? poof. invisible. gone. πŸ‘»

Initial default values are [0, 65535].

🎯 SbBool SoTransferFunction::hasTransparency (void) const

(she's here, listed right in the member functions β€” that's all the doc gives us, bestie 🫢)


πŸ—‚ Member Data Documentation πŸ—‚

⭐ SoSFInt32 SoTransferFunction::shift

Used to shift the voxel attribute value before assigning a color value from the transfer function color map. In pseudo-code:

colorvalue = transferfunction[(voxelvalue << shift) + offset]

(offset is the value of the SoTransferFunction::offset field.)

⭐ SoSFInt32 SoTransferFunction::offset

See the SoTransferFunction::shift field. πŸ‘€ (they're a package deal, your honor)

⭐ SoSFEnum SoTransferFunction::predefColorMap

Sets up the transfer function to use. See SoTransferFunction::PredefColorMap for a list of the pre-defined color maps.

Note that most of the pre-defined color maps are all opaque, even for data value 0. This will often cause the unwanted behavior that the full data set will be completely opaque for visualization, so only the outer "walls" of the volume are shown. To avoid this, use the SoTransferFunction::reMap() method to "narrow" the data values that are to be rendered according to the transfer function (all values outside of the given range will then be fully transparent).

The value SoTransferFunction::NONE has special meaning: it signifies that none of the pre-defined values should be used, but that the transfer function color map should be fetched from the SoTransferFunction::colorMap field instead.

🚨 bestie listen: this is the classic oopsie. opaque everything = you only see the outer shell of your volume and you're like "where's my data 😭". hit reMap() and narrow that range. that's the fix. periodt.

⭐ SoMFFloat SoTransferFunction::colorMap

An array of floats describing the transfer function. Each value must be normalized to be within [0.0, 1.0] for the intensity value of a color, or the alpha value for transparency.

The array must contain 256 colors. The number of floats needed in the array for each color depends on the SoTransferFunction::ColorMapType setting.

[0.0, 1.0] means normalized, bestie. don't be out here passing 255.0 and wondering why it's giving chaos πŸ’€

✍️ Author ✍️

Generated automatically by Doxygen for SIMVoleon from the source code. (not a human, just a robot doing its lil thing πŸ€–πŸ’–)


okay that's the whole page, you ate it πŸ“ stay hydrated, normalize your floats, and remember: NONE means you are the color map now. slay πŸ’…βœ¨

SIMVoleon β€” Version 2.1.0 β€” SoTransferFunction(3) πŸ¦‹ bye bestie, go render something gorgeous πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from