1.7.4. Voxel mask clipping

The SoVolumeMask( C++ | Java | .NET ) node specifies an arbitrary voxel-based region of a volume data set (SoVolumeData( C++ | Java | .NET )). A volume mask is itself a data volume consisting of binary values. Zero values are "false" and non-zero values are "true". A large number of masks may be defined simultaneously, using an SoVolumeMask( C++ | Java | .NET ) node for each one, and mask regions may overlap if desired.

SoVolumeMask( C++ | Java | .NET ) is derived from SoVolumeData( C++ | Java | .NET ). Like SoVolumeData( C++ | Java | .NET ) it accesses its data through an SoVolumeReader( C++ | Java | .NET ) class. I.e. the data may be in a file or in memory (or any data source using a custom volume reader). The mask volume can be any data type, but unsigned byte is currently the most memory efficient representation.

SoVolumeMask( C++ | Java | .NET ) nodes must follow these rules:

Currently SoVolumeMask( C++ | Java | .NET ) nodes only affect volume rendering (SoVolumeRender( C++ | Java | .NET )). They do not affect slice rendering or other VolumeViz primitives.

SoVolumeMask( C++ | Java | .NET ) can be used to clip the data volume on a per-voxel basis. But the mask mechanism is much more powerful than that. Each region can have its own transfer function (color map) using SoTransferFunction( C++ | Java | .NET ) nodes. Each region can also have its own draw style (volume rendering, isosurface or boundary) using SoVolumeDataDrawStyle( C++ | Java | .NET ) nodes. Each region, including the original unmasked volume, is only visible if there exists a transfer function (SoTransferFunction( C++ | Java | .NET )) with the same id value.

Mask regions:

A single SoVolumeMask( C++ | Java | .NET ) node effectively defines two regions:

Because intersecting regions are allowed, two SoVolumeMask( C++ | Java | .NET ) nodes define (up to) four regions:

Each additional mask defines one additional region (voxels that are true only in that mask).

In addition, if there exists a transfer function with the same id as the original volume (SoVolumeData( C++ | Java | .NET ) node), the color value from that transfer function is combined with the color value from the mask region's transfer function.

Transfer functions:

A separate transfer function can be specified for each of these regions using SoTransferFunction( C++ | Java | .NET ) nodes. The transfer function nodes may be placed under the SoVolumeMaskGroup( C++ | Java | .NET ) node, but this is not required.

Draw Styles:

A separate draw style can be specified for each mask region and for the intersection voxels (but not for false voxels) using SoVolumeDataDrawStyle( C++ | Java | .NET ) nodes: