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.

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.

Example 2.5.2: Module interactions via Python scripting

Example 2.5.2: Module interactions via Python scripting      This example is also available on YouTube. 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 ].

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.

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

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. 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 6: MeVis Path Tracer

Example 6: MeVis Path Tracer      We have a Short video showing the possibilities of the MeVis Path Tracer on YouTube. 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.). Extra Infos:  CUDA is a parallel computing platform and programming model created by NVIDIA.

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. Attention:  The MeVis Path Tracer requires an NVIDIA graphics card with CUDA support. In order to check your hardware, open MeVisLab and add a SoPathTracer module to your workspace.

Example 6.2: Visualization using Path Tracer

Example 6.2: Visualization using SoPathTracer Introduction In this tutorial, we will explain the basics of using the SoPathTracer module in MeVisLab. You will learn how to create a scene, assign materials, add light sources, and configure the PathTracer to generate enhanced renderings. Attention:  The MeVis Path Tracer requires an NVIDIA graphics card with CUDA support. In order to check your hardware, open MeVisLab and add a SoPathTracer module to your workspace.

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.

Example 8: Vessel Segmentation using SoVascularSystem

Example 8: Vessel Segmentation using SoVascularSystem      This example is also available on YouTube. Introduction In this tutorial, we are using an input mask to create a vessel centerline using the DtfSkeletonization module and visualize the vascular structures in 3D using the SoVascularSystem module. The second part uses the distance between centerline and surface of the vessel structures to color thin vessels red and thick vessels green. Steps to do Develop your network Load the example tree mask by using the LocalImage module.

Example 9: Creating Dynamic 3D Animations using AnimationRecorder

Example 9: Creating Dynamic 3D Animations using AnimationRecorder      This example is also available on YouTube. Introduction In this tutorial, we are using the AnimationRecorder module to generate dynamic and visually appealing animations of our 3D scenes. We will be recording a video of the results of our previous project, particularly the detailed visualizations of the muscles, bones and blood vessels created using PathTracer. Steps to do Open the network and files of Example 6.

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.

Example 4: Subtract 3D objects

Example 4: Subtract 3D objects      This example is also available on YouTube. Introduction In this example, we load an image and render it as WEMIsoSurface. Then we create a 3-dimensional SoSphere and subtract the sphere from the initial WEM. Steps to do Develop your network Add a LocalImage module to your workspace and select load $(DemoDataPath)/BrainMultiModal/ProbandT1.dcm. Add a WEMIsoSurface, a SoWEMRenderer, a SoBackground and a SoExaminerViewer module and connect them as seen below.

Example 5: Clip Planes

Example 5: Clip Planes      This example is also available on YouTube. Introduction In this example, we are using the SoGVRDrawOnPlane module to define the currently visible slice from a 2D view as a clip plane in 3D. Steps to do Develop your network First we need to develop the network to scroll through the slices. Add a LocalImage module to your workspace and select the file ProbandT1 from MeVisLab demo data.

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.

Contour Example 7: Using the CSOListContainer

Contour Example 7: Using the CSOListContainer Introduction In this example, we are using the module CSOListContainer instead of the CSOManager. The CSOManager is a heavy weight, UI driven module. You can use it to see all of your CSOs, CSOLists and CSOGroups in the module panel. The CSOListContainer is a light weight module with focus on Python scripting. We recommend to use this module for final application development, because Python provides much more flexibility in handling CSO objects.

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.

Surface Example 5: WEM - Primitive Value Lists

Surface Example 5: WEM - Primitive Value Lists      This example is also available on YouTube. Introduction WEMs do not only contain the coordinates of nodes and surfaces, they can also contain additional information. These information are stored in so called Primitive Value Lists (PVLs). Every node, every surface and every edge can contains such a list. In these lists, you can for example store the color of the node or specific patient information.

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

Example 3: Iterative tests in MeVisLab with Screenshots

Example 3: Iterative tests in MeVisLab      This example is also available on YouTube. Introduction In this example, you are writing an iterative test. Iterative test functions run a function for every specified input. They return a tuple consisting of the function object called and the inputs iterated over. The iterative test functions are useful if the same function should be applied to different input data. These could be input values, names of input images, etc.

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.

Chapter VII: Application Development

