Class SoOffscreenVolumeRender

All Implemented Interfaces:
SafeDisposable

public abstract class SoOffscreenVolumeRender extends SoNode
Extract data from an SoVolumeRender. The SoOffscreenVolumeRender node extracts data by rendering one or more volumes (via SoVolumeRender) into a buffer that can then be used for different computation tasks.

Volumes of interest are specified by a subscenegraph in volumerenderSceneGraph.

The region to be extracted is the bounding box of the scene graph specified in the bboxSceneGraph field.

To implement an extraction, the application must derive a new class from SoOffscreenVolumeRender and implement :

  • the boxComputed method. This method is called with parameters that give access to information about the processed box.
  • the getNextSubBox method. This method must return subBox size smaller than getMaxBoxSize. We recommend to request subbox even smaller in order to get more parallelism between extraction processing (done on GPU) and application processing and reduce peak GPU memory resources used.

The resolution of the extraction is controlled by boxSize field. As extraction is done using GPU techniques, there is a size limit on the boxSize that can be extract in one call. This limit can be retreived through getMaxBoxSize call.

Limitations:

File format/default:

SoOffscreenVolumeRender {

    volumerenderSceneGraph NULL
    bboxSceneGraph NULL
    boxSize (64, 64, 64)
    trigger false
    opacityThreshold 0
    components ALPHA
}

See Also:
  • Field Details

    • volumerenderSceneGraph

      public final SoSFNode volumerenderSceneGraph
      Head of the scene graph that contains one or multiple VolumeRender node to render in 3D off-screen cube.
    • bboxSceneGraph

      public final SoSFNode bboxSceneGraph
      Head of the scene graph that defines the 3D off-screen scene cube to consider in world coordinates.
    • boxSize

      public final SoSFVec3i32 boxSize
      Resolution of the output data in the off-screen box.
    • trigger

      public final SoSFBool trigger
      Setting this field to true will start the off-screen rendering process. This field is set to false when computation is finished. Default is false.
    • opacityThreshold

      public final SoSFFloat opacityThreshold
      During extraction, voxels with an opacity less than the specified value will be ignored Default is 0. Valid range is [0-1].
    • components

      Components to get back from the offscreen render. . Default is ALPHA.
    • dataSpaceMatrix

      public final SoSFMatrix dataSpaceMatrix
      This transformation is applied on the volume render texture coordinate during the extraction. It allows to change the extraction frame. This matrix is applied on normalized texture coordinates all components are between 0-1 and must be in [0-1] after the transformation. So to inverse an axis, we must apply the following transformation: -1*u+1 (where u is a texture coordinate) and not just a simple negative scale.

      To swap I and J axis, the matrix would be:

       SbMatrix( 0, 1, 0, 0,
                 1, 0, 0, 0,
                 0, 0, 1, 0,
                 0, 0, 0, 1);

      To reverse I axis, the matrix would be:

       SbMatrix(-1, 0, 0, 0,
                 0, 1, 0, 0,
                 0, 0, 1, 0,
                 1, 0, 0, 1);

      To reverse J axis, the matrix would be:

       SbMatrix( 1, 0, 0, 0,
                 0,-1, 0, 0,
                 0, 0, 1, 0,
                 0, 1, 0, 1);

      To reverse K axis, the matrix would be:

       SbMatrix( 1, 0, 0, 0,
                 0, 1, 0, 0,
                 0, 0, -1, 0,
                 0, 0, 1, 1);
  • Method Details

    • getMaxBoxSize

      public SbVec3i32 getMaxBoxSize()
      Calls getMaxBoxSize((com.openinventor.inventor.misc.SoState)null).
    • getMaxBoxSize

      public SbVec3i32 getMaxBoxSize(SoState state)
      Returns the maximum boxSize that can be extract in one boxComputed for the current state.
    • synchronousExtraction

      public boolean synchronousExtraction(SoSceneManager sceneManager)
      Does extraction synchronously, whereas using trigger field will execute extraction on next redraw.

      Parameters:
      sceneManager - the scene manager of the viewer scene to be extracted.

      Returns:
      true on success.

    • ijkToXyzBox

      public SbBox3d ijkToXyzBox(SbBox3i32 ijkBox)
      Convert ijk box coordinates returned by boxComputed method to the bboxSceneGraph space.