Macro modules are implemented by means of the MeVisLab Definition Language (MDL) and the scripting language Python. A macro module behaves like any other elementary module in MeVisLab (ML or Inventor). However, no C++ has to be coded to implement a macro module.
Like any other module, a macro module has to be declared within the MeVisLab module database in a module definition
*.def), which has to be located in the
User Package Path.
The MDL script implementation of a
macro module, that is its interface definition (input-, output-, and
parameter fields) as well as its GUI definition, usually are written in a
*.script file. The scripting is given
*.py files which need to be included
*.script module definition file.
The definition of a macro module and the creation of all necessary files is supported by the ML Module Wizard, via File → Run Project Wizard (see the next chapter Chapter 10, Developing a Macro Module for an Applicator).
What you should know about macro modules:
In most cases, macro modules encapsulate the “macro
behavior” of an image processing and/or visualization pipeline
(realized by a MeVisLab module network). Its
functionality is defined by the macro module
interface with inputs, outputs, and parameters (fields).
The interface is built as a combination of the interface elements of the
modules in the underlying network, and of eventually new fields. The encapsulated module network is
stored in a
<MacroModuleName.mlab> file, which is also called the macro network of
Why this encapsulation?
In many cases, a desired module function can be built by connecting some elementary modules or macros that are already implemented.
Certain processing pipelines may be of common use in a variety of further applications and it is convenient to encapsulate them in macro modules which can then be added easily to any network.
The interface of an encapsulating macro module is more compact than the sum of all interfaces of the contained modules.
Macro modules are defined on an abstract level. They can and do exist
stand-alone without a corresponding macro network. In those
cases, the module's functionality is implemented with scripting only.
In most cases those macro modules encapsulate dynamic user interfaces
without any image processing or visualization behind it. Examples for those modules are the
MDL test modules, for example
TestBoxLayout. They consist only of
*.script files without any internal module network.
Macro modules can also be defined locally to a given network
document path, called 'Local Macro Modules'. These are used in complex
networks to encapsulate subnetworks as independent functional
units with a defined interface to other network components. Such local
macros often carry out an application specific function which would not be
of common use for any other application, and are therefore not added to the common MeVisLab module database (that is they are
not declared in / do not possess a
Local macros are created and added with respect to the current network via the menu bar, File → Create Local Macro and File → Add Local Macro.
You can also convert a group to a (local) macro via the group's context menu.
© 2021 MeVis Medical Solutions AG