SoView2DScene

InventorModule
genre View2DExtended
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll SoView2DScene
definition SoView2DScene.def
see also SoView2D
inherits from SoView2DExtension
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 Drawing On: Bool Send Events To Scene: Bool
button1: Enum editingOn: Bool setEventHandled: Bool
button2: Enum fixZOn: Bool shift: Enum
button3: Enum ignoreHandledEvents: Bool Slab Mode: Enum
clipToSlice: Bool interactionProviderID: String Slab Size: Float
Color: Color Lighting Model: Enum wantsAllEvents: Bool
control: Enum maskValid: Bool wantsKeyEvents: Bool
createNewMode: Bool needsValidVoxel: Bool wantsMouseWheelEvents: Bool
createNewModeRequest: Trigger renderOnSlab: Bool  
cursorShape: Enum selectionTolerance: Float  

Visible Fields

Drawing On

name: drawingOn, type: Bool, default: TRUE

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

see also SoView2DExtension.drawingOn

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.

see also SoView2DExtension.color

Send Events To Scene

name: sendEventsToScene, type: Bool, default: FALSE

If enabled, mouse events are forwarded to the 3D scene.

If you do not want to pass all mouse events to the scene, you can set the button1, button2, button3, shift, control, and alt mask to something different than IGNORED, and also can unset wantsAllEvents.

You can also set the wantsKeyEvents and wantsMouseWheelEvents to forward these event types to the scene.

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.

Lighting Model

name: lightingModel, type: Enum, default: BASE_COLOR

Values:

Title Name
Base Color BASE_COLOR
Phong PHONG

Hidden Fields

interactionProviderID

name: interactionProviderID, type: String

see SoView2DExtension.interactionProviderID

editingOn

name: editingOn, type: Bool, default: TRUE

see SoView2DExtension.editingOn

maskValid

name: maskValid, type: Bool, persistent: no

fixZOn

name: fixZOn, type: Bool, default: TRUE

selectionTolerance

name: selectionTolerance, type: Float, default: 4

needsValidVoxel

name: needsValidVoxel, type: Bool, default: TRUE

see SoView2DExtension.needsValidVoxel

button1

name: button1, type: Enum, default: IGNORED

see SoView2DExtension.button1

button2

name: button2, type: Enum, default: IGNORED

see SoView2DExtension.button2

button3

name: button3, type: Enum, default: IGNORED

see SoView2DExtension.button3

shift

name: shift, type: Enum, default: IGNORED

see SoView2DExtension.shift

control

name: control, type: Enum, default: IGNORED

see SoView2DExtension.control

alt

name: alt, type: Enum, default: IGNORED

see SoView2DExtension.alt

wantsAllEvents

name: wantsAllEvents, type: Bool, default: TRUE

wantsKeyEvents

name: wantsKeyEvents, type: Bool, default: FALSE

wantsMouseWheelEvents

name: wantsMouseWheelEvents, type: Bool, default: FALSE

setEventHandled

name: setEventHandled, type: Bool, default: FALSE

see SoView2DExtension.setEventHandled

ignoreHandledEvents

name: ignoreHandledEvents, type: Bool, default: FALSE

see SoView2DExtension.ignoreHandledEvents

createNewMode

name: createNewMode, type: Bool, default: FALSE

see SoView2DExtension.createNewMode

createNewModeRequest

name: createNewModeRequest, type: Trigger

see SoView2DExtension.createNewModeRequest

renderOnSlab

name: renderOnSlab, type: Bool, default: FALSE

clipToSlice

name: clipToSlice, type: Bool, default: TRUE

cursorShape

name: cursorShape, type: Enum, default: UNDEFINED_CURSOR

see SoView2DExtension.cursorShape