13.2. Some Tips for Module Design

13.2.1. Macro Modules or C++ Modules?

Advantages of macros:

  1. Macros are useful for creating a layer of abstraction by hierarchical grouping of existing modules.

  2. Scripts can be edited on the fly:

    • no compilation and reload of the module database necessary

    • scripting possible on the module or network level

    • scripting supported by the Scripting Assistant View (basically a recorder for actions performed on the network)

Disadvantages:

With macros, only existing functionalities and algorithms can be used.

Conclusion:

  • For rapid prototyping based on existing image processing algorithms, use macros.

  • For implementing new image processing, write new ML or Open Inventor modules.

13.2.2. Combining Functionalities

It is possible to have ML and Open Inventor connectors in the same module. Two cases are possible:

  • Type 1: ML -> visualization: Image data or properties are displayed by a visualization module. Usually a SoSFXVImage field gets random access to an ML image by getTile(). Examples: SoView2D, GlobalStatistics.

  • Type 2: visualization -> ML: Modules generate an ML image from an Inventor scene. Examples: VoxelizeInventorScene, SoExaminerViewer (hidden functionality).

Generally, however, it is not always a good solution to combine that, as the processes of image processing and image visualization are usually separated.

Therefore, rather separate the ML and Open Inventor functionalities into two modules. This way,

  • functionality is encapsulated and can be reused as module

  • modules for the single steps may already be available in MeVisLab and spare you a new development

13.2.3. Tips for Module Testing

First, test your modules and networks with the MeVisLab TestCenter, see Chapter 16, Using the TestCenter for an introduction and the TestCenter Reference for further information.

After being done with the module and macro tests, make sure to stress your network's algorithms and processing speed by testing with

  • large data sets

  • images with anisotropic voxels

  • images with non-trivial world matrix (translated or rotated)

Many of the possible problems will only occur with these kinds of data.

In addition, keep in mind that modules

  • need to run platform-independent

  • should offer a well-designed panel for future users

  • should come with a useful help and example network