Beginner

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.      This example is also available on YouTube. Extra Infos:  Additional information on the basics of MeVisLab are explained here Loading Data First, we need to load the data we would like to work on, e.

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. Extra Infos:  The easiest way to load data in MeVisLab is to drop the file onto the MeVisLab workspace. MeVisLab will try to find a module that is capable of loading your file automatically. These chapters explain the data formats and modules related to this example: Images DICOM Data Segmentations / 2D Contours 3D Data / Meshes Extra Infos:  Detailed explanations on loading images onto your MeVisLab workspace can be found here Images A good option to load images is the ImageLoad module.

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 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.

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 The DICOM (Digital Imaging and Communications in Medicine) standard defines a data format that groups information into data sets.

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.1: Package Creation

Example 2.1: Package creation      This example is also available on YouTube. 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.

Example 2.2: Creation of global macro modules

Example 2.2: Global macro modules      This example is also available on YouTube. 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      This example is also available on YouTube. 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. Depending on the way the macro module was created the default help page and example network might or might not exist.

Example 2.4: GUI development

Example 2.4: Building a Panel Layout: Interactions with macro modules      This example is also available on YouTube. 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) . Extra Infos:  More information about GUI design in MeVisLab can be found here Creating a panel for the macro module flilter Creation of a module panel In Example 2.

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.

Example 2.5.1: The module RunPythonScript

Example 2.5.1: The module RunPythonScript      This example is also available on YouTube. 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.

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      This example is also available on YouTube. 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      This example is also available on YouTube. 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      This example is also available on YouTube. 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.

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. Info:  Not only pixel- and voxel-based data, but also scene objects and 3D scenes can be visualized. See our tutorial on OpenInventorModules for further information.

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      This example is also available on YouTube. 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      This example is also available on YouTube. 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.

Example 4: Display 2D images in Open Inventor SoRenderArea

Example 4: Display images converted to Open Inventor scene objects      This example is also available on YouTube. 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.

Example 5: Volume rendering and interactions

Example 5: Volume rendering and interactions      This example is also available on YouTube. 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 The module SoGVRVolumeRenderer allows volume rendering of 3D and 4D images. Extra Infos:  Additional information about Volume Rendering can be found here: Giga Voxel Renderer Change LUT We like to add a surface color to the head.

Example 7: Add 3D viewer to OrthoView2D

Example 7: Add 3D viewer to OrthoView2D      This example is also available on YouTube. Introduction In this example we will use the OrthoView2D module and add a 3D viewer to the layout Cube. Steps to do Develop your network Add the modules LocalImage and OrthoView2D to your workspace and connect them. Network The OrthoView2D module allows you to select multiple layouts. Select layout Cube Equal. The layout shows your image in three orthogonal viewing directions.

Chapter IV: Image Processing

Image Processing in MeVisLab Digital image processing is the use of a digital computer to process digital images through an algorithm (see Wikipedia). MeVisLab provides multiple modules for image processing tasks, such as: Filters Masks Transformations Arithmetics Statistics For details about Image Processing in MeVisLab, see the MeVisLab Documentation In this chapter, you will find some examples for different types of image processing in MeVisLab.

Example 1: Arithmetic operations on two images

Example 1: Arithmetic operations on two images      This example is also available on YouTube. Introduction We are using the Arithmetic2 module to apply basic scalar functions on two images. The module provides 2 inputs for images and 1 output image for the result. Steps to do Develop your network Add two LocalImage modules to your workspace for the input images. Select $(DemoDataPath)/BrainMultiModal/ProbandT1.dcm and $(DemoDataPath)/BrainMultiModal/ProbandT2.dcm from MeVisLab demo data and add a SynchroView2D to your network.

Example 2: Masking images

Example 2: Masking images      This example is also available on YouTube. Introduction The background of medical images is black for most cases. In case an image is inverted or window/level values are adapted, these black pixels outside clinical relevant pixels might become very bright or even white. Being in a dark room using a large screen, the user might be blended by these large white regions. Image masking is a very good way to select a defined region where image processing shall be applied.

Example 3: Region Growing

Example 3: Region Growing      This example is also available on YouTube. Introduction A very simple approach to segment parts of an image is the region growing method. A general explanation can be found here. In this example, you will segment the brain of an image and show the segmentation results as an overlay on the original image. Steps to do Develop your network Add a LocalImage module to your workspace and select load $(DemoDataPath)/BrainMultiModal/ProbandT1.

Chapter V: Data Objects

Data Objects in MeVisLab MeVisLab provides pre-defined data objects, e. g. Contour Segmented Objects (CSOs) which are three-dimensional objects encapsulating formerly defined contours within images. Surface Objects (Winged Edge Meshes or WEMs) represent the surface of geometrical figures and allow the user to manipulate them. Markers are used to mark specific locations or aspects of an image and allow to process those later on. Curves can print the results of a function as two-dimensional mathematical graphs into a diagram.

Contour Objects (CSO)

