SoView2DScene

InventorModule
genre View2DExtended
author Felix Ritter
package MeVisLab/Standard
dll SoView2DScene
definition SoView2DScene.def
see also SoView2D
keywords slice, 3D, visualization

Purpose

The module SoView2DScene renders an Open Inventor scene graph into 2D slices.

Only the part of the scene that fits into the current slice or slab is displayed.

Details

The scene graph rendered by this module is transformed from world space into voxel space and clipped against the top and bottom slice. Since the scene is rendered with OpenGL directly into the slice it is displayed with pixel accuracy, which is often more accurate than a rasterized voxel representation.

This module is very useful in combination with the SoGVRVolumeRenderer, since it allows to render a GVR slab rendering onto any SoView2D coordinate system. Have a look at the SoGVRSlabHint example network for an example usage.

Windows

Default Panel

../../../Modules/Inventor/SoView2DScene/mhelp/Images/Screenshots/SoView2DScene._default.png

Input Fields

sceneGraph

name: sceneGraph, type: SoNode

Output Fields

self

name: self, type: SoNode

Parameter Fields

Field Index

alt: Enum cursorShape: Enum selectionTolerance: Float
button1: Enum drawFilledBoundary: Bool setEventHandled: Bool
button2: Enum Drawing On: Bool shift: Enum
button3: Enum editingOn: Bool Slab Mode: Enum
clipToSlice: Bool fixZOn: Bool Slab Size: Float
Color: Color ignoreHandledEvents: Bool wantsAllEvents: Bool
control: Enum maskValid: Bool wantsKeyEvents: Bool
createNewMode: Bool needsValidVoxel: Bool wantsMouseWheelEvents: Bool
createNewModeRequest: Trigger renderOnSlab: Bool  

Visible Fields

Drawing On

name: drawingOn, type: Bool, default: TRUE

If checked, the module renders geometry onto the current slice.

Color

name: color, type: Color, default: 1 1 1

Sets a default diffuse color of the rendered scene. This color may be overwritten by any color node such as SoBaseColor or SoMaterial.

Slab Size

name: slabSize, type: Float, default: 1, minimum: 0.0001

Sets the size of the slab, depending on the Slab Mode.

Slab Mode

name: slabMode, type: Enum, default: USE_VIEW2D_SLAB_SIZE

Defines the slab mode.

Pseudo code the shows the slab calculation (using Python syntax, note that the end position is +1 because of range() at the bottom):

mode     = ctx.field("SoView2DScene.slabMode").value
slabSize = ctx.field("SoView2DScene.slabSize").value
startSlice = ctx.field("SoView2D.startSlice").value

voxelSizeZ = ctx.field("SoView2D.image").voxelSizeZ()

if mode == "SLAB_SIZE_IN_SLICES":
  slabSize = int(slabSize)
  start = startSlice - (slabSize-1)//2
  end   = startSlice + 1 + slabSize//2
elif mode == "USE_VIEW2D_SLAB_SIZE":
  slabSize = int(ctx.field("SoView2D.slab").value)
  start = startSlice - (slabSize-1)//2
  end   = startSlice + 1 + slabSize//2
elif mode == "SLAB_SIZE_IN_SLICES_NEGATIVE_FIRST":
  slabSize = int(slabSize)
  start = startSlice - slabSize//2
  end   = startSlice + 1 + (slabSize-1)//2
elif mode == "SLAB_SIZE_IN_SLICES_FORWARD":
  slabSize = int(slabSize)
  start = startSlice
  end   = startSlice + slabSize
elif mode == "SLAB_SIZE_IN_MM_FORWARD":
  slabSize = math.floor(slabSize/voxelSizeZ + 0.5)
  if slabSize < 1:
    slabSize = 1
  start = int(startSlice)
  end   = int(math.ceil(startSlice + slabSize))
elif mode == "SLAB_SIZE_IN_MM":
  slabSize = slabSize/voxelSizeZ
  if slabSize < 1:
    slabSize = 1
  start = int(math.ceil(startSlice - slabSize/2.))
  end   = int(math.floor(startSlice + 1 + slabSize/2.))

# clip to dataset
if start<0:
  start = 0
maxSlice = int(ctx.field("SoView2D.maxSlice").value);
if end>maxSlice+1:
  end = maxSlice+1

# return the expected range
return range(start, end)

Values:

Title Name Description
Use View2d Slab Size USE_VIEW2D_SLAB_SIZE Uses the slab parameter of the attached SoView2D as number of slab slices and renders as in SLAB_SIZE_IN_SLICES.
Slab Size In Mm SLAB_SIZE_IN_MM Uses the Slab Size parameters as millimeters using the z voxel size of the SoView2D image. The slab is centered exactly to the SoView2D.startSlice center and is clamped to contain at least one slice.
Slab Size In Mm Forward SLAB_SIZE_IN_MM_FORWARD Uses the Slab Size parameters as millimeters using the z voxel size of the SoView2D image. The slab starts at SoView2D.startSlice, going in positive z direction and is clamped to contain at least one slice.
Slab Size In Slices SLAB_SIZE_IN_SLICES Uses the Slab Size parameter as number of slab slices and renders the slab slices around the current slice, preferring the positive z direction.
Slab Size In Slices Negative First SLAB_SIZE_IN_SLICES_NEGATIVE_FIRST Uses the Slab Size parameter as number of slab slices and renders the slab slices around the current slice, preferring the negative z direction.
Slab Size In Slices Forward SLAB_SIZE_IN_SLICES_FORWARD Uses the Slab Size parameter as number of slab slices and renders the slab slices starting at the current slice, going in positive z direction.
Slab Size Unlimited SLAB_SIZE_UNLIMITED

Does not set any clipping planes and thus renders all geometry that is visible.

Note: this is not supported by the SoGVRVolumeRenderer.

Hidden Fields

editingOn

name: editingOn, type: Bool, default: TRUE

maskValid

name: maskValid, type: Bool, default: FALSE

fixZOn

name: fixZOn, type: Bool, default: TRUE

selectionTolerance

name: selectionTolerance, type: Float, default: 4

needsValidVoxel

name: needsValidVoxel, type: Bool, default: TRUE

button1

name: button1, type: Enum, default: PRESSED

Values:

Title Name
Pressed PRESSED
Released RELEASED
Ignored IGNORED

button2

name: button2, type: Enum, default: IGNORED

Values:

Title Name
Pressed PRESSED
Released RELEASED
Ignored IGNORED

button3

name: button3, type: Enum, default: IGNORED

Values:

Title Name
Pressed PRESSED
Released RELEASED
Ignored IGNORED

shift

name: shift, type: Enum, default: IGNORED

Values:

Title Name
Pressed PRESSED
Released RELEASED
Ignored IGNORED

control

name: control, type: Enum, default: IGNORED

Values:

Title Name
Pressed PRESSED
Released RELEASED
Ignored IGNORED

alt

name: alt, type: Enum, default: IGNORED

Values:

Title Name
Pressed PRESSED
Released RELEASED
Ignored IGNORED

wantsAllEvents

name: wantsAllEvents, type: Bool, default: FALSE

wantsKeyEvents

name: wantsKeyEvents, type: Bool, default: FALSE

wantsMouseWheelEvents

name: wantsMouseWheelEvents, type: Bool, default: FALSE

setEventHandled

name: setEventHandled, type: Bool, default: FALSE

ignoreHandledEvents

name: ignoreHandledEvents, type: Bool, default: FALSE

createNewMode

name: createNewMode, type: Bool, default: FALSE

createNewModeRequest

name: createNewModeRequest, type: Trigger

renderOnSlab

name: renderOnSlab, type: Bool, default: FALSE

clipToSlice

name: clipToSlice, type: Bool, default: TRUE

cursorShape

name: cursorShape, type: Enum, default: UNDEFINED_CURSOR

Values:

Title Name
Undefined Cursor UNDEFINED_CURSOR
Default Cursor DEFAULT_CURSOR
Forbidden Cursor FORBIDDEN_CURSOR
Pointing Hand Cursor POINTING_HAND_CURSOR
Open Hand Cursor OPEN_HAND_CURSOR
Closed Hand Cursor CLOSED_HAND_CURSOR
Move All Cursor MOVE_ALL_CURSOR
Move Hori Cursor MOVE_HORI_CURSOR
Move Vert Cursor MOVE_VERT_CURSOR
Move Fdiag Cursor MOVE_FDIAG_CURSOR
Move Bdiag Cursor MOVE_BDIAG_CURSOR
Move Inout Cursor MOVE_INOUT_CURSOR
Rotate X Cursor ROTATE_X_CURSOR
Rotate Y Cursor ROTATE_Y_CURSOR
Rotate Z Cursor ROTATE_Z_CURSOR
Rotate Xy Cursor ROTATE_XY_CURSOR
Zoom Cursor ZOOM_CURSOR
Zoom In Cursor ZOOM_IN_CURSOR
Zoom Out Cursor ZOOM_OUT_CURSOR
Cross Cursor CROSS_CURSOR
Cross Plus Cursor CROSS_PLUS_CURSOR
Cross Minus Cursor CROSS_MINUS_CURSOR
Cross Move Cursor CROSS_MOVE_CURSOR
Cross Rotate Cursor CROSS_ROTATE_CURSOR
Cross Rect Cursor CROSS_RECT_CURSOR
Cross Oval Cursor CROSS_OVAL_CURSOR
Cross Vector Cursor CROSS_VECTOR_CURSOR
Cross Freeform Cursor CROSS_FREEFORM_CURSOR
Cross Point Cursor CROSS_POINT_CURSOR
Cross Line Cursor CROSS_LINE_CURSOR
Cross Curve Cursor CROSS_CURVE_CURSOR
Cross Polyline Cursor CROSS_POLYLINE_CURSOR
Cross Polygon Cursor CROSS_POLYGON_CURSOR
Cross Fill Cursor CROSS_FILL_CURSOR
Cross Link Cursor CROSS_LINK_CURSOR
Cross 0 Cursor CROSS_0_CURSOR
Cross 1 Cursor CROSS_1_CURSOR
Cross 2 Cursor CROSS_2_CURSOR
Cross 3 Cursor CROSS_3_CURSOR
Lut Cursor LUT_CURSOR
Slicing Cursor SLICING_CURSOR

drawFilledBoundary

name: drawFilledBoundary, type: Bool, default: FALSE