AlgorithmModule - Base class providing simplified ML module development


Implementing update behavior and status feedback as a field interface for ML modules is not easy for a developer. That's why so many ML modules differ in these points. Those differences in field interface and behavior makes it hard for MeVisLab users and application developers to handle modules.

The ML module base class AlgorithmModule helps to solve this problem and simplifies implementation of an algorithm with defined input and output values.

The class provides:

  • Already implemented update behavior and status feedback including field interface
  • Distinction between input and output fields
  • Interface methods for developers
  • Prepared MDL files to be included in module's .script file
  • Python TestSupport package: AlgorithmModuleTestSupport

Developer's ToDos when deriving from AlgorithmModule:

  • Complete wizard.
  • Fill prepared interface methods.
  • Finalize the TestCenter test.
  • Create .mhelp documentation file.
  • Finalize example network.


Conventions for field interface

The base class design brings some conventions for the field interface of a deriving module class. Developers have to pay attention to these conventions when implementing a module. Some of them are neccessary to make the C++ class design work and some affect the handling of the module inside MeVisLab that a user can rely on.

Naming convention

  • Input fields are clearly marked with prefix "in".
  • Output fields are clearly marked with prefix "out".

Interpretation convention

  • No distinction in module's reaction to changes of input object or parameter fields. Module will behave the same because they all are input fields.

Value changes convention

  • Input fields are not changed by the module, only the user is allowed to change their values.

Standardized field interface

Beside the above mentioned conventions of naming and handling of input and output fields the base class already provides a standardized field interface. These fields are completely handled by the base class and do not count to the responsibility of a deriving module class. This is an important part of the concept of the AlgorithmModule. At first it massively reduces implementation efforts and the probability of bugs on the developer's side. At second it creates a standardized field interface and behavior of such modules that a MeVisLab user can rely on.

  • to update module's output:
    • TriggerField 'update'
  • to clear module's output:
    • TriggerField 'clear'
  • to control behavior of module if any input field value changes:
    • EnumField 'onInputChangeBehavior'
      Values: "Update", "Clear"
  • to give feedback on module's status to user:
    • BoolField 'hasValidOutput'
    • EnumField 'statusCode'
      Values: "Ok", "Invalid input object", "Invalid input parameter", "Internal error"
    • StringField 'statusMessage'
  • to inform about finished update operation:
    • TriggerField 'updateDone'

Handles input field value changes

There is no need to implement the method virtual Module::handleNotification(). Because of the naming convention for input fields (prefix "in") the base class is able to handle input field changes automatically in its own implementation of method handleNotification(). According to set behavior an update or clear operation is initiated.

Provides developer interface methods

Interface methods:

Standardized look & feel GUI

MDL code file for include in Window section of module's .script file is provided.

Powerful module wizard

  • Code creation
  • Test creation