Chapter 7. Registered Voxel Data Types

Table of Contents

7.1. Overview of Registered Voxel Data Types
7.1.1. Registered Voxel Data Types
7.1.2. About Standard, Default and Registered Voxel Types
7.2. Implementing Image Processing on extended Voxel Data Types
7.2.1. Important Functions For Voxel Types
7.2.2. The Basic Concept of Calculating the Output SubImage
7.2.3. Examples with Registered Voxel Types
7.2.4. Compile and Runtime Decisions on Standard and Registered Voxel Types
7.2.5. Handling Generalized Registered Voxel Types as Module Parameters
7.3. Limitations of Registered Data Types
7.4. Traps and Pitfalls When Using Registered Voxel Types
7.5. Advanced Issues on Registered Voxel Types
7.5.1. About the Difference Between Scalar, Extended and Registered Voxel Types
7.5.2. Getting and Managing Metadata About Registered Voxel Types
7.5.3. Reducing Generated Code and Compile Times
7.5.4. Configuration of Supported Voxel Types
7.5.5. Implementing a New Voxel Data Type by Deriving from MLTypeInfos

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.

7.1. Overview of Registered Voxel Data Types

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.

Application areas for new voxel types could be vector field processing, color voxel filters, voxels with segmentation information (like bit fields, object indices, etc.), matrix/tensor images, complex numbers, quaternions, strings as voxels and many more.

7.1.1. Registered Voxel Data Types

The following voxel types are already registered in the ML:

    • complexf, and

    • complexd.

    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.

    • quaternionf, and

    • quaterniond.

    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.

    • vecf2 and vec2,

    • vecf3 and vec3,

    • vecf4 and vec4,

    • vecf5 and vec5,

    • vecf6 and vec6,

    • vecf7 and vec7,

    • vecf8 and vec8,

    • vecf9 and vec9,

    • vecf10 and vec10,

    • vecf16 and vec16,

    • vecf32 and vec32, and

    • vecf64 and vec64.

    These voxel types as well as some other specializations of the 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.

    • matf2 and mat2,

    • matf3 and mat3,

    • matf4 and mat4,

    • matf5 and mat5, and

    • matf6 and mat6.

    These matrix voxel types are implemented in the ML as a template class 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.

[Note]Note

The standard data types MLuint8, MLint8, MLuint16, MLint16, MLuint32, MLint32, MLint64, MLfloat and MLdouble are also registered for the sake of completeness. Thus it is possible to request their type properties as with all the other registered data types.

The type information for the standard types are implemented in the ML as specializations of the template class MLTStdTypeInfos.

7.1.2. About Standard, Default and Registered Voxel Types

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.