MeVisLab Tutorial Chapter VII Summary This chapter will summarize all previous chapters and you will develop a whole application in MeVisLab. The complete workflow from developing a prototype to delivering your final application to your customer is explained step-by-step. Prototype to Product Licensing:  Some of the features described here will require a separate license. Building an installable executable requires the MeVisLab ApplicationBuilder license. It extends the MeVisLab SDK so that you can generate an installer of your developed macro module.

Step 1: Prototyping - Develop your Network

Step 1: Prototyping - Develop your Network      This example is also available on YouTube. Introduction In this example, we will develop a network which fulfills the requirements mentioned on the overview page. The network will be developed by re-using existing modules and defining basic field values. Steps to do 2D viewer The 2D viewer shall visualize the loaded images. In addition to that, it shall be possible to click into the image to trigger a RegionGrowing algorithm to segment parts of the loaded image based on a threshold.

Step 2: Prototyping - Create a macro module

Step 2: Prototyping - Create a macro module      This example is also available on YouTube. 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.

Step 3: Prototyping - User Interface and Python scripting

Step 3: Prototyping - User Interface and Python scripting      This example is also available on YouTube. Introduction In this step, we will develop a user interface and add Python scripting to the macro module you created in Step 2. Steps to do Develop the User Interface A mockup of the user interface you are going to develop is available here. The interface provides the possibility to load files and shows a 2D and a 3D viewer.

Step 4: Review - Automated Tests

Step 4: Review - Automated Tests      This example is also available on YouTube. Introduction In the previous chapters you developed a macro module with User Interface and Python scripting. In this step you will see how to implement an automated test to verify and validate the Requirements defined in Overview. Steps to do Create a test network using your macro module Create a new and empty network and save it as *.

Step 5: Review - Installer creation

Step 5: Review - Installer creation      This example is also available on YouTube. Introduction Your macro module has been tested manually and/or automatically? Then you should create your first installable executable and deliver it to your customer(s) for final evaluation. Licensing:  This step requires a valid MeVisLab ApplicationBuilder license. It extends the MeVisLab SDK so that you can generate an installer of your developed macro module. Free evaluation licenses of the MeVisLab ApplicationBuilder, time-limited to 3 months, can be requested at sales(at)mevislab.

Step 6: Refine - Update Application

Step 6: Refine - Update Application      This example is also available on YouTube. Introduction In previous step you developed an application which can be installed on your customers systems for usage. In this step we are going to integrate simple feedback into our executable and re-create the installer. We want to show you how easy it is to update your application using MeVisLab. Your customer requests an additional requirement to define the transparency of your 2D overlay in addition to defining the color.

Step 7: Refine - Re-Build Installer

Step 7: Refine - Re-Build Installer      This example is also available on YouTube. Introduction In this step you are re-creating your application installer after changing the UI in previous Step 6: Refine - Update Application. Steps to do Update the *.mlinstall file You do not need to use the Project Wizard now, because you already have a valid *.mlinstall file. The location should be in your package, under .\Configuration\Installers\TutorialSummary. Open the file in any text editor and search for the $VERSION 0.

Extra: Run your application in Browser

Extra: Run your application in Browser      This example is also available on YouTube. Introduction This step explains how to run your developed application in a browser. The MeVisLab network remains the same, only some adaptations are necessary for running any macro module in a browser window. Licensing:  This step requires a valid MeVisLab Webtoolkit license. It extends the MeVisLab SDK so that you can develop web macro modules. Free evaluation licenses of the MeVisLab Webtoolkit, time-limited to 3 months, can be requested at sales(at)mevislab.

Chapter VIII: ThirdParty components

