Get Teem at SourceForge.net. Fast, secure and Free Open Source software downloads
teem / mite

  Overview of miter options

Miter needs six kinds of information to make a rendering:
  1. Volume input, image output
  2. Camera and image information
  3. Lighting and surface properties
  4. Kernels used in filtered sampling
  5. Ray and compositing parameters
  6. Transfer functions
All of these are communicated to miter with various command-line options. All the command-line parsing is done by hest.

One very useful capability of hest is its support for "response files": text files that contain command-line options, especially those that aren't changing between multiple invocations of the same command. Response files can have multiple lines, with comments, to help clarify what information is being communicated. See a basic miter demo for an example of response file usage.

1. Volume Input, Image Output

Miter can render 3-D scalar data of any type, from unsigned char up to double. The output of miter is a four-channel RGBA image of floats, usually saved as a nrrd. Storing the opacity channel allows you to composite the rendering over different colors or patterns. Using floating point ensures that operations like gamma correction can be done without any visual artifacts.

The teem program overrgb is the best way to convert the floating point RGBA output of miter into an 8-bit RGB image suitable for publication or the web.

2. Camera and Image information

The volume being rendered by miter is always centered at the origin in world-space, inscribed in a bi-unit cube from -1 to 1 along the X, Y, and Z axes. Any non-isotropic voxels in the volume affects its aspect ratio and how it is inscribed in this cube, but the world space around the cube is of course independent from voxel spacings.

Miter uses the same set of command-line options for camera information as other teem programs. There are unfortunately many different variables that must be set in order to completely define the camera. All of them use two letter flags. All (<X> <Y> <Z>) coordinates are in world coordinates.

Hest's "response files" come in especially handy with dealing with the many camera parameters.

3. Lighting and surface properties

For now, miter supports exactly one light, and it is always white. All you can control is its direction, or rather, its "location", which is actually extended out to infinity in order to create a directional light. Furthermore, you can only specify the light location in view-space, not world-space. This is done with the "-ld" option:

Miter supports the Phong lighting model, which gives you a few parameters to vary:

Except for specular power ("-sp"), all these numbers are intended to vary from 0.0 to 1.0 (but you can set them to whatever you want). For the sake of simplicity, the ka, kd, ks values do not vary with the red, green, and blue channels. The idea is that the transfer function assigns an intrinsic material color, which in visualization contexts is apt to vary across the surface. The Phong shading parameters determine the surface appearance, and they are less apt to vary over the surface.

4. Kernels used in filtered sampling

The benefit of using gage for all volume measurements is that you can get very high quality filtered sampling of the volume. Gage uses seperable convolution of the original data values with various continuous kernels in order to measure the values and derivatives that are needed for the transfer function domain variables, and for shading. Nothing is pre-computed- all quantities are computed de novo at each sample point along the ray.

For all this to work, you have to choose a set of kernels to use for the convolution based measurements. Signal processing tells us that the choice of kernel can have a big effect on the quality of the resulting measurements, so some prior knowledge on your part is assumed here. The kernels used here come from nrrd:

The kernel specifications is of the same form as used for unu resample, and many different kernels are possible. However, this combination of kernels is quite useful:
-k00 cubic:0,0.5 -k11 cubicd:1,0 -k22 cubicdd:1,0 
The "cubic" kernels are the BC-family of cubics described by Mitchell and Netravali. "-k00 cubic:0,0.5" specifies that the Catmull-Rom kernel be used for interpolating data values. "-k11 cubicd:1,0" specifies that the first derivative of the B-spline kernel be used for measuring first derivatives, and similarly "-k22 cubicdd:1,0" says that the second derivative of the B-spline kernel should be used for measuring second derivatives.

Even if the transfer function does not require any second derivative information, there is no harm in specifying it.

5. Ray and compositing parameters

Because this is a ray-casting volume renderer, you need to set parameters describing the sampling along the ray and the compositing of those samples.

6. Transfer functions

Last but not least, the transfer function has to be specified in order to make a volume rendering. Mite uses seperable transfer functions of arbitrarily high dimension. That is, you give mite a list of transfer functions (however many you want), each of which specifies some number of optical properties as a function of some number of locally measured data properties: Mite will use the multiplicative product of all those transfer functions in the rendering. In practice, the dimension of the individual transfer functions is at most two. One current limitation is that the individual transfer functions ware only lookup tables: not even linear interpolation is supported.

As one might guess, Nrrds are used to represent transfer functions. There are some specific conventions for how the domain and range of the transfer function are encoded in the nrrd; these are described here.

The first axis in the nrrd always encodes the range of the transfer function. Whether the range of the transfer function is a single scalar (such as opacity), or a list of scalars (such as RGB color), the first axis of the nrrd is reserved for describing the transfer function range. Thus, the dimension of the nrrd is always one greater than the dimension of the transfer function. A transfer function which assigns opacity as a function of one quantity (data value) is a one-dimensional transfer function, but it is represented with a two-dimensional nrrd, for which the size of the first axis (axis 0) is 1. The quantities in the range of the transfer function are specified in the label of axis zero, according to a cryptic set of single-letter codes:

The number of samples along axis zero has to exactly match the number of characters in the axis zero label. For transfer functions which assign only opacity, the axis zero label will be "A", and the number of samples along axis zero will be one.

The remaining dimensions of the nrrd give the domain of the transfer function, one dimension per transfer function domain variable. Two pieces of information need to be set along an axis in order for mite to understand it as a transfer function domain variable. First, the axis min and axis max fields have to be set to the minimum and maximum value of the domain variable that is handled by the lookup table. Measured values outside this range are clamped to the range.

Second, the axis label identifies which quantity is used for that axis of the transfer function. Mite will measure this quantity, clamp it to the interval of domain values given by the axis min and max, and then perform the lookup into the transfer function table. The domain variable quantities are essentially every scalar that gage knows how to measure in a scalar field, combined with some other numbers that mite computes for you along each ray.

For example, a rendering of unsigned 8-bit data might use a single transfer function, giving opacity as a function of data value. The two-dimensional nrrd used for this has an axis[0] label of "A". On axis[1], the min and max are probably 0 and 255 respectively, and the axis[1] label is "gage(v)".