Macro Modules
Chapter I: Basic Mechanisms of MeVisLab
Basic Mechanics of MeVisLab (Example: Building a Contour Filter)
In this chapter you will learn the basic mechanisms of the MeVisLab IDE. You will learn how to re-use existing modules to load and view data and you will build your first processing pipeline.
Loading Data
First, we need to load the data we would like to work on, e.g. a CT scan. In MeVisLab, modules are used to perform their associated specific task, they are the basic entities you will be working with. Each module has a different functionality for processing, visualization and interaction. Connecting modules enables the development of complex processing pipelines. You will get to know different types of modules throughout the course of this tutorial.
Example 2: Macro modules and Module Interaction
Example 2: Macro modules
Macro modules and Module Interactions via User Interface and Python Scripting
MeVisLab provides different types of modules, which can be distinguished by their color. The brown modules are called Macro modules. Macro modules condense a whole network into one module. You can open the internal network by pressing the middle mouse button or via right mouse click and select [ Help → Show Internal Network ]. Macro modules provide the possibility to create customized user interfaces and Python interactions.
Example 2.2: Creation of global macro modules
Example 2.2: Global macro modules
Introduction
In this chapter you will learn how to create global macro modules. There are many ways to do this. You can convert local macros into global macro modules or you can directly create global macro modules using the Project Wizard. In contrast to local macro modules, global macro modules are commonly available throughout projects and can be found via module search and under [ Modules ].
Example 2.3: Creation of module help
Example 2.3: Creation of module help
Generating help of a macro module is part of the video about macro modules from Example 2: Creation of global macro modules
Introduction
In this chapter, you will learn how to create a help page and an example network. For hands-on training, we will use the macro module Filter
, which was created in the previous chapter.
Example 2.4: GUI development
Example 2.4: Building a Panel Layout: Interactions with macro modules
Introduction
This chapter will give you an introduction into the creation of module panels and user interfaces. For the implementation you will need to use the MeVisLab Definition Language (MDL) .
Creating a panel for the macro module flilter
Creation of a module panel
In Example 2.2 we created the global macro module Filter
. By now, this module does not have a proper panel. When double-clicking
the module, the Automatic Panel is shown.
Example 2.5: Interactions via Python scripting
Example 2.5: Module Interactions Using Python Scripting
Introduction
This chapter will give you an overview over Python scripting in MeVisLab. Here, no introduction into Python will be given. However, basic knowledge in Python is helpful. Instead, we will show how to integrate and use Python in the MeVisLab SDK.
In fact, nearly everything in MeVisLab can be done via Python scripting: You can add modules to your network, or remove modules, you can dynamically establish and remove connections and so on. But, much more important: You can access module inputs and outputs, as well as module fields to process their parameters and data. You can equip user interfaces and panel with custom functionalities. Python can be used to implement module interactions. When you open a panel or you press a button in a panel, the executed actions are implemented via Python scripting.
Example 2.5.2: Module interactions via Python scripting
Example 2.5.2: Module interactions via Python scripting
Introduction
In this example, you will learn how to add Python scripting to your User Interface. The network used in Chapter V will be used for creating the macro module.
Steps to do
Creating the macro module
First, we condense the example network into a macro module and then we create a panel for that module. To create a macro module use the Project Wizard, which you find under [ File → Run Project Wizard ]. Select Macro module and press Run.
Example 3: Creating a simple application
Example 3: Creating a simple application
Introduction
In the previous examples, you already learned how to create macro modules, user interfaces and how to interact with your UI via Python scripting.
In this example, you will learn how to create a simple Prototype application in MeVisLab including a User Interface with 2D and 3D viewer. You will learn how to implement field listeners and react on events.
Steps to do
Create your network
Start with an empty network and add the Module ImageLoad
to your workspace. Then add a View2D
and View3D
to your workspace and connect the modules as seen below.
Step 2: Prototyping - Create a macro module
Step 2: Prototyping - Create a macro module
Introduction
In this example, we encapsulate the previously developed prototype network into a macro module for future application development and automated testing.
Steps to do
Make sure to have your *.mlab file from the previous tutorial available.
Package creation
Packages are described in detail in Example 2.1: Package creation. If you already have your own package, you can skip this part and continue creating a macro module.
Example 1: WebCam access with OpenCV
Example 1: WebCam access with OpenCV
Introduction
In this example, we are using the PythonImage
module and access your WebCam to show the video in a View2D
.
Steps to do
Creating the network to be used for testing
Add the modules to your workspace and connect them as seen below.
The viewer is empty because the image needs to be set via Python scripting.