Tutorial

Introduction to MeVisLab

Tutorial Introduction

Welcome to MeVisLab!

More than 20 years of experience and the continuous implementation of adaptations made MeVisLab one of the most powerful development platforms for medical image processing. Several applications and their prototypes are based on and could be realized because of MeVisLab, including software assistants for neuro-imaging, dynamic image analysis, surgery planning, and cardiovascular analysis.

MeVisLab is a development environment for rapid prototyping and product development of medical and industrial imaging applications. It includes a Software Development Kit (SDK) and an ApplicationBuilder for deploying your applications to end-customers.

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 1: Data import in MeVisLab

Example 1: Data Import in MeVisLab

MeVisLab provides several pre-defined modules to import data for processing in your networks.

These chapters explain the data formats and modules related to this example:

Example 1.1: MeVisLab Coordinate Systems

Example 1.1: MeVisLab Coordinate Systems

Three coordinate systems exist next to each other:

  • World coordinates
  • Voxel coordinates
  • Device coordinates

World coordinate systems in MeVisLab are always right handed.

The blue rectangle shows the same region in the three coordinate systems.

Coordinate Systems in MeVisLab

Coordinate Systems in MeVisLab

World coordinates

World coordinates are:

  • Global: Combine several objects in a view
  • Isotropic: All directions are equivalent
  • Orthogonal: Coordinate axes are orthogonal to each other

The origin of the world coordinate system can be anywhere and is not clearly defined. Origins of the other coordinate systems can always be mapped to the world coordinate system. In case of DICOM images, this mapping is defined by DICOM tags.

Example 1.2: DICOM Coordinate Systems

Example 1.2: DICOM Coordinate Systems

General

Coordinate systems in DICOM are basically the same as world coordinates in MeVisLab (except for the 0.5 voxel offset). World coordinates also refer to the patient axes. They are:

  • Based on the patient’s main body axes (transverse, coronal, sagittal)
  • Measured as 1 coordinate unit = 1 millimeter
  • Right-handed
  • Not standardized regarding their origin

World Coordinates in Context of the Human Body

World Coordinates in Context of the Human Body

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 Middle Mouse Button / Mouse Wheel or via right mouse click Right Mouse Button and select [ Help → Show Internal Network ]. Macro modules provide the possibility to create customized user interfaces and Python interactions.

Example 2.1: Package Creation

Example 2.1: Package creation

Introduction

Packages are the way MeVisLab organizes different development projects.

Macro modules and projects are stored in packages. If you like to create a global macro module, you need a package in which this macro module can be stored in. In this chapter, we will create our own package. We start our package creation by creating a package group, because every package needs to be stored in a package group. You can find detailed information about packages and package groups here and in the package documentation .

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 Left Mouse Button 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.1: The module RunPythonScript

Example 2.5.1: The module RunPythonScript

Introduction

The module RunPythonScript allows to execute Python scripts from within a MeVisLab network. You can draw parameter connection from modules to RunPythonScript and back, to process parameter fields using Python scripting.

Steps to do

Develop your network

In this example, we like to dynamically change the color of a cube in an Open Inventor scene. For that, add and connect the following modules as shown.

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.

Example 4: Installing additional Python packages using the PythonPip module

Example 4: Installing additional Python packages using the PythonPip module

Introduction

MeVisLab already comes with a lot of integrated third party software tools ready to use. Nevertheless it might be necessary to install additional Python packages for your specific needs. This example will walk you through the process of adding packages through usage of/using the PythonPip module.

The PythonPip module allows to work with the Python package manager pip. It can be used to install Python packages into the site-packages of the MeVisLab Python installation.

Chapter II: Open Inventor

Open Inventor modules

Introduction

In total, there are three types of modules:

  • blue ML modules
  • brown macro modules
  • green Open Inventor modules

The names of Open Inventor modules start with the prefix So\* (for Scene Objects). Open Inventor modules process and render 3D scene objects and enable image interactions. Scene objects are transmitted using the semi-circle shaped input and output connectors. With the help of these modules, Open Inventor scenes can be implemented.

Example 1: Open Inventor Objects

Example 1: Open Inventor Objects

Introduction

In this example we like to construct an Open Inventor scene in which we display three 3D objects of different color and shape.

Steps to do

Generating Open Inventor Objects

First, add the modules SoExaminerViewer and SoCone to the workspace and connect both modules as shown. The module SoCone creates a cone shaped object, which can be displayed in the Viewer SoExaminerViewer.

Example 2: Mouse interactions in Open Inventor

Example 2: Mouse interactions in Open Inventor

