The Ray Casting description given here closely follows Levoy
[42]. Ray Casting is performed in a set of phases. The
first phase is data preparation. This stage begins with an array of
acquired raw values
at voxel locations
. The data preparation phase may include correction for
patient motion in CT data, contrast enhancement and/or interpolation of
additional samples.
The output of data preparation is an array of prepared values
. This array is used as input to the shading model.
The shading model associates with each position
, a color
using the model developed by Phong [43].
The interested reader is referenced to Levoy [42] for the
details on the shading model. In another phase, the classification
phase, an array of opacities
is associated with the
data. The classification is highly dependent on the kind of data being
visualized and the reader is referenced to Levoy [42].
At this point we are ready to cast rays into these two arrays from the
observer's eyepoint. For each ray a vector of sample colors
and opacities
is computed
by resampling the voxel database at K evenly spaced locations along
the ray and trilinearly interpolating from the colors and opacities at
the eight closest scalar values to each sample location. A fully
opaque background is draped behind the dataset and the resampled colors
and opacities are merged with each other and with the background by
compositing in back-to-front order to yield a single color for the
ray. The compositing calculations referred to above are simply linear
interpolations. The task just described is very time consuming because
for each sample along the ray, two (floating point) trilinear
interpolations will have to be performed.
The fastest implementations of this method are achieved by combining several common computer graphics techniques, like early ray termination, octree decomposition and adaptive sampling [42,7,8]. Early ray termination is a technique that can be used if the rays are traversed front-to-back. It simply ends the ray traversal after the accumulated color for that ray is above a certain threshold. Octree decomposition is a hierarchical spatial enumeration technique that permits fast traversal of empty space, thus saving substantial time in traversing the volume and calculating trilinear interpolations. Adaptive sampling tries to minimize work by taking advantage of the homogeneous parts of the volume, for each square in the image, one traverses the rays going out of the vertices of the bounding box and recursively goes down repartitioning this square into smaller ones if the difference in the image pixel value is larger than a threshold.