5.3. Adding the Interactivity for the Viewers

In the third step, we add the interactivity. The problem in connecting the modules SoView2DRectangle and SubImage is that the world positions offered by the first modules need to be translated to voxels positions for the latter.

For such translation tasks, there are several modules that convert values from one type to the other.

  1. As we need world and voxel, enter those words in the quick search to find the module:

    Figure 5.4. Searching for World to Voxel Conversion

    Searching for World to Voxel Conversion

    WorldVoxelConvert converts world into voxel positions (or vice versa), either as vector or as single float values.

    Figure 5.5. WorldVoxelConvert Panel

    WorldVoxelConvert Panel

    In our case, we need two conversions, for the start and end positions separately.

  2. Add WorldVoxelConvert a second time by selecting the module and duplicating it, either via EditDuplicate or by pressing the respective keyboard shortcut.

  3. Name the instances accordingly, for example “startPos” and “endPos”. For this, select Edit Instance Name in the module's context menu.


    Alternatively, use the shortcuts F2 (Windows and Linux) or ENTER (Mac OS X). See the MeVisLab Reference Manual, chapter Shortcuts.

  4. In both WorldVoxelConvert modules, check the option Integer voxel coordinates.

  5. Both WorldVoxelConvert modules need the original image for obtaining the world-to-voxel matrix, so connect them to LocalImage (the image output can be connected to an unlimited number of modules).

    Figure 5.6. WorldVoxelConvert Modules Added

    WorldVoxelConvert Modules Added

  6. For the parameter connections, proceed as follows:

    1. Connect the SoView2DRectangle Start World Position to the WorldVoxelConvert(startPos) World Position Vector.

    2. Similarly, connect the SoView2DRectangle End World Position to the WorldVoxelConvert(endPos) World Position Vector.

    3. Connect the converted values from WorldVoxelConvert(startPos), that is the Single X, Single Y, and Single Z values, to the respective Subimage Start X, Start Y, and Start Z values.

    4. Similarly, connect the converted values from WorldVoxelConvert(endPos), that is the Single X, Single Y, and Single Z values, to the respective Subimage End X, End Y, and End Z values.

    Figure 5.7. Adding the Parameter Connections

    Adding the Parameter Connections

  7. If you have not done that before, check the option Auto apply on the SubImage panel (bottom right corner), so that any changes of the selected region in the first viewer are updated automatically in the second viewer.

    Now the network is fully functional.

    Figure 5.8. Example Network ROI Selection

    Example Network ROI Selection

This is the end of this example. The full network is delivered with the demos of MeVisLab (available via HelpWelcomemore...RoiExample.mlab).