Introduction

In this example, we implement some image or object interactions. We will create a 3D scene, in which we display a cube and change its size using the mouse. We also get to know another viewer, the module SoExaminerViewer. This viewer is important. It enables the rendering of Open Inventor scenes and allows interactions with the Open Inventor scenes.

Example 3: Camera Interactions in Open Inventor

Example 3: Camera Interactions in Open Inventor

Introduction

In this example, we are learning the basic principles of camera interactions in Open Inventor. We will show the difference between a SoRenderArea and a SoExaminerViewer and use different modules of the SoCamera* group.

The SoRenderArea module

The module SoRenderArea is a simple renderer for Open Inventor scenes. It offers functionality to record movies and to create snapshots, but does not include an own camera or light.

Example 4: Post Effects in Open Inventor

Example 4: Post Effects in Open Inventor

Introduction

Up to this point, we practiced constructing Open Inventor scenes and placed three-dimensional Open Inventor objects of different colors and shapes within them. In this tutorial, we will go over the steps to add shadows to our 3D-objects, make them glow and vary their opacity to make them transparent. We will also incorporate WEMs from multi-frame DICOMs and render them as scene objects to see how different post effects can be used on them.

Chapter III: Visualization

Visualization in MeVisLab

Introduction

Images and data objects can be rendered in 2D and 3D and interacted with in several ways using a set of tools available through MeVisLab. In this chapter in particular, we will focus on simple image interaction with two- and three-dimensional visualizations.

View2D and View3D

An easy way to display data and images in 2D and 3D is by using the Modules View2D and View3D. What can be done with these viewers?

Example 1: Synchronous view of two images

Example 1: Synchronous view of two images

Introduction

In this example we like to use the module SynchroView2D to be able to inspect two different images simultaneously.

The module SynchroView2D provides two 2D viewers that are synchronized.

As in Tutorial Chapter 1 - Basic Mechanics of MeVisLab, the processed and the unprocessed image can be displayed simultaneously. Scrolling through one image automatically changes the slices of both viewers, so slices with the same slice number are shown in both images.

Example 2: Creating a magnifier

Example 2: Creating a magnifier

Introduction

Medical images are typically displayed in three different viewing directions (see image): coronal, axial and sagittal.

Using the Viewer OrthoView2D you are able to decide, which viewing direction you like to use. In addition to that, you have the opportunity to display all three orthogonal viewing directions simultaneously. Here, we like to display an image of the head in all three viewing directions and mark positions in the image.

Example 3: Image Overlays

Example 3: How to blend images over each other

Introduction

In this example we will show you how to blend a 2D image over another one. With the help of the module SoView2DOverlay we will create an overlay, which allows us to highlight all bones in the scan.

Steps to do

Develop your network

Start this example by adding the shown modules, connecting the modules to form a network and loading the example image Bone.tiff.

Example 4: Display 2D images in Open Inventor SoRenderArea

Example 4: Display images converted to Open Inventor scene objects

Introduction

In the previous example you learned how to use the module SoView2DOverlay together with a View2D. MeVisLab provides a whole family of SoView2D* modules (SoView2DOverlay, SoView2DRectangle, SoView2DGrid, …). All these modules create or interact with scene objects and are based on the module SoView2D, which can convert a voxel-image into a scene object. In this example, you will get to know some members of the SoView2D-family.

Example 5: Volume rendering and interactions

Example 5: Volume rendering and interactions

Introduction

In this example we like to convert a scan of a head into a 3D scene-object. The scene-object allows to add some textures, interactions and animations.

Steps to do

Develop your network

Implement the following network and open the image $(DemoDataPath)/BrainMultiModal/ProbandT1.tif.

SoGVRVolumeRenderer

SoGVRVolumeRenderer

The module SoGVRVolumeRenderer allows volume rendering of 3D and 4D images.

Example 6: MeVis Path Tracer

Example 6: MeVis Path Tracer

Introduction

The MeVis Path Tracer offers a Monte Carlo Path Tracing framework running on CUDA GPUs. It offers photorealistic rendering of volumes and meshes, physically based lightning with area lights and soft shadows and fully integrates into MeVisLab Open Inventor (camera, depth buffer, clipping planes, etc.).

PathTracer1

PathTracer1

Example 6.1: Volume Rendering vs. Path Tracer

Example 6.1: Volume Rendering vs. Path Tracer

Introduction

In this example you develop a network to show some differences between volume rendering and the MeVisLab Path Tracer. You will visualize the same scene using both 3D rendering techniques and some of the modules for path tracing.