Class SoVolumeData
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.inventor.nodes.SoNode
-
- com.openinventor.ldm.nodes.SoDataSet
-
- com.openinventor.volumeviz.nodes.SoVolumeData
-
- All Implemented Interfaces:
SafeDisposable
- Direct Known Subclasses:
SoHeightFieldGeometry
,SoHeightFieldProperty
,SoHeightFieldPropertyMask
,SoVolumeMask
public class SoVolumeData extends SoDataSet
Volume data property node. This class defines the data volume and its properties, and also provides utilities for extracting a subset of the volume and for resampling the volume. The data can be stored in memory, read from a file or accessed via a user-defined reader. This node provides the data for the volume rendering shape nodes (SoVolumeRender
,SoOrthoSlice
,SoObliqueSlice
, etc.) and is the parent class for some specialized data nodes (SoHeightFieldGeometry
,SoVolumeMask
, etc.).Note: Since the camera viewpoint is used to determine which part of the volume to load, the behavior of
SoVolumeData
is not correctly defined when no camera node has been traversed before theSoVolumeData
. This can result in console warnings.The data volume can be specified by:
- Setting the
fileName
field
This implies that the volume is stored on disk, in one of the file formats for which VolumeViz has a built-in reader. This is the most common way to load data. VolumeViz will automatically select a volume reader class based on the file extension, for example ".am" for the AmiraMesh file format. If the filename does not have an extension or does not have the appropriate extension, the application must specify a volume reader explicitly usingsetReader()
. See the supported file formats below.
Note that, unlike other nodes,SoVolumeData
and its derived classes do not search theSoInput
directory list to find files. - Calling the
setReader()
method
This is the most general method because an application can specify an instance of one of the standard VolumeViz readers or an instance of a custom subclass ofSoVolumeReader
.
You might use this method with a standard VolumeViz reader class if the data file's name has a non-standard extension. In other words, if VolumeViz will not be able to select the correct volume reader automatically, explicitly create an instance of the correct reader and pass it to thesetReader()
method.
VolumeViz will get the volume properties (dimensions, size, data type, etc) and access the volume data through the specified reader object. Creating an instance of a custom volume reader (seeSoVolumeReader
for more information) allows the application to completely control how, and from where, the data is loaded. For example the data could be accessed through an application specific API.
Note: When using a custom reader, any reader method that changes the volume properties (dimension, size, data type, etc) should notify theSoVolumeData
node by calling the reader'stouch()
method. If this notification is not done,SoVolumeData
fields, for exampleextent
, won't be updated correctly.
Applications can use thegetReader()
method to query the current volume reader, but should always verify the class type before using the returned object. - Setting the
data
field
This implies that the entire volume has already been loaded into a contiguous block of CPU memory. We call this an "in-memory" volume.
Volume reader: Note that when a file format reader or custom volume reader is currently being used, setting the data field will automatically replace the current volume reader. Subsequent calls togetReader()
will return anSoVRMemoryReader
.
Tile size: Note that VolumeViz always manages volume data internally as "tiles" and the default tile size is small. Generally you wll get better performance by explicitly setting a larger tile size (see the ldmResourceParameters field andSoLDMResourceParameters.tileDimension
).
Volume Properties:
- Dimensions
The dimensions of the volume (number of voxels on each axis) are normally determined by the volume reader from information in ithe data file(s), the number of images in the stack, etc. (When you set thedata
field directly you specify the volume dimensions.) You can query the volume dimensions using thedata
field. For example:SbVec3i32 voldim = volumeData.data.getSize(); - Extent
The geometric extent of the volume in 3D is initially determined by the volume reader but can also be set using theextent
field. The volume extent is the bounding box of the volume in world coordinates. Often the volume extent in 3D is set equal to the dimensions of the volume or to values that are proportional to the volume dimensions. For example, -1 to 1 on the longest axis of the volume and proportional values for the other axes puts the origin (0,0,0) at the center of the volume, simplifying rotations. However the volume extent can be any range, for example the range of line numbers in a seismic survey. The volume extent indirectly specifies the voxel size/spacing. You can query the current volume extent using theextent
field. For example:SbBox3f volext = volumeData.extent.getValue(); Notes:
- Modify extent: The application can change the volume extent (but not the dimensions) at any time. This changes the bounding box of the volume and scales the volume visualization nodes (
SoOrthoSlice
, etc) associated with the volume. Changing the volume extent effectively changes the voxel size. This is commonly used, for example, to scale a seismic volume along the time axis.
- Transform nodes: The volume extent and orientation (like geometry) can be modified by transformation nodes in the scene graph and this in turn modifies the appearance of volume visualization nodes (
SoVolumeRender
,SoOrthoSlice
, etc). However the same transformation must be applied to the volume data node as well as the volume rendering nodes associated with that volume. Effectively any transformation nodes that affect the volume must be placed before the volume data node.
- DICOM: For some data formats, including DICOM, the volume 'position' is considered to be the
center of the first voxel. VolumeViz considers the volume extent to include
all of the first and last voxels. Therefore the extent 'min' is the outside corner of the first voxel.
NOTE: Open Inventor versions < 9.8 do not automatically set the volume extent based on the Image Position Patient attribute. Use the MedicalHelper method dicomAdjustVolume.
- Modify extent: The application can change the volume extent (but not the dimensions) at any time. This changes the bounding box of the volume and scales the volume visualization nodes (
- Voxel size/spacing
If the volume data is uniformly sampled, the voxel size is the volume extent divided by the volume dimensions. The voxel size can be different for each axis (uniform along each axis). However VolumeViz is not limited to uniformly spaced voxels. VolumeViz also supports "rectilinear" coordinates where the voxel positions are explicitly given for each axis and also supports "projection" using theSoProjection
node (with some limitations). This allows rendering of volumes defined, for example, in cylindrical coordinates or geographic coordinates. - Data type
VolumeViz supports volumes containing scalar data as signed and unsigned integer values (byte, short, int) or floating point values. VolumeViz also supports volumes containing RGBA data (explicit color value for each voxel). In this case the data type is always unsigned integer. You can query if the volume contains explicit RGBA values by getting the value of thedataRGBA
field. The data type is determined by the reader (or when setting thedata
field). You can query the data type and/or number of bytes per voxel using methods inherited fromSoDataSet
. For example:int bytesPerVoxel = volumeData.getDataSize(); SoDataSet.DataTypes type = volumeData.getDataType(); - Data range
In volumes using data types larger than byte, the actual range of data values is usually smaller than the range of the data type. The application can use anSoDataRange
node to specify the range of values that will be mapped into the transfer function. For some formats the application can get min and max values from the meta-data. For DICOM data, seeSoVRDicomData
or the MedicalHelper method dicomAdjustDataRange(). In any case, the application can query the actual minimum and maximum values using the getMinMax methods. For example:double[] minmax = volumeData.getDoubleMinMax(); Note 1: These methods might force VolumeViz to load the entire data set if the volume reader does not implement the getMinMax query. For example in an LDM format data set, the min and max values are stored in the LDM header, so the query is very fast. For other data sets VolumeViz may be forced to load the entire data set and scan all the values to compute the min and max values.
Note 2: Changing the data range (SoDataRange
) may be slow if the size of the data values is larger than theSoDataSet.texturePrecision
setting. For example 32 bit values with texturePrecision = 8 or 16. In this case the data values must be re-scaled and resent to the GPU when the data range is changed. - Other:
Many other volume properties can be specified using fields ofSoDataSet
andSoVolumeData
. TheldmResourceParameters
field contains anSoLDMResourceParameters
object that controls, for example, the amount of CPU memory and GPU memory that the volume can use.
Basic volume visualization tools:
- The volume data is specified by an
SoVolumeData
node. (Multiple data sets can also be specified. See the next section.) - The region of voxels to be rendered (the "region of interest") can be specified using an
SoROI
node. This node limits the extent of all rendering nodes including slices. - The range of data values to be mapped into the transfer function can be specified using an
SoDataRange
node. - The color and opacity associated with each data value can be specified using an
SoTransferFunction
node. - The base material properties of the voxels, e.g. emissive and specular color, can be specified using an
SoMaterial
node. - Advanced rendering effects, e.g. lighting, and image quality settings can be specified using an
SoVolumeRenderingQuality
node. (Note: You should always enable lighting using this node, not the lighting field ofSoVolumeRender
.) Features include:- Lighting (gradient or deferred)
- Ambient occlusion
- Jittering (anti-aliasing)
- Gradient computation options
- Interpolation options
- Edge enhancement effects
- Cube rendering of voxels
- The
SoVolumeDataDrawStyle
node specifies the volume rendering style(s) for a volume or for a voxel region defined by anSoVolumeMask
node. The available rendering styles are hidden (not rendered), direct volume rendering, a set of isosurfaces and/or the region boundary surface. - Shadows can be enabled for volume rendering using an
SoShadowGroup
node. - Many parameters related to memory management and performance optimizations can be specified using
SoLDMGlobalResourceParameters
andSoLDMResourceParameters
. - VolumeViz provides many different ways of visualizing volume data, including:
SoOrthoSlice
: Renders a single axis aligned slice.SoObliqueSlice
: Renders a single arbitrarily aligned slice.SoFenceSlice
: Renders a "strip" of connected oblique slices.SoVolumeSkin
: Renders the faces of the current Region of Interest (seeSoROI
). Effectively a set of ortho slices.SoVolumeIndexedFaceSet
(etc): Renders a "slice" made up of arbitrary geometry, for example a curved or cylindrical slice.SoVolumeIsosurface
: Renders the isosurface defined by the specified data value. (This is done completely on the GPU. To get the geometry of an isosurface back on the CPU see the MeshViz extension.)SoVolumeRender
: Renders the volume using direct volume rendering.
Advanced volume visualization:
- Custom shaders Custom transfer functions, custom rendering effects and custom blending are just a few of the many possibilities that can be specified using an
SoVolumeShader
node and GLSL shader functions. VolumeViz provides a framework of prebuilt shader functions for commonly used calculations and effects. This allows applications to extend or replace stages in the rendering pipeline while still taking advantage of other VolumeViz features. - Clipping
Volume visualizations can be clipped in multiple ways:- Volume visualizations can be clipped by clipping planes (
SoClipPlane
) like any other Open Inventor geometry. (However for clipping against axis aligned planes, using anSoROI
node is much more efficient.) - Volume visualizations can be clipped against a box specified in voxel coordinates using an
SoROI
node. The box can be modified by a secondary exclusion box, allowing cut-away views like the "chair cut" in seismic visualization. - Volume visualizations can be clipped against arbitrary polygonal geometry using an
SoVolumeClippingGroup
node. The clipping geometry can be any closed shape, for example a cylinder or a shape extruded from a polygon. - Volume visualizations can be clipping against a surface defined by a "height
field" (for example a seismic horizon) using an
SoUniformGridClipping
node. - Volume visualizations can be clipped against an arbitrary voxel region using an
SoVolumeMask
node.SoVolumeMask
also allows applying different transfer functions to different regions and other powerful features. - Multiple clipping techniques may be combined to "sculpt" volume regions.
- Volume visualizations can be clipped by clipping planes (
- Interactivity
VolumeViz allows the creation of highly interactive volume rendering applications:- Picking works for volume rendering objects like for any other Open Inventor geometry. For example the application can determine which slice was clicked when a mouse button event occurs. Specialized sub-classes of
SoDetail
provide more specific information for each rendering class. For exampleSoOrthoSliceDetail
provides the IJK coordinates and value of the specific voxel under the cursor. - VolumeViz provides specialized draggers and manipulators to allow users to directly interact with volume rendering scenes. For example,
SoOrthoSliceDragger
allows dragging a slice through the volume andSoROIManip
allows moving and resizing a region of interest (SoROI
). - Modifying VolumeViz property nodes (like any Open Inventor node) automatically causes the scene graph to be re-rendered. For example the color map can be dynamically changed by modifying the fields of
SoTransferFunction
. - The volume itself can be modified interactively using the "volume edit" methods (
startEditing
,finishEditing
, etc) in this class. Volume editing supports undo and redo and modifications can be saved back to the data source. Convenience methods are provided to modify voxels in a subvolume, a tile or a region defined by a closed polygonal surface. - Very large volumes and/or advanced rendering options may reduce the rendering performance even on high-end graphics hardware. VolumeViz provides multiple options for temporarily reducing the rendering complexity while interacting with the scene. See the lowResMode field in
SoVolumeRender
and also theSoInteractiveComplexity
node.
- Picking works for volume rendering objects like for any other Open Inventor geometry. For example the application can determine which slice was clicked when a mouse button event occurs. Specialized sub-classes of
- Transforming data
Volume data can transformed "on the fly" at several stages in the pipeline:- The
SoLDMDataTransform
class (see the dataTransform field ofSoDataSet
) applies a computation to each LDM data tile requested from the volume reader before the tile is stored in system memory. This can be used to apply "static" filters to the data, for example to apply DICOM Rescale Slope and Intercept values. - The
SoVolumeTransform
node applies a computation to the LDM data tiles just before they are sent to the GPU. This can be used to apply dynamic filters to the data, for example computing seismic attribute values. - Both mechanisms can be used to create multiple data sets from a single data set.
- The
- Multiple data sets
- Multiple
SoVolumeData
nodes can be inserted in the same scene graph. - If the volumes are independent and rendered separately, use an
SoVolumeGroup
node to manage and correctly render intersecting regions. - More commonly multiple volumes will be combined into a single data set or single rendering using
data compositing or
render compositing. In these cases use an
SoMultiDataSeparator
as the parent of the nodes that will be composited. - Render compositing (see
SoVolumeShader
) means combining multiple volumes on the GPU at render time using a fragment shader. Render compositing can be used, for example, to implement "co-blending" of multiple volumes or to implement multi-channel color combining. - Data compositing allows you to combine multiple volumes (see
SoDataCompositor
) on the CPU at data loading time. Data compositing can be used, for example, to visualize the difference between two data sets. - (More details below)
- Multiple
- Data Access
LDM is a powerful data manager for large volume data and VolumeViz provides a Data Access API that allows applications to take advantage of this for applying algorithms to their volume data.SoLDMDataAccess
provides the methods to extract data from a volume. The data is accessible whether theSoVolumeData
is part of a scene graph or not.- Data access methods can be invoked synchronously or asynchronously to allow simultaneous loading and computation. The application can request data at any resolution level, independent of the resolution level currently being used for rendering
- VolumeViz supports a variety of data requests including:
- Subvolume: The set of voxels inside a specified subvolume.
- Plane: The set of voxels intersecting an arbitrary plane.
- Line: The set of voxels intersecting an arbitrary line.
- Trace: A column of axis aligned voxels (e.g. a seismic trace).
- Polyline: The set of voxels intersecting an arbitrary polyline.
- Tile: Direct access to the tile containing a specified voxel.
- Extracted, modified or synthesized data can be written to an LDM format file by subvolume or tile using the
SoLDMWriter
class.
- Computation
Volume computations can take advantage of the Open Inventor computing framework to manage data, devices and algorithms on the CPU and GPU.- The
SoBufferObject
class abstracts data management. Each buffer object is an instance of a device specific data object, for exampleSoCpuBufferObject
. This allows the application to control where memory is actually allocated. It also allows algorithms to be implemented on CPU or GPU (or both) usingSoBufferObject
without knowing where the memory is allocated (Open Inventor will transfer when necessary). - The
SoDevice
class abstracts computing and rendering devices. Device specific classes, for exampleSoCpuDevice
, allow querying the number of available devices, available memory and other properties. - The computing framework classes are integrated with the data transform, compositing and data access classes mentioned previously.
- The
Multiple data sets:Multiple
SoVolumeData
nodes can be inserted in the same scene graph. If the volumes are independent and rendered separately, use anSoVolumeGroup
node to manage and correctly render intersecting regions. More commonly multiple volumes will be combined together in a single rendering using render compositing (SoVolumeShader
) or data compositing (SoDataCompositor
). In these cases you must use anSoMultiDataSeparator
as the parent of the nodes that will be composited.Render compositing (
SoVolumeShader
orSoVolumeRenderingQuality
) is a way of combining multiple volumes on the GPU at render time using a GLSL fragment shader. The volumes can each have their own transfer function or they can all use the same one. Render compositing can be used, for example, to implement "co-blending" of multiple volumes or to implement multi-channel color combining. The number of volumes to compose is limited by the number of OpenGL texture units supported by the graphics board (normally at least 16). This number is returned by thegetMaxNumDataSets
function.Data compositing allows you to combine multiple volume data sets (see
SoDataCompositor
) or to transform a single data set in memory (see #setLDMDataTransformFunction()) instead of storing the combined data sets on disk. For example, it can be used to visualize the result of the difference between two data sets. There is no limit on the number of volumes that can be composed on the CPU.Note that the word composition is also used in
SoVolumeRender
. There it refers to the way that samples along the raycasting ray are combined to form the final image.The
dataSetId
field is used to differentiateSoVolumeData
nodes when doing render or data compositing.Some rules must be observed when doing render or data compositing:
- Each
SoVolumeData
node must have a uniquedataSetId
.
- All the
SoVolumeData
nodes to be composited must have the same volume dimensions (number of voxels in X, Y, and Z) and tile size.
- All the
SoVolumeData
nodes to be composited, as well as the compositing node (e.g.SoVolumeShader
orSoVolumeRenderingQuality
) and the rendering node (e.g.SoVolumeRender
), must be under anSoMultiDataSeparator
node. - The
SoVolumeData
nodes to be composited must be all scalar data sets or all RGBA data sets. To composite scalar and RGBA data sets under the sameSoMultiDataSeparator
, set the usePalettedTexture field to false in the scalar dataset'sSoVolumeData
node to force the scalar data to be converted into RGBA data. - An
SoVolumeData
node used in a data compositing scheme must not be inserted multiple times in the scene graph. Use another volume data node pointing to the same file. - Each
SoVolumeData
node has its own resource settings (see fieldldmResourceParameters
). The resources required for the composition are the sum of the resources for all of theSoVolumeData
nodes involved.
When using a fragment shader to do render compositing, texture coordinates can be retrieved from texture unit 0 (texture coordinates are sent using glTexCoord function). To minimize the number of texture units needed, all the transfer functions (see
SoTransferFunction
) for the volumes to be composited are stored in a single 2D texture. By default this texture is loaded in texture unit 0. However this default behavior can be changed throughSoPreferences
using the environment variable IVVR_TF_TEX_UNIT. Each volume's data is loaded in the texture unit specified by itsdataSetId
. Therefore do not setdataSetId
to the texture unit used to store the transfer functions.Please see
SoMultiDataSeparator
andSoVolumeShader
for more information, and example code, for compositing multiple volumes.
RGBA DataVoxels in an RGBA volume are UNSIGNED_INT32, containing 8 bits each of Red, Green, Blue and Alpha. All rendering nodes (slices, volume rendering, etc) work with RGBA volumes. Region of Interest, clipping and other features also work with RGBA volumes. However because the volume already specifies the colors to be used for rendering, the data range, transfer function and some rendering features are ignored. Lighting works with RGBA volumes using gradient vectors computed from the luminance value of the voxels.
Notes:
- In-memory volumes
For compatibility with older versions of Open Inventor, if the data is in-memory the unsigned int values must contain ABGR values, not RGBA. Use theSbColor
getPackedValueEndiannessOrder() method to convert values, not the getPackedValue() method. - Texture compression
TheuseCompressedTexture
option (seeSoDataSet
) is true by default. This can significantly reduce the amount of GPU memory required to hold an RGBA volume. But it uses a "lossy" compression algorithm which may result in values on the GPU being slightly different than the actual value in the volume. For example "gray scale" colors could have a slight color in some cases. You should always set this option to false when using "RGBA" data to store 32-bit "id" values. Please also note that this compression is not supported on Intel GPUs, so you should set this option to false in this case as well.
Volume EditingVolume editing is based on transactions. A transaction is created by calling the following methods:
int transactionId = volumeData.startEditing(); //... editing calls ... volumeData.finishEditing(transactionId); finishEditing()
. After the transaction is finished, this id can also be used to undo or redo the transaction. The finish method will schedule a redraw so the modified data is displayed. Multiple transactions may be active at the same time.
After a transaction is finished, the effect can be undone by callingundoEditing()
with the transaction id. Undo also schedules a redraw so the correct data is displayed. Similarly a transaction that was undone can be re-applied by callingredoEditing()
with the transaction id.Calling
saveEditing()
will update the data source associated with thisSoVolumeData
node with all edits performed on the volume since the last save. Updating is done using theSoVolumeWriter
returned by the currentSoVolumeReader
. The save method may only be called when no transactions are active, i.e. after finish has been called for all transactions.
Note:- Until the edits have been saved, memory is required for both the original data and the modified data. This implies both an additional memory requirement and that buffer objects passed to (for example)
editSubVolume()
must not be modified until after thesaveEditing()
call. - After the edits have been saved, all transaction ids are invalid, so undo and redo can no longer be called with those transaction ids.
- saveEditing currently only works for data loaded using SoVRLDMFileReader (an LDM format tiled data set) or
SoVRMemoryReader
(data set completely in memory). - VolumeViz applies edition transaction on the fly each time a tile is requested. Thus, loading, data access and picking performance may be impacted. To retrieve initial performances, you may have to call
saveEditing()
to flush editing transactions.
VolumeViz provides multiple methods to modify data including:
- Fill a subvolume with a value or a buffer of values (
editSubVolume()
) - Fill a tile with a specified value or a buffer of values (
editTile()
) - Fill a list of cubic subvolumes with a value (editBoxes() )
- Fill the voxels inside a closed polygonal solid with a value (
editSolidShape()
) - Fill the voxels intersecting a polygonal surface with a value (
editSurfaceShape()
)
Supported file formats:File extension Reader class Description .am SoVRAmFileReader
Avizo Mesh file format .dc3, .dic, .dicom SoVRDicomFileReader
DICOM file format .fld SoVRAvsFileReader
AVS field file format .lda or .ldm SoVRLdmFileReader
LDM file format .sgy or .segy SoVRSegyFileReader
SEG Y rev 1 file format .vol SoVRVolFileReader
Vol file format .vox SoVRVoxFileReader
Vox file format .lst SoVRRasterStackReader
Lst file format File format notes:
- Avizo mesh
Avizo mesh is a general purpose file format that can contain many different kinds of data. The VolumeViz file reader can load Avizo mesh files containing a 3-dimensional "Lattice" data object with uniform coordinates and any data type. SeeSoVRAmFileReader
for limitations.
Note: Unlike Amira and Avizo, VolumeViz cannot automatically open Amira/Avizo format data files unless they have the file name extension ".am". To open an Amira/Avizo data file with a different extension, the application must explicitly create an instance ofSoVRAmFileReader
and use thesetReader()
method. - AVS field
AVS field is a general purpose file format that can contain many different kinds of data. The VolumeViz file reader can load AVS field files containing 3-dimensional, uniform data of type "byte". SeeSoVRAvsFileReader
. - DICOM
A widely used format for storing medical image data (CT, MRI, etc), defined by the National Electrical Manufacturers Association (NEMA) (medical.nema.org). SeeSoVRDicomFileReader
- LDM
LDM is a format defined by VSG for storing hierarchical multi-resolution volume data. VolumeViz includes a utility program that can convert any other format supported by VolumeViz into this format (seeSoVolumeConverter
). Preprocessing volume data into this format provides the maximum benefits from the VolumeViz large data management (LDM) features. SeeSoVRLdmFileReader
. - SEGY
A widely used format for storing seismic trace data, defined by the Society of Exploration Geophysicists publication "Digital Tape Standards" (www.seg.org). The VolumeViz reader supports all sizes of integer and float data, and can correctly determine the number of samples per trace in many cases. However the reader also has many options to adapt to differences in SEGY file headers. SeeSoVRSegyFileReader
. - VOL
A simple volume interchange format (see "Introduction to Volume Rendering", Lichtenbelt, Crane, Naqvi, 1998). The VolumeViz reader can load files containing 8- or 16-bit voxels. SeeSoVRVolFileReader
. - VOX
A volume interchange format defined by TeraRecon Inc. (www.terarecon.com). The VolumeViz reader can load "Vox1999a" files containing 8- or 16-bit voxels (first volume only). See SOVRVoxFileReader. - LST (stack of images)
A simple format for loading a stack of images. Specify the names of the image files in a .lst file. VolumeViz can load image data in most common image formats including BMP, DDS, GIF, JPEG, JPEG2000, PNG and TIFF. SeeSoVRRasterStackReader
for details and limitations.
Note: '3D TIFF' files (multiple images in one file) are not currently supported.
File format/default:
VolumeData {
allocateResourceOnRender false data NODATA 0 0 0 UBYTE 8 dataRGBA false dataSetId 1 dataTransform NULL extent -1 -1 -1 1 1 1 fileName "" texturePrecision 0 undefinedValue NaN useCompressedTexture true useExtendedData false usePalettedTexture true useSharedPalettedTexture true Action behavior:
SoCallbackAction
,SoGLRenderAction
,SoGetBoundingBoxAction
,SoPickAction
,SoWriteAction
Sets volume data parameters in the traversal state.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoVolumeData.Axis
Which axis to handle.static class
SoVolumeData.CoordinateTypes
Coordinate type used by this data set.static class
SoVolumeData.OverMethods
Deprecated.As of Open Inventor 9.0.0.0.static class
SoVolumeData.StorageHints
Deprecated.As of Open Inventor 8.6.0.0.static class
SoVolumeData.SubMethods
Deprecated.As of Open Inventor 9.0.0.0.-
Nested classes/interfaces inherited from class com.openinventor.ldm.nodes.SoDataSet
SoDataSet.DataTypes, SoDataSet.LDMDataModifier, SoDataSet.ValueInterpretations
-
Nested classes/interfaces inherited from class com.openinventor.inventor.nodes.SoNode
SoNode.RenderModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
Fields Modifier and Type Field Description SoSFArray3D
data
Specifies the volume data, including dimensions, data type and number of significant bits.SoSFBool
dataRGBA
Contains true if the volume contains RGBA values rather than scalar values.SoSFBool
useExtendedData
If true, VolumeViz stores an additional copy of each loaded tile.SoSFBool
usePalettedTexture
For a volume containing scalar data values, controls whether scalar values (true) or RGBA values (false) are loaded on the GPU (the name is historical).SoSFBool
useSharedPalettedTexture
Note: On graphics boards that support programmable shaders, this field is ignored (virtually all graphics boards support programmable shaders).-
Fields inherited from class com.openinventor.ldm.nodes.SoDataSet
allocateResourceOnRender, dataSetId, dataTransform, extent, fileName, ldmResourceParameters, texturePrecision, undefinedValue, useCompressedTexture, valueInterpretation
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoVolumeData()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
doAction(SoAction action)
int
editSolidShape(SoNode solidShape, double value)
Replaces all voxels intersecting the given shape with the specified value.int
editSubVolume(SbBox3i32 subVolume, double value)
Replaces the contents of a subvolume with the specified value.int
editSubVolume(SbBox3i32 subVolume, SoBufferObject userData)
Replaces the contents of a subvolume with the given data.int
editSurfaceShape(SoNode surfaceShape, float thickness, double newValue)
Replaces all voxels intersecting the polygons or lines defined by the surfaceShape and given thickness with the specified value.int
editTile(SoLDMTileID tileId, double value)
Replaces the contents of a tile with the specified value.int
editTile(SoLDMTileID tileId, SoBufferObject userData)
Replaces the contents of a tile with the given data.boolean
finishEditing(int transactionId)
Terminates an editing transaction.SoVolumeData.CoordinateTypes
getCoordinateType()
double[]
getDoubleMinMax()
Returns min and max values of the data set.long[]
getHistogram()
Returns the histogram of the volume data.long[]
getMinMax()
Returns min and max values of the data set data.float[]
getRectilinearCoordinates(SoVolumeData.Axis axis)
Returns a vector describing mapping from uniform space to rectilinear space.int
getRenderUnitID()
int
getTexMemorySize()
Deprecated.As of Open Inventor 9.0.0.0.void
GLRender(SoGLRenderAction action)
boolean
redoEditing(int transactionId)
Redo all modifications associated with the specified transaction id.SoVolumeData
reSampling(SbVec3i32 dimension, SoVolumeData.SubMethods subMethod)
Deprecated.SoVolumeData
reSampling(SbVec3i32 dimension, SoVolumeData.SubMethods subMethod, SoVolumeData.OverMethods name_24864)
Deprecated.As of Open Inventor 9.0.0.0.void
setRGBAData(boolean flag)
Force data to be considered as RGBA values.void
setTexMemorySize(int size)
Deprecated.As of Open Inventor 9.0.0.0.int
startEditing()
Initiate an editing transaction.SoVolumeData
subSetting(SbBox3i32 region)
Deprecated.As of Open Inventor 9.0.0.0.boolean
undoEditing(int transactionId)
Undo all modifications associated with the specified transaction id.void
updateRegions(SbBox3i32[] region)
Updates regions of the volume that have been modified.void
useFakeData(SoLDMTileID name_24949, SoBufferObject name_24950)
Creates fake data in buffer.-
Methods inherited from class com.openinventor.ldm.nodes.SoDataSet
callback, dataSize, editBoxes, getBoundingBox, getDataSize, getDataType, getDatumSize, getDimension, getLdmDataAccess, getLDMReader, getLDMTopoOctree, getMaxNumDataSets, getOverlapping, getReader, getTileDimension, handleEvent, hasEditedTile, isDataFloat, isDataInMemory, isDataSigned, isInMemory, numSigBits, pick, readTile, resetReader, saveEditing, setLDMDataModifier, setLDMReader, setReader, setReader, voxelToXYZ, voxelToXYZ, write, writeTile, XYZToVoxel, XYZToVoxel
-
Methods inherited from class com.openinventor.inventor.nodes.SoNode
affectsState, copy, copy, distribute, getAlternateRep, getByName, getMatrix, getPrimitiveCount, getRenderEngineMode, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, isBoundingBoxIgnoring, isOverride, rayPick, search, setOverride, touch
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Field Detail
-
usePalettedTexture
public final SoSFBool usePalettedTexture
For a volume containing scalar data values, controls whether scalar values (true) or RGBA values (false) are loaded on the GPU (the name is historical). The default is true, meaning to load scalar values on the GPU. This implies that the GPU will interpolate between data values and the GPU will apply the color map. Using scalar values has several advantages and is the recommended setting in most cases. Loading scalar values (generally) uses less GPU memory per voxel and the color map can be changed interactively because no volume data needs to be reloaded on the GPU. Also note that interpolating between color values (rather than data values) could result in unexpected colors that are not even part of the color map. The size (in bytes) of the scalar values on the GPU is determined by thetexturePrecision
field.If this field is false, the color map is applied on the CPU and the resulting RGBA values are loaded on the GPU. This implies that the GPU will interpolate between color values. There are a few cases where this setting is better. For example, interpolating between data values could create values that not actually in the data set. Also, applying the color map on the CPU means that a very large color map can be used because the size is not limited by the maximum texture size on the GPU.
If the volume contains explicit RGBA values, then this field is ignored and RGBA values are sent to the GPU.
-
useSharedPalettedTexture
public final SoSFBool useSharedPalettedTexture
Note: On graphics boards that support programmable shaders, this field is ignored (virtually all graphics boards support programmable shaders).
Controls use of the OpenGL shared texture palette extension (if available). false means don't use it. Default is true. On machines that support paletted textures, using a shared palette conserves texture memory because a single palette (color map) can be used for all the textures.
-
useExtendedData
public final SoSFBool useExtendedData
If true, VolumeViz stores an additional copy of each loaded tile. There is an additional memory cost but the performance ofSoOrthoSlice
roaming will be roughly the same along each axis.- Since:
- Open Inventor 6.0
-
data
public final SoSFArray3D data
Specifies the volume data, including dimensions, data type and number of significant bits. Use this field if your volume data is already loaded into memory in a contiguous block of memory. Otherwise use thefileName
field or thesetReader
method.The numSigBits parameter of
SoSFArray3D.setValue
indicates the number of bits really used for each value. If it equals 0, that means to use all bits, e.g., 8 bits if type = UNSIGNED_BYTE, 16 bits if type = UNSIGNED_SHORT and so on. This parameter is useful particularly when textures are loaded in paletted mode. Currently most hardware supports only 8 bits, so VolumeViz must discard the least significant bits. For example if type is UNSIGNED_SHORT, by default in paletted mode VolumeViz will discard the lowest 8 bits. If you specify numSigBits = 10, VolumeViz will discard only the lowest 2 bits.Calling
SoSFArray3D.setValue
with a CopyPolicy set to NO_COPY is equivalent to calling the deprecated SoVolumeData.setValue method.Volume reader: Note that when a file format reader or custom volume reader is currently being used, setting the data field will automatically replace the current volume reader. Subsequent calls to
getReader()
will return anSoVRMemoryReader
.- Since:
- Open Inventor 7.1
-
dataRGBA
public final SoSFBool dataRGBA
Contains true if the volume contains RGBA values rather than scalar values. Default is false.This field is set automatically by volume readers. If the application is setting an in-memory volume into the
data
field, thedata
field must be set to UNSIGNED_INT32 format and thedataRGBA
field must be set to true.Note that, for compatibility with older versions of Open Inventor, if the data is in-memory the the unsigned int values must contain ABGR values, not RGBA. Use the
SbColor
getPackedValueEndiannessOrder() method to convert values, not the getPackedValue() method.- Since:
- Open Inventor 9.0
-
-
Method Detail
-
getHistogram
public long[] getHistogram()
Returns the histogram of the volume data. This method must be used for ldm files and can be used for the others format.
-
reSampling
@Deprecated(since="9.0.0.0") public SoVolumeData reSampling(SbVec3i32 dimension, SoVolumeData.SubMethods subMethod)
Deprecated.Calls reSampling(dimension, subMethod, SoVolumeData.OverMethods.valueOf( SoVolumeData.OverMethods.NONE.getValue() )).
-
setTexMemorySize
@Deprecated(since="9.0.0.0") public void setTexMemorySize(int size)
Deprecated.As of Open Inventor 9.0.0.0. No longer used. Please use SoLDMRessourceParameter maxTexMemory field.Specifies the maximum texture memory size to use in mega texels. 64 is the default.Warning Deprecated since Open Inventor 9000. No longer used. Please use SoLDMRessourceParameter maxTexMemory field.
-
undoEditing
public boolean undoEditing(int transactionId)
Undo all modifications associated with the specified transaction id. Returns true if successful. On error does nothing. May only be called after the specified transaction has been terminated (seefinishEditing()
method). Schedules a redraw so the correct data is displayed.Note: Undo is no longer available after transactions are saved. After calling
saveEditing()
, the transaction ids are no longer valid and the modified data is the new reference.- Overrides:
undoEditing
in classSoDataSet
-
updateRegions
public void updateRegions(SbBox3i32[] region)
Updates regions of the volume that have been modified. This method notifies VolumeViz that voxels in the specified regions have been modified by the application and textures may need to be recreated. Only bricks currently needed for rendering some volume geometry, e.g., a slice or subvolume, are immediately updated.
-
getTexMemorySize
@Deprecated(since="9.0.0.0") public int getTexMemorySize()
Deprecated.As of Open Inventor 9.0.0.0. No longer used. please use SoLDMRessourceParameter maxTexMemory field.Returns the maximum texture memory size to use in mega texels.Warning Deprecated since Open Inventor 9000. No longer used. please use SoLDMRessourceParameter maxTexMemory field.
-
subSetting
@Deprecated(since="9.0.0.0") public SoVolumeData subSetting(SbBox3i32 region)
Deprecated.As of Open Inventor 9.0.0.0. No longer supported. Please use SoLDMDataAccess class.Extracts the data volume defined by region. If a reader is specified, the original volume data is not loaded.Warning Deprecated since Open Inventor 9000. No longer supported. Please use
SoLDMDataAccess
class.
-
getMinMax
public long[] getMinMax()
Returns min and max values of the data set data.
Returns nullif the requested data is not available (for example, if no data set exists).
NOTE: This method might force LDM to load the entire data set if the volume reader does not respond to the getMinMax query. Normally for an LDM format data set, the min and max values are stored in the LDM header. For a non-LDM data set, if a filename and/or reader have been specified and the data set has not yet been loaded, LDM will load the entire data set to compute the min and max values. For a large data set this may take a long time.
-
getDoubleMinMax
public double[] getDoubleMinMax()
Returns min and max values of the data set.
Returns nullif the requested data is not available (for example, if no data set exists).
NOTE: This method might force LDM to load the entire data set if the volume reader does not respond to the getMinMax query. Normally for an LDM format data set, the min and max values are stored in the LDM header. For a non-LDM data set, if a filename and/or reader have been specified and the data set has not yet been loaded, LDM will load the entire data set to compute the min and max values. For a large data set this may take a long time.- Overrides:
getDoubleMinMax
in classSoDataSet
-
reSampling
@Deprecated(since="9.0.0.0") public SoVolumeData reSampling(SbVec3i32 dimension, SoVolumeData.SubMethods subMethod, SoVolumeData.OverMethods name_24864)
Deprecated.As of Open Inventor 9.0.0.0. No longer supported. Please use SoLDMDataAccess class.Re-samples the volume down to or up to the given dimension using the sub-sampling methodSubMethod()
and the over-sampling methodOverMethod()
. If a reader is specified, the original volume data is not loaded.Over-sampling is not yet implemented. NONE (default) indicates that no over-sampling is performed. For example if the original dimension is 256x256x64 and the reSampling dimension is 128x128x128, the result is a volume of dimension 128x128x64.
Warning Deprecated since Open Inventor 9000. No longer supported. Please use
SoLDMDataAccess
class.
-
redoEditing
public boolean redoEditing(int transactionId)
Redo all modifications associated with the specified transaction id. Returns true if successful. On error does nothing. May only be called after the specified transaction has been terminated (seefinishEditing()
method) and undone (seeundoEditing()
method). Schedules a redraw so the correct data is displayed.Note: Redo is no longer available after transactions are saved. After calling
saveEditing()
, the transaction ids are no longer valid and the modified data is the new reference.- Overrides:
redoEditing
in classSoDataSet
-
editSubVolume
public int editSubVolume(SbBox3i32 subVolume, double value)
Replaces the contents of a subvolume with the specified value.
The subvolume is specified in voxel/cell coordinates. CallstartEditing()
before calling this method. Returns 0 if successful.- Overrides:
editSubVolume
in classSoDataSet
-
editTile
public int editTile(SoLDMTileID tileId, double value)
Replaces the contents of a tile with the specified value.
CallstartEditing()
before calling this method. Returns 0 if successful.
-
editSubVolume
public int editSubVolume(SbBox3i32 subVolume, SoBufferObject userData)
Replaces the contents of a subvolume with the given data.
The buffer size (in bytes) must match the subvolume size (in bytes) exactly. The subvolume is specified in voxel/cell coordinates. CallstartEditing()
before calling this method. Returns 0 if successful.Warning The modification may be postponed until the tiles are really needed. Therefore the contents of the userData buffer must not be modified until after
saveEditing()
is called.- Overrides:
editSubVolume
in classSoDataSet
-
editSurfaceShape
public int editSurfaceShape(SoNode surfaceShape, float thickness, double newValue)
Replaces all voxels intersecting the polygons or lines defined by the surfaceShape and given thickness with the specified value. surfaceShape is defined in the same 3D space as the dataSet. thickness is defined in voxels. The surfaceShape can be deleted after calling this function.Call
startEditing()
before calling this method. Returns 0 if successful.Warning The modification may be postponed until the tiles are really needed. Therefore the surfaceShape node (and children if any) must not be modified until after
saveEditing()
is called.- Overrides:
editSurfaceShape
in classSoDataSet
-
finishEditing
public boolean finishEditing(int transactionId)
Terminates an editing transaction.
Returns true if successful. May only be called with a valid transaction id returned by thestartEditing()
method. On error does nothing. The finish method will schedule a redraw so the correct data is displayed. To commit the edits, in other words to save the edited data back to the data source, callsaveEditing()
.- Overrides:
finishEditing
in classSoDataSet
-
getRenderUnitID
public int getRenderUnitID()
- Overrides:
getRenderUnitID
in classSoNode
-
editSolidShape
public int editSolidShape(SoNode solidShape, double value)
Replaces all voxels intersecting the given shape with the specified value. The geometry defined under solidShape must represent a list of closed surfaces otherwise the result is unpredictable. solidShape must not contain any lines or open polyhedrons (polyhedron with shapes). The result is based on the odd-winding rule, so the result is not necessarily the union or the intersection of the closed surfaces. If you want to voxelize lines or single polygons, see also theeditSurfaceShape
method.If the goal is to define a shape which is the result of the intersection/union of multiple closed surfaces, see the
SoCSGShape
node.solidShape is defined in the same 3D space as the dataSet. The solidShape can be deleted after calling this function.
Call
startEditing()
before calling this method. Returns 0 if successful.Warning The modification may be postponed until the tiles are really needed. Therefore the surfaceShape node (and children if any) must not be modified until after
saveEditing()
is called.- Overrides:
editSolidShape
in classSoDataSet
-
useFakeData
public void useFakeData(SoLDMTileID name_24949, SoBufferObject name_24950)
Creates fake data in buffer.- Overrides:
useFakeData
in classSoDataSet
-
setRGBAData
public void setRGBAData(boolean flag)
Force data to be considered as RGBA values.
Note that this call should be used only when setting data from memory through thedata
field and the data format must be UNSIGNED_INT32.
-
GLRender
public void GLRender(SoGLRenderAction action)
-
getCoordinateType
public SoVolumeData.CoordinateTypes getCoordinateType()
-
editTile
public int editTile(SoLDMTileID tileId, SoBufferObject userData)
Replaces the contents of a tile with the given data.
The buffer size (in bytes) must match the tile size (in bytes) exactly. CallstartEditing()
before calling this method. Returns 0 if successful.Warning The modification may be postponed until the tile is really needed. Therefore the contents of the userData buffer must not be modified until after
saveEditing()
is called.
-
startEditing
public int startEditing()
Initiate an editing transaction.
Returns true if successful and also returns a unique transaction id. This value is required for finishing the edit transaction (seefinishEditing()
) and for undo/redo (seeundoEditing()
andredoEditing()
). Multiple transactions may be active at the same time.- Overrides:
startEditing
in classSoDataSet
-
getRectilinearCoordinates
public float[] getRectilinearCoordinates(SoVolumeData.Axis axis)
Returns a vector describing mapping from uniform space to rectilinear space. You can specify that you want the vector to return the coordinates from the X, Y, or Z axis.
-
-