Contour Segmented Objects (CSOs) in MeVisLab Introduction Structure of CSOs MeVisLab provides modules to create contours in images. 3D objects which encapsulate these contours are called Contour Segmented Objects (CSOs). In the next image, you can see a rectangular shaped CSO. The pink circles you can see are called Seed Points. Seed Points define the shape of the CSO. In case of a rectangle, you need four Seed Points forming the corners, to define the whole rectangle.

Contour Example 1: Creation of Contours

Contour Example 1: Creation of Contours      This example is also available on YouTube. Introduction We like to start with the creation of CSOs. To create CSOs, you need a SoCSO*-Editor. There are several different editors, which can be used to create CSOs (see here). Some of them are introduced in this example. Steps to do Develop your network For this example, we need the following modules. Add the modules to your workspace, connect them as shown below and load the example image $(DemoDataPath)/BrainMultiModal/ProbandT1.

Contour Example 2: Contour Interpolation

Contour Example 2: Creating Contours using Live Wire and Interpolation      This example is also available on YouTube. Introduction In this example, we like to create CSOs using the Live Wire Algorithm, which allows semi-automatic CSO creation. The algorithm uses edge detection to support the user creating CSOs. We also like to interpolate CSOs over slices. That means additional CSOs are generated between manual segmentations based on a linear interpolation. As a last step, we will group together CSOs of the same anatomical unit.

Contour Example 3: 2D and 3D Visualization of Contours

Contour Example 3: Overlay Creation and 3D Visualization of Contours      This example is also available on YouTube. Introduction In this example, we’d like to use the created CSOs to display an overlay. This allows us to mark one of two lungs. In addition to that, we will display the whole segmented lobe of the lung in a 3D image. Steps to do Develop your network Use the network from the contour example 2 and add the modules VoxelizeCSO, SoView2DOverlay and View2D to your workspace.

Contour Example 4: Annotation of Images

Contour Example 4: Annotation of Images      This example is also available on YouTube. Introduction In this example we like to calculate the volume of our object, in this case the part of the lung we have segmented. Steps to do Develop your network and calculate the lung volume Add the module CalculateVolume and SoView2DAnnotation to your workspace and connect both modules as shown. Update the module CalculateVolume, which directly shows the volume of our object.

Contour Example 5: Contours and Ghosting

Contour Example 5: Visualizing Contours and Images      This example is also available on YouTube. Introduction In this example, we like to automatically create CSOs based on a predefined iso value. Steps to do Develop your network Add the following modules to your workspace and connect them as shown. Load the example image Bone.tiff. Automatic creation of CSOs based on the iso value Now, open the panel of CSOIsoGenerator to set the Iso Value to 1200.

Contour Example 6: Adding Labels to Contours

Contour Example 6: Adding Labels to Contours      This example is also available on YouTube. Introduction In this example, we are adding a label to a contour. The label provides information about measurements and about the contour itself. The label remains connected to the contour and can be moved via mouse interactions. Steps to do Develop your network Add a LocalImage and a View2D module to your workspace and connect them as shown below.

Surface Objects (WEM)

Surface Objects (WEMs) Introduction In MeVisLab it is possible to create, visualize, process and manipulate surface objects, also known as polygon meshes. Here, we call surface objects Winged Edge Mesh, in short WEM. In this chapter you will get an introduction into WEMs. In addition, you will find examples on how to work with WEMs. For more information on WEMs take a look at the MeVislab Toolbox Reference . If you like to know which WEM formats can be imported into MeVisLab, take a look at the assimp documentation here.

Surface Example 1: Creation of WEMs

Surface Example 1: Create Winged Edge Mesh out of voxel images and CSOs      This example is also available on YouTube. Introduction In this example you will learn how to create a Winged Edge Mesh (WEM). There are several approaches on creating WEMs, a few of them are shown in this example. Instead of creating WEMs, they can also be imported, see chapter Surface Objects (WEM). Steps to do From image to surface: Generating WEMs out of voxel images At first, we will create a WEM out of a voxel image using the module WEMIsoSurface.

Surface Example 2: Processing and Modification of WEM

Surface Example 2: Processing and Modification of WEM      This example is also available on YouTube. Introduction In this example, you will learn how to modify and process WEMs. Steps to do Develop your network Modification of WEMs Use the module WEMLoad to load the file venus.off. Then add and connect the shown modules. We like to display the WEM venus two times, one time this WEM is modified. You can use the module WEMModify to apply modifications.

Surface Example 3: Interactions with WEM

Surface Example 3: Interactions with WEM      This example is also available on YouTube. Introduction In these examples, we are showing 2 different possibilities to interact with a WEM: Scale, rotate and move a WEM in a scene Modify a WEM in a scene Scale, rotate and move a WEM in a scene We are using a SoTransformerDragger module to apply transformations on a 3D WEM object via mouse interactions. Add a SoCube and a SoBackground module and connect both to a SoExaminerViewer.

Surface Example 4: Interactively moving WEM

