Visualization
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.
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.).
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.
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. You will see a message if your hardware does not support CUDA:
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.
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. You will see a message if your hardware does not support CUDA:
Example 7: Add 3D viewer to OrthoView2D
Example 7: Add 3D viewer to OrthoView2D
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.
The OrthoView2D
module allows you to select multiple layouts. Select layout Cube Equal. The layout shows your image in three orthogonal viewing directions. The top left segment remains empty.
Example 8: Vessel Segmentation using SoVascularSystem
Example 8: Vessel Segmentation using SoVascularSystem
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. Connect the output to a DtfSkeletonization
module as seen below. The initial output of the DtfSkeletonization
module is empty. Press the Update button to calculate the skeleton and the erosion distances.
Example 9: Creating Dynamic 3D Animations using AnimationRecorder
Example 9: Creating Dynamic 3D Animations using AnimationRecorder
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.2, add a SoSeparator
module and an AnimationRecorder
module to your workspace and connect them as shown below.
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.
As MeVisLab supports the integration of Python scripts e. g. for test automation, Matplotlib can be used to visualize any data you might want to see. And as it is directly integrated into MeVisLab, you don’t have to install it (via PythonPip
module) first.
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
.
If you feel like using a shortcut, you can also download the base network below and open it in your MeVisLab.
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:
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 .script file from its related files.
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 .py file a little to make them usable. Integrate the following code into your .py file and import numpy.