genre | View2DExtended |
author | Felix Ritter |
package | MeVisLab/Standard |
dll | SoView2DScene |
definition | SoView2DScene.def |
see also | SoView2D |
keywords | slice, 3D, visualization |
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.
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.
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 |
If checked, the module renders geometry onto the current slice.
Sets a default diffuse color of the rendered scene. This color may be overwritten by any color node such as SoBaseColor or SoMaterial.
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. |