Surface Example 4: Interactively moving WEM      This example is also available on YouTube. Introduction In this example, we like to interactively move WEMs using SoDragger modules insight a viewer. Develop your network Interactively translating objects in 3D using SoDragger modules Add and connect the following modules as shown. In the panel of the module WEMInitialize select the Model Octasphere. After that, open the viewer SoExaminerViewer and make sure to select the Interaction Mode.

Chapter VI: Testing

MeVisLab Tutorial Chapter VI Testing, Profiling and Debugging in MeVisLab The MeVisLab Integrated Development Environment (IDE) provides tools to write automated tests in Python, profile your network performance and to debug your Python code. All of these funtionalities will be addressed in this chapter. Testing The MeVisLab TestCenter is the starting point of your tests. Select [ File → Run TestCaseManager ] to open the user interface of the TestCaseManager.

Marker Objects

Markers in MeVisLab In MeVisLab you can equip images and other data objects with markers. In this example you will see how to create, process and use markers. Creation and Rendering To create markers, you can use a marker editor, for example the SoView2DMarkerEditor. Connect this editor to a viewer as shown below. Now you can interactively create new markers. Connect the module XMarkerListContainer to your marker editor to store markers in a list.

Example 1: Distance between Markers

Example 1: Calculating the distance between markers      This example is also available on YouTube. Introduction In this example, we will measure the distance between one position in an image to a list of markers. Steps to do Develop your network Add the following modules and connect them as shown. We changed the names of the modules SoView2DMarkerEditor and XMarkerLIstContainer, to distinguish these modules from two similar modules we will add later on.

Example 1: Writing a simple test case in MeVisLab

Example 1: Writing a simple test case in MeVisLab      This example is also available on YouTube. Introduction In this example, you will learn how to write an automated test for a simple network using the DicomImport, MinMaxScan and View3D modules. Afterwards, you will be able to write test cases for any other module and network yourself. Steps to do Creating the network to be used for testing Add the following modules to your workspace and connect them as seen below:

Example 2: Profiling in MeVisLab

Example 2: Profiling in MeVisLab      This example is also available on YouTube. Introduction In this example, we are using the MeVisLab Profiler to inspect the memory and CPU consumption of the modules in an example network. Steps to do Creating the network to be used for profiling You can open any network you like, here we are using the example network of the module MinMaxScan for profiling. Add the module MinMaxScan to your workspace, open the example network via right-click and select [ Help → Show Example Network ].

Curves

Curves in MeVisLab Introduction Curves can be used in MeVisLab to print the results of a function as two-dimensional mathematical curves into a diagram. Curves in MeVisLab In the given example, only modules available in commercial MeVisLab Professional SDK have been used. The non-commercial MeVisLab Standard SDK provides more modules for curves.

Example 1: Drawing curves

Example 1: Drawing curves      This example is also available on YouTube. Introduction In this example, you will draw one or more curves into a diagram and define different styles for the curves. Steps to do Develop your network A curve requires x- and y-coordinates to be printed. You can use the CurveCreator module as input for these coordinates. The SoDiagram2D draws the curves into a SoRenderArea. You can also define the style of the curves by using the StylePalette module.

assimp

Asset-Importer-Lib (assimp) Introduction Assimp (Asset-Importer-Lib) is a library to load and process geometric scenes from various 3D data formats. This chapter provides some examples of how 3D formats can be imported into MeVisLab. In general you always need a SoSceneLoader module. The SoSceneLoader allows to load meshes as Open Inventor points/lines/triangles/faces using the Open Asset Import Library. SoSceneLoader You can also use the SoSceneWriter module to export your 3D scenes from MeVisLab into any of the output formats listed below.

Example 1: 3D Printing in MeVisLab

Example 1: 3D Printing in MeVisLab Introduction This example uses the assimp library to load a 3D file and save the file as *.stl for 3D printing. Steps to do Develop your network Add the modules SoSceneLoader, SoBackground and SoExaminerViewer to your workspace and connect them as seen below. Example Network Open the 3D file Select the file vtkCow.obj from MeVisLab demo data directory. Open SoExaminerViewer and inspect the scene. You will see a 3D cow.

Example 1: Module Setup

Example 1: Module Setup Introduction To be able to access the data needed for our grayscale distribution plots, we need a network consisting of a module that imports DICOM data, a module that differentiates between slices and another that ouputs histogram data. Steps to do Open up your MeVisLab workspace and add the modules LocalImage, SubImage and Histogram to it. Connect the output of LocalImage to the input of SubImage and the output of SubImage with the input of Histogram.

Example 3: Slice Comparison

Example 3: Slice Comparison Introduction We will adapt the previously created macro module to be able to overlay two defined slices to compare their grayscale distributions. The module we are adapting has been set up in the Example 1: Module Setup tutorial. The panel and two-dimensional plotting functionality has been added in [Example 2: 2D Plotting] (/tutorials/thirdparty/matplotlib/2dplotting). Steps to do At first, we will extend the panel: Open your BaseNetwork macro module within an empty MeVisLab workspace and select the .