Surface Example 3: Interactions with WEM
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
. For a better understanding, you should also add a SoCoordinateSystem
module and connect it to the viewer. Change the User Transform Mode to User Transform Instead Of Input and set User Scale to 2 for x, y and z.
The SoExaminerViewer
shows your cube and the world coordinate system. You can interact with the camera (rotate, zoom and pan), the cube itself does not change and remains in the center of the coordinate system.
Scaling, rotation and translations on the cube itself can be done by using the module SoTransformerDragger
. Additionally add a SoTransform
module to your network. Add all modules but the SoCoordinateSystem
to a SoSeparator
so that transformations are not applied to the coordinate system.
Draw parameter connections from Translation, Scale Factor and Rotation of the SoTransformerDragger
to the same fields of the SoTransform
module.
Opening your SoExaminerViewer now allows you to use handles of the SoTransformerDragger
to scale, rotate and move the cube. You can additionally interact with the camera as already done before.
SoExaminerViewer
. Use the Pick Mode for applying transformations and the View Mode for using the camera.You can also try the other So*Dragger
modules in MeVisLab for variations of the SoTransformerDragger
.
Interactively modify WEMs
We are using the WEMBulgeEditor
module to interactively modify the WEM via mouse interactions.
Add a WEMInitialize
, a SoWEMRenderer
and a SoBackground
module to your workspace and connect them to a SoExaminerViewer
as seen below. Select model Icosahedron for the WEMInitialize
module.
You can see the WEM and interact with it in the viewer (zoom, move and rotate). In case the object does not rotate around its center, trigger the field viewAll of the SoExaminerViewer
.
Add a WEMBulgeEditor
and a SoWEMBulgeEditor
to your network and connect them as seen below.
Opening the viewer, you can still not edit the object.
We need a lookup table (LUT) to interact with the WEM. Add a WEMGenerateStatistics
between the WEMInitialize and the WEMBulgeEditor. The module WEMGenerateStatistics
generates node, edge, and face statistics of a WEM and stores the information in the WEM’s Primitive Value Lists.
Check New node PVL and set New PVL Name to myPVL.
In the WEMBulgeEditor
, set PVL Used as LUT Values to previously generated myPVL.
Add a SoLUTEditor
and connect it to SoWEMRenderer
. You also have to connect the WEMGenerateStatistics
to the SoWEMRenderer
. Set SoWEMRenderer
Color Mode to Lut Values and select PVL Used as LUT Values to myPVL.
Open the panel of the SoLUTEditor
. Configure New Range Min as -1 and New Range Max as 1 in Range tab. Apply the new range. Define the LUT as seen below in Editor tab.
Now your Primitive Value List is used to colorize the affected region for your tansformations. You can see the region by the color on hovering the mouse over the WEM.
The size of the region can be changed via
ALT
and mouse wheel
. Make sure that the Influence Radius in WEMBulgeEditor
is larger than 0.
SoExaminerViewer
. Use the Pick Mode for applying transformations and the View Mode for using the camera.A much more complex example using medical images and allowing to modify in 3D and on 2D slices can be seen by opening the example network of the WEMBulgeEditor
.
SoCSODrawOnSurface
, SoVolumeCutting
and WEMExtrude
.Summary
- MeVisLab provides multiple options to interact with 3D surfaces.
- Modules of the
So*Dragger
family allow to scale, rotate and translate a WEM. - You can always use a
SoCoordinateSystem
to see the current world coordinates. - The
WEMBulgeEditor
allows you to interactively modify a WEM via mouse.