Table of Contents
Chapter Objectives
This chapter gives an introduction to programming, implementing and registering user-defined data types for voxels:
See Section 7.2.3, “Examples with Registered Voxel Types” for code examples.
ML modules normally implement algorithms on integer or floating
point typed voxels, such as MLint8
,
MLuint16
or MLfloat
. To
support all these types, the image processing parts of ML modules
algorithms normally use templates. Modules can also support other, extended data types like Vector3 or Matrix3, but it is not very efficient to use the template mechanism if a module is to support any extended voxel type. In this case a module should not use the types directly but rather use the type operations table that is registered for every type supported by the ML.
Using these tables is somewhat cumbersome, but is the only way to support types that are not even registered yet.
This means:
The number of registered voxel types is potentially unlimited.
A programmer can add his own voxel types.
An image processing algorithm can also use explicit voxel types without use the type operation tables which is less universal, but usually faster, because the compiler can do more optimizations.
Operations that are defined on the SubImage class make use of the registered types.
The following voxel types are already registered in the ML:
Complex numbers use float and double floating
point arithmetics. They make the standard C++ complex data type
available and are implemented in the ML as a template class
MLTComplexTypeInfos
in
project MLTypeExtensions
.
Quaternions use float and double floating point
arithmetics. They make the quaternion data type (from project
MLLinearAlgebra
) available and are
implemented in the ML as a template class MLTQuaternionTypeInfos
in
project MLTypeExtensions
.
ScalarVectorTemplate
(from project MLLinearAlgebra
) for higher
vector dimensions and for float and double data types. They are
implemented in the ML as specializations of the template class
MLTDoubleVectorTypeInfos
in project
MLTypeExtensions
.MLTMatrixTypeInfos
in project
MLTypeExtensions
. The used base types can be
found in the project
MLLinearAlgebra
..For the registration of these classes, the class TypeInfosBase
has been implemented in the project
MLTypeExtensions
.
There are different voxel types sets in the ML.
Scalar Voxel Types
Standard voxel types are the "normal" data types. They are available in many programming languages, such as signed and unsigned 8, 16, 32 and/or 64 bit sized integers, float and double types. They are also the most typical types used for image voxels.
Default Voxel Types
The default voxel types contains besides the scalar voxel types also some selected extended voxel types. These are std::complex<float>
, std::complex<double>
, Vector2f
, Vector2d
, Vector3f
, Vector3d
, Vector6f
, Vector6d
, Matrix2f
, Matrix2d
, Matrix3f
and Matrix3d
. This should cover the most common uses e.g. for tensor imaging or complex typed voxels.
Registered Voxel Types
Registered voxel types are loaded to the application code at runtime. Each registered type provides a function table with basic functions for data addition, subtraction, multiplication, shift and so on.
See Section 7.5.1, “About the Difference Between Scalar, Extended and Registered Voxel Types” for a detailed voxel type discussion.
© 2024 MeVis Medical Solutions AG