MeVisLab Tutorial Chapter VIII Using ThirdParty software integrated into MeVisLab MeVisLab is equipped with a lot of useful software right out of the box, like the Insight Segmentation and Registration Toolkit (ITK) or the Visualization Toolkit (VTK). This chapter works as a guide on how to use some of the third party components integrated in MeVisLab for your projects via Python scripting. Additional Information:  You will also find instructions to install and use any Python package (e.

OpenCV

Open Source Computer Vision Library (OpenCV) Introduction OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. This chapter provides some examples how to use OpenCV in MeVisLab. Other resources You can find a lot of OpenCV examples and tutorials on their website.

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. Example Network The viewer is empty because the image needs to be set via Python scripting. Info:  More information about the PythonImage module can be found here Create a macro module Now you need to create a macro module from your network.

Example 2: Face Detection with OpenCV

Example 2: Face Detection with OpenCV Introduction This example uses the OpenCV WebCam Python script and adds a basic face detection. Info:  The Python code used in this example has been taken from Towards Data Science. Steps to do Open Example 1 Add the macro module developed in Example 1 to your workspace. Download trained classifier XML file Initially you need to download the trained classifier XML file. It is available in the OpenCV GitHub repository.

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.

PyTorch

PyTorch Introduction PyTorch is a machine learning framework based on the Torch library, used for applications such as Computer Vision and Natural Language Processing, originally developed by Meta AI and now part of the Linux Foundation umbrella. A lot of AI frameworks can be used within MeVisLab. We currently do not provide a preintegrated AI framework though as we try to avoid compatibility issues, and AI frameworks are very fast-moving by nature.

Example 1: Installing PyTorch using the PythonPip module

Example 1: Installing PyTorch using the PythonPip module Introduction The module PythonPip allows you to install additional Python packages to be used in MeVisLab. Warning:  You should not use the general Python pip command from a locally installed Python, because MeVisLab will not know these packages and they cannot be used in MeVisLab directly. The module either allows to install packages into the global MeVisLab installation directory, or into your defined user package.

Example 2: Brain Parcellation using PyTorch

Example 2: Brain Parcellation using PyTorch Introduction In this example, you are using a pre-trained PyTorch deep learning model (HighRes3DNet) to perform a full brain parcellation. HighRes3DNet is a 3D residual network presented by Li et al. in On the Compactness, Efficiency, and Representation of 3D Convolutional Networks: Brain Parcellation as a Pretext Task. Steps to do Add a LocalImage module to your workspace and select the file MRI_Head.dcm. For PyTorch it is necessary to resample the data to a defined size.

Example 3: Segment persons in webcam videos

Example 3: Segment persons in webcam videos Introduction This tutorial is based on Example 2: Face Detection with OpenCV. You can re-use some of the scripts already developed in the other tutorial. Steps to do Add the macro module developed in the previous example to your workspace. WebCamTest module Open the internal network of the module via middle mouse button and right click on the tab of the workspace showing the internal network.

Matplotlib

Matplotlib Matplotlib, introduced by John Hunter in 2002 and initially released in 2003, is a comprehensive data visualization library in Python. It is widely used among the scientific world as it is easy to grasp for beginners and provides high quality plots and images, that are widely customizable. Info:  The documentation on Matplotlib along with general examples, cheat sheets and a starting guide can be found here. As MeVisLab supports the integration of Python scripts e.

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 2: 2D Plotting

Example 2: 2D Plotting Introduction In this tutorial, we will equip the macro module we created in the previous tutorial with a responsive and interactable panel to plot grayscale distributions of single slices as well as defined sequences of slices in 2D. Steps to do Open the module definition folder of your macro module and the related .script file in MATE. Then activate the Preview as shown below: Drag the small Preview window to the bottom right corner of your window where it does not bother you.

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 .

Example 4: 3D Plotting

Example 4: 3D Plotting Introduction In this tutorial, we will equip the macro module we created in the Example 1: Module Setup and later on adapted by enabling it to plot grayscale distributions of single slices and sequences in 2D in Example 2: 2D Plotting with a three dimensional plotting functionality. Steps to do The fields and commands needed have already been prepared in the second tutorial. We will just have to modify our .

Tips and Tricks

MeVisLab Tips and Tricks This chapter shows some features and functionalities which are helpful but do not provide its own tutorial. Keyboard Shortcuts Using Snippets Scripting Assistant User Scripts Show status of module in- and output Module suggestion of module in- and output Keyboard Shortcuts This is a collection of useful keyboard shortcuts in MeVisLab, hopefully it grows continuously. Shortcut Functionality Ctrl+1 Automatically arrange selection of modules / in the current network Ctrl+2 Open most recent network file Ctrl+3 Run most recent test case (extremely useful for developers) Ctrl+A then Ctrl+1 Layout network Ctrl+A then Tab Layout .