Transfer Functions

Summary

 

In a volumetric rendering application, an image is generated by shooting rays of light into the volume. As each light ray passes through the voxels making up the volume, a portion of the ray's energy is reflected back to the camera at each sampling point along the ray's travel path. The color and amount of reflected energy depends on each voxel's color and opacity. Eventually all the ray's energy is reflected back, yielding a final color for the ray, and making up the pixels of the final rendered image.

 

A transfer function maps each voxel in the dataset to a color and opacity value based on the radiographic visibility (density) of the underlying voxel. The transfer function therefore determines how the image is rendered, what structures in the dataset are visible, and what colors are used to render the various tissue and/or material types making up the dataset.

 

The F.A.S.T. Cloud SDK can support up to 256 simultaneous transfer functions, though most F.A.S.T. Cloud SDK distributions support up to eight transfer functions. Generally, fewer than eight transfer functions are sufficient for most visualization applications. Through segmentation, groups of voxels in the dataset can be associated with different transfer functions.

 

Each transfer function can have up to eight independent render ranges, each render range can have up to fifty control points.

 

The Transfer Function

TF_Example1
Figure 1: A simple transfer function.

 

The image in Figure 1 is taken from the transfer function editor from the Fovia Workstation application, and describes a simple transfer function. The horizontal axis in the image represents the scalar field values of the dataset. The values to the right equal more dense material and values to the left equal less dense material.

 

For example, in the case of CT data, the higher values (to the right) correlate with more dense material and values to the left correlate with less dense material. This is because the more dense material absorbs more X-Ray energy than the less dense material. In a CT scan, values to the right equal denser material like bone, while values to the left equal less dense material like soft tissue and skin. The vertical axis determines the opacity/translucency of voxels in the dataset. The bottom of the figure represents 0% opacity (100% transparent), the top of the figure represents 100% opacity. The gray histogram shows how many voxels of a given scalar value exist in the dataset. The two white dots make up a single render range and designate the color and position of the control points making up the transfer function. For this particular dataset, the position of the two control points corresponds to Hounsfield values (or other dataset units) of approximately 850 and 2250. Since the two control points are about halfway up the vertical axis of the chart, they represent opacity values of ~50%. The control points have been set to white, designating the color of the voxels within the HU 850 to HU 2250 range. Therefore, this transfer function maps all voxels with HU values between 850 and 2250 to white (RGB 255, 255, 255) and 50% opacity. All voxels outside this range are totally transparent and do not make any contribution. The resulting dataset image can be seen in Figure 2.

 

TF_Example1_Skull

Figure 2: A dataset rendered with

the transfer function from Fig 1.

 

The images in Figures 3 and 4 show two different, slightly more complex transfer functions, with a single render range of six control points of varying opacity and color. In Figure 4, control point B has been raised slightly. This increases its opacity, and therefore increases the color contribution of voxels at or near that scalar value in the dataset. Figures 5 and 6 show a region of a sample dataset rendered with the transfer functions shown in Figures 3 and 4. The increased opacity of control point B in Figure 4 is evident in the darker orange color in Figure 6.

 

TF_Example2
Figure 3: Control point B lower opacity.
TF_Example2b
Figure 4: Control point B higher opacity.
TF_Example2_Mat
Figure 5: Control point B lower opacity.
TF_Example2b_Mat
Figure 6: Control point B higher opacity.

 

A transfer function may have multiple continuous ranges of control points. Each transfer function can support up to eight separate render ranges, and each render range can support up to fifty control points. Figure 7 shows a transfer function with two separate render ranges. Control points in a transfer function also support a lighting state flag. The lighting state affects all voxels at that control point's scalar value up to the right-next control point. Thus, the lighting state for each interval between control points is determined by the left control point. Figures 8 and 9 show transfer functions with lighting turned off for some control points. Control points with a thick white border have lighting applied, control points with a thin black border do not have lighting applied. Control points in a transfer function also support a lighting state flag. The lighting state “ON” determines the usage of scalar field gradients for the calculation of the rendered image. Setting the lighting state to "ON" is useful for areas with surface-like structures (a coherent and rapid change of value of scalar field). Soft tissues are especially noisy and may contain foam-like data. It is often is more efficient and informative to render these soft tissues with the lighting state set to "OFF".

 

TF_Complex1

Figure 7: A transfer function with two render

ranges and different lighting states.

TF_Complex2

Figure 8: A transfer function with

different lighting states.

 

The opacity value of a given voxel indicates the percentage of the ray's energy that will be absorbed as the ray passes through the voxel, measured in increments of 1/16 of a dataset unit (usually millimeters). For example, if a voxel's opacity is 100% then after traveling 1/16th of a unit into the voxel, 100% of the ray's energy will be absorbed. If a voxel is 50% opaque and the ray travels horizontally through the center of the voxel, after the first 1/16th of a unit, 50% of the ray's energy will remain. After the next 1/16th of a unit, 25% of the energy will remain. Another 1/16th will leave 12.5%, and so on. When ray energy is absorbed it is converted to color based on the voxel's color value which is determined by the transfer function. Ray energy will be absorbed until so little energy remains that it can no longer contribute to the ray's color value. At this point the ray is considered to be 100% absorbed. For example, if a given ray has 100% of its original energy and it enters a voxel of 50% opacity, after passing 8/16th's (1/2) of a unit into the voxel then only 0.39% of it's energy will remain. Since RGB color is measured on a 0 to 255 scale, this will correlate to just under 1 color unit (0.39% 255 =  0.99). At this point all the ray's energy will have been converted to color and the ray will stop. Note that the distance that a ray actually travels through a voxel depends on the angle at which a ray enters the voxel.

 

Consider the image in Figure 9. The first voxel has an opacity value of 0%, so no ray energy will be absorbed, regardless of the voxel's color. The next voxel is blue and 10% opaque. When the ray has finished traveling through the voxel, 18.5% of the energy will remain. The other 81.5% of the ray's energy will have been converted to blue, so its RGB color value will be (0, 0, 207) (81.5% 255 = 207). The next voxel is green and 100% opaque. After traveling 1/16 of a unit into the voxel the remaining 18.5% of the ray's energy will be absorbed and converted to green, and the ray's color value will be (0, 47, 207) (18.5% * 255 = 47).

 

Raycast

Figure 9: Ray traversal and absorption.

 

Implementation Considerations

 

The speed with which the F.A.S.T. Cloud SDK can render images is in large part dependent on the complexity of the transfer functions in effect. Consider the following issues when designing a transfer function:

 

Translucent voxels are considerably more computationally complex to render then completely opaque voxels. If a ray has to traverse many voxels with low opacity it will be more computationally intense to calculate that ray's color. Therefore, it is recommended to avoid unnecessary use of transfer function settings with low opacity.

 

Turning off lighting for transfer function control points will significantly accelerate rendering. This is because the normal gradients at the dataset's virtual surface can be ignored. The rendering algorithm therefore does not need to traverse the entire octree down to individual voxels. Consequently, it is recommended to turn off lighting for transfer function control points where not necessary.