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.
As we need world and voxel, enter those words in the quick search to find the module:
WorldVoxelConvert
converts world into voxel positions (or vice versa), either as vector or as single float values.
In our case, we need two conversions, for the start and end positions separately.
Add WorldVoxelConvert
a second time by selecting the module and duplicating it, either via Edit → Duplicate or by pressing the respective keyboard shortcut.
Name the instances accordingly, for example “startPos” and “endPos”. For this, select Edit Instance Name in the module's context menu.
Tip | |
---|---|
Alternatively, use the shortcuts F2 (Windows and Linux) or ENTER (Mac OS X). See the MeVisLab Reference Manual, chapter “Shortcuts”. |
In both WorldVoxelConvert
modules, check the option Integer voxel coordinates.
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).
For the parameter connections, proceed as follows:
Connect the SoView2DRectangle
Start World Position to the WorldVoxelConvert(startPos)
World Position Vector.
Similarly, connect the SoView2DRectangle
End World Position to the WorldVoxelConvert(endPos)
World Position Vector.
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.
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.
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.
This is the end of this example. The full network is delivered with the demos of MeVisLab (available via Help → Welcome → more... → RoiExample.mlab).
© 2024 MeVis Medical Solutions AG