2.5. APIs and Classes for Interfaces and Voxel Type Extensions

2.5.1. How Applications and the ML Work

An easy way to use the ML is just to link the C-API (Section 6.3, “mlAPI.h”) of the ML. Functions are available to create and delete modules, to set and get their parameters (fields), to connect them and to request images from their outputs.

Example:

Requesting image data from a module causes the following (as shown in Fig. 2.4):

  • The Host starts to determine the image areas needed by Viewer and breaks the area down into pages.

  • For each page, the Host determines the input data the Filter needs for output calculation.

  • The Loader requests the data (as a set of pages) and composes the correct input data for the Filter.

  • The Filter is called to calculate the output page.

  • When Filter has calculated the correct output pages, they are composed to the correct image data to be used by the Viewer.

  • All pages of all modules are stored in the cache of the MLMemoryManager if there is enough space.

2.5.2. The C-API

The C-API (C-Application Programming Interface) is an interface to most C++ functionality of the ML which can be linked in standard C mode. Thus programs and applications not written in C or C++ can link and use the ML if they support standard C linkage. Also, the C-API is more stable, because it is less frequently modified than the C++ interface.

2.5.3. Registering and Using Self-Defined Data Types

The ML supports a set of standard data types for image voxels (8,16,32,64 bit integer types and float, double) (see Section 6.5, “mlTypeDefs.h”) as well as so-called extended data types (see Chapter 7, Registered Voxel Data Types and Section 7.5.5, “Implementing a New Voxel Data Type by Deriving from MLTypeInfos”) which permit the usage of self-defined or augmented data types. It is not necessary to recompile the ML for these data types, but modules might need to be adapted depending on how they were written. A structure describing the data type, its properties, and operations can be registered in the ML to activate a new type.