Defining, Saving and Viewing the Grid

Grid definition

The first command in most VoxelScript programs is the definition of the grid into which the geometric objects will be voxelized. The grid must be specified by its dimensions and properties:

     grid(x, y, z, dim, voxelType, colorType, profileType);

where

x,y,z
positive integers defining width, depth and height of the grid,
dim
dimension of the largest of x, y and z im meters,
voxelType
defines internal representation of voxel densities with possible values:
f3dUChar
8 bit unsigned voxels
f3dUInt16
16 bit unsigned voxels
f3dUFloat
float voxels.
Since 8 bit resolution is not sufficient to represent voxelized objects correctly (quantization error causing problems in normal estimation), the f3dUInt16 value is recommended,
colorType
defines if the grid is
VXT_MONO
monochromatic, which means that the densities are solely stored, and
VXT_COLOR
color, when an RGB attribute (8 bit resolution) is adder to each voxel.
profileType
defines, which surface profile is used for object representation:
VXT_LIN
a linear surface profile with default width 2 x 1.8 voxels. This profile is optimized for trilinear density reconstruction and central differences as gradient estimator. stored, and
VXT_GAUSS
a Gaussian surface profile with sigma = 1.0. This profile is narrower than the previous one (and thus enables sharper edges and thinner surfaces), but needs more expensive density reconstruction by tricubic interpolation and Gabor filter for gradient estimation.

A simplified command

     grid(x, y, z);

is equivalent to

     grid(x, y, z, 1.0, f3dUChar, VXT_MONO, VXT_LIN);

There is a coordinate system attached to the grid, with origin in its center, which is used for object voxelization.

The grid command can be repeated in the same script. In that case, the existing grid is del;eted and a new one is created from the scratch.

Grid saving

The grid can be save into a f3d file by the save command:

     save("fileName");
where fileName is name of the file (without the f3d suffix). In fact, three files are created:
fileName.f3d
the density grid
fileName-c.f3d
the color grid, in the VXT_COLOR case, and
fileName-d.f3d
a distance grid. Each voxel contains distance to the nearest surface point (chessboard distance), which one can take advantage of during some visualization techniques, as, e.g., ray tracing.

The alternative to the save command

     saveCropped("fileName");
crops the 0 density areas, thus making the grid smaller.

Grid preview

The

     saveCropped("fileName.ppm");
command gives an idea, how does the volumetric scene look like. There are three orthonormal views of the scene:
      -------------------
               |               
          A    |               A:  -Z direction (perpendicular to slices)
               |
      -------------------      B:  -Y direction (along columns)
               |
          B    |    C	       c:   X direction (along rows)
               |
      -------------------

The A view is the same, as the preview of the f3d file, except of the rendering technique involved: surface rendering with thresholding is used in A, B and C, while reprojection is used in f3d files.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de