Open CASCADE Technology
6.7.0
|
|
A voxel is a sub-volume box with constant scalar/vector value. The object in voxel representation is split into many small sub-volumes (voxels) and its properties are distributed through voxels.
Voxels are used for analysis and visualization of 3D-dimensional distribution of data. Medicine (mainly, tomography), computational physics (hydrodynamics, aerodynamics, nuclear physics) and many other industries use voxels for 3D data visualization and analysis of physical processes.
To produce a voxel representation the 3D space is split by equal intervals along the main orthogonal coordinate axes to obtain nx x ny x nz voxels (small cubes):
The number of voxels used in a calculation can vary. An average model contains several tens of millions of voxels. Such a great amount of data requires special algorithms of computation, data containers keeping data in memory and visualization tools.
Open CASCADE Technology provides several basic data containers for voxels with fast access to the data and optimal allocation of data in memory.
Also, a special visualization toolkit allows visualizing voxels as colored or black/white points and cubes, displaying only the voxels visible from the user's point of view.
The data structure to store the voxels data is a special class which gives fast access to the data of each voxel and allocates the data in an optimal way in the memory of a computer.
Fast access to the data is provided by means of bit-wise operators on the indices of internal arrays.
The optimal data allocation is reached through division of the whole data set into data subsets and keeping only non-zero pieces of data in memory.
A voxel can contain different data types, but presently Open CASCADE Technology implements only several basic ones:
In addition, the data structures provide methods for calculation of a center point by voxel indices and a reverse task – fast search of a voxel by a point inside the cube of voxels.
There are two service classes implemented for data structures of voxels:
Fusion and cutting of two cubes of voxels are performed the class Voxel_BooleanOperations. The cubes should have the same size and be split into voxels in the same way.
A class Voxel_Convert converts a TopoDS_Shape into one of the voxel data structures filling the solid shape by non-zero values.
The algorithm of voxelization generates only 1-bit or 4-bit voxels. Other data types may be obtained by conversion of voxels from one type to another.
Voxelization of a shape is performed by means of computation of intersection points between lines filling the volume and triangulation of the shape. The lines are parallel to main orthogonal axes and can intersect the shape from different sides: along +X, +Y and/or +Z axes.
The algorithm can run in multi-threaded mode (the number of threads is unlimited). The user can see an integer value indicating the progress of computation.
Visualization of voxels is not a simple task due to a great amount of data used for 3D analysis.
Open CASCADE Technology allows visualization of a cube of voxels in two modes:
A degenerated mode displays only the points (boxes) visible from the point of view of the user for transformation operations (zoom, pan and rotate).
To focus on a particular part of the model non-relevant voxels can be erased. The displayed region is defined by six co-ordinates along X, Y and Z axes .
It is possible to display the voxels from a particular range of values (iso-volume):
It is necessary to include the files Voxel_VisData.h, VoxelClient_VisDrawer.h and VoxelClient_VisDrawer.cxx into the visualization library of the application (containing all files of OpenGl package) and call the method Voxel_VisDrawer::Init() from the application before the visualization of voxels.
A demonstration application has been created to show OCCT voxel models. This is a test demo application because it includes a set of non-regression tests and other commands for testing the functionality (accessible only through TEST pre-processor definition).
The File menu allows creation of canonical shapes (box, cylinder, sphere, torus) or loading of shapes in BREP format:
The menu Visualization offers two modes of visualization: Points and Boxes, allows defining the size of points and boxes (quadrangles), the minimum and the maximum displayed color, and the boundaries of the bounding box for displayed voxels:
In the future OPEN CASCADE plans to develop the platform of voxels in the following directions: