1.3.2. SoDataRange

The SoDataRange( C++ | Java | .NET ) node specifies the range of data values that should be mapped into the current color map (SoTransferFunction( C++ | Java | .NET )) using the min and max fields. It is ignored for RGBA volumes. For most scalar valued volumes SoDataRange( C++ | Java | .NET ) has two important uses. First it is usually necessary to specify the actual range of data values in the volume and second it can be useful to specify a different range of data values in order to adjust the brightness and contrast. The data range affects the rendering of all volume primitives.

Actual data range:

By default VolumeViz maps the entire range of the voxel's data type (e.g. 0..65535 for unsigned short values) into the colormap. This may be correct for byte (8 bit) valued voxels, but is seldom correct for 16 bit or larger voxels and never correct for floating point voxels. If the volume has a relatively small range of values relative to the data type, the default mapping will usually produce an image with very little detail visible. Remember that the actual range of data values, as well as the volume data type and other information can be queried using the SoVolumeData( C++ | Java | .NET ) methods described in Section 1.1.2, “VolumeViz Features”.

Brightness and contrast:

Usually the distribution of values within the actual data range is not uniform and more details can be seen by adjusting the SoDataRange( C++ | Java | .NET ) values to increate brightness and/or contrast. This is particularly true when using a gray scale color map (called INTENSITY in SoTransferFunction( C++ | Java | .NET )). In medical imaging this range setting is often called the window center and window width. The window center is the image intensity that will be displayed as a medium-gray and the window width is the range of data values between bright white and full black. Our example data volume contains byte data with a native range of 0 to 255. In the image on the left the default data range is used, so effectively the window center and width are 128 and 256. In the image on the right we’ve changed the window center and width to 65 and 90 to increase the contrast. We did that by setting the data range to 20..110.

Default data range compared to window center/width of 65/90.

Figure 1.23. Default data range compared to window center/width of 65/90.


By default voxel values are mapped so that all values less than or equal to min (the field) are assigned to the first entry in the color map, all values greater than or equal to max are assigned to the last entry in the color map and values in between are assigned to a color linearly interpolated between the two closest colors. You can change this behavior by setting the mapOnFullColorRange field to false. In this case all values less than min are assigned to the first color entry and the min value is assigned to the second color entry. Similarly all values greater than max are assigned to the last color entry and the max value is assigned to the next to last color entry. This mode is useful to assign “out of range” values to a specific color or to make all out of range values transparent.

When using multiple volumes, a single SoDataRange( C++ | Java | .NET ) node can be used to specify the data range for all volumes or each volume can have its own independent data range. In the second case create one SoDataRange( C++ | Java | .NET ) node for each volume and set each node’s dataRangeId equal to the SoDataSet( C++ | Java | .NET )::dataSetId of the corresponding volume.

[Important]

Changing the data range may require VolumeViz to recreate the data textures on the GPU. This is necessary to maximize use of the available bits of precision on the GPU. This operation could be slow for a large data set.