public class SoLDMDataAccess extends Inventor
SoVolumeData
is part of a scene graph or not. These methods are only valid in LDM mode (which is the default mode). The Data Access API automatically takes advantage of LDM multi-threaded data loading when multiple tiles (not already in cache) are needed to complete the request.
The Data Access API automatically loads all data required to satisfy the request and can be invoked asynchronously to allow simultaneous loading and computation. The application can request data at any resolution level, e.g. full resolution (level 0) data, independent of the resolution level currently being used for rendering. For some requests, e.g. line and plane, the application can also specify a subvolume (region of interest) that limits the extent of the data request.
SoLDMDataAccess
provides the following data requests:
Each data request returns an information struct specific to the request type. For example, SoLDMDataAccess.DataInfoBox is returned by the subvolume request. All these structs contain an errorFlag member containing the result of the request and a bufferSize member containing the amount of data (in bytes) returned. The application should always check these values. Note that even when errorFlag is CORRECT, bufferSize may be zero, meaning no data was returned. This happens, for example, if the specified plane is completely outside the volume.
The application is responsible for allocating and freeing the memory to store the requested data. Calling the data request method with a null bufferObject will return the size of the memory needed, in bytes, in the
bufferSize member of the information struct. Once the buffer is allocated, a second call will extract the data from the volume. Since Open Inventor 8.0 we recommend using the methods that return data into an SoBufferObject
. Because this class abstracts access to data stored on different devices it is possible, for example, to conveniently fetch data into CPU memory or directly into CUDA or OpenCL memory.
Each data request can be either synchronous or asynchronous. Synchronous means that all the data will be loaded before the function returns. Asynchronous means that the function will return immediately and you will be notified when the data is actually available. This allows the application to continue to work while the data is being loaded, for example to overlap data loading and computation. Synchronous access is done using the getData methods.
To do asynchronous access, you must create a new class derived from SoLDMDataAccess
and implement your own version of the endRequest method. Begin a request by calling the appropriate requestData method. This method will return a requestId.
Three different modes are available to control how data is requested from the volume reader when the necessary tiles are not already present in LDM cache memory:
Note that DIRECT access requires that specific methods are implemented in the data set reader, for example readXSliceInTile (see SoLDMReader
and SoVolumeReader
). The default LDM reader implements these methods for the standard Open Inventor LDM file format. Custom LDM readers may need to be enhanced.
The following example shows how to extract a subvolume from a given volume.
Modifier and Type | Class and Description |
---|---|
class |
SoLDMDataAccess.DataInfo
Information about returned data when using a pointer to access the data rather than copying the data.
|
class |
SoLDMDataAccess.DataInfoBox
Information about data returned for an arbitrary box (subvolume).
|
class |
SoLDMDataAccess.DataInfoLine
Information about data returned for an arbitrary line intersecting
a specified subvolume.
|
class |
SoLDMDataAccess.DataInfoPlane
Information about data returned for an arbitrary plane intersecting a specified
subvolume.
|
class |
SoLDMDataAccess.DataInfoTrace
Information about data returned for an arbitrary trace intersecting
a specified subvolume.
|
static class |
SoLDMDataAccess.ErrorValues
Error Code values.
|
static class |
SoLDMDataAccess.GetDataModes
Specifies the way data is requested from the volume reader when the necessary tiles are not already present in LDM cache memory.
|
Inventor.ConstructorCommand
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoLDMDataAccess()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
endRequest(int requestId)
This method is called each time a data request is finished, meaning that the data requested asynchronously is now available.
|
SoLDMDataAccess.DataInfoBox |
getData(int resolution,
SbBox3i32 subVolume)
Convenient method to get the required size of the application buffer: call
getData(resolution, subvolume, null).
|
SoLDMDataAccess.DataInfoBox |
getData(int resolution,
SbBox3i32 subVolume,
java.nio.Buffer buffer)
Deprecated.
use
getData(int, SbBox3i32, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoBox |
getData(int resolution,
SbBox3i32 subVolume,
java.nio.ByteBuffer buffer)
Deprecated.
As of Open Inventor 9.4, use
getData(int, SbBox3i32, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoLine |
getData(int resolution,
SbBox3i32 subVolume,
SbLine line)
Convenient method to get the required size of the application buffer: call
getData(resolution, subvolume, line, null).
|
SoLDMDataAccess.DataInfoLine |
getData(int resolution,
SbBox3i32 subVolume,
SbLine line,
java.nio.Buffer buffer)
Deprecated.
use
getData(int, SbBox3i32, SbLine, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoLine |
getData(int resolution,
SbBox3i32 subVolume,
SbLine line,
java.nio.ByteBuffer buffer)
Deprecated.
As of Open Inventor 9.4, use
getData(int, SbBox3i32, SbLine, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoLine |
getData(int resolution,
SbBox3i32 subVolume,
SbLine line,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates and a line, copies the data
intersecting the line and the subvolume into an application buffer.
|
SoLDMDataAccess.DataInfoPlane |
getData(int resolution,
SbBox3i32 subVolume,
SbPlane plane)
Convenient method to get the required size of the application buffer: call
getData(resolution, subvolume, plane, null).
|
SoLDMDataAccess.DataInfoPlane |
getData(int resolution,
SbBox3i32 subVolume,
SbPlane plane,
java.nio.Buffer buffer)
Deprecated.
use
getData(int, SbBox3i32, SbPlane, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoPlane |
getData(int resolution,
SbBox3i32 subVolume,
SbPlane plane,
java.nio.ByteBuffer buffer)
Deprecated.
As of Open Inventor 9.4, use
getData(int, SbBox3i32, SbPlane, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoPlane |
getData(int resolution,
SbBox3i32 subVolume,
SbPlane plane,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates and a plane, copies the data
intersecting the plane and the subvolume into an application buffer
|
SoLDMDataAccess.DataInfoTrace |
getData(int resolution,
SbBox3i32 subVolume,
SbVec2i32 coord)
Convenient method to get the required size of the application buffer: call
getData(resolution, subvolume, coord, null).
|
SoLDMDataAccess.DataInfoTrace |
getData(int resolution,
SbBox3i32 subVolume,
SbVec2i32 coord,
java.nio.Buffer buffer)
Deprecated.
use
getData(int, SbBox3i32, SbVec2i32, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoTrace |
getData(int resolution,
SbBox3i32 subVolume,
SbVec2i32 coord,
java.nio.ByteBuffer buffer)
Deprecated.
As of Open Inventor 9.4, use
getData(int, SbBox3i32, SbVec2i32, SoBufferObject) instead. |
SoLDMDataAccess.DataInfoTrace |
getData(int resolution,
SbBox3i32 subVolume,
SbVec2i32 coord,
SoBufferObject bufferObj)
Data values in a single seismic trace (a row of voxels along the volume X
axis) are copied into an application buffer.
|
SoLDMDataAccess.DataInfoBox |
getData(int resolution,
SbBox3i32 subVolume,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates, copies the associated data into an
application buffer.
|
SoLDMDataAccess.DataInfo |
getData(int resolution,
SbVec3i32 dataPosition)
Returns a reference to the block of data which contains the voxel at dataPosition.
|
SoDataSet |
getDataSet()
Returns the associated dataset.
|
SoLDMDataAccess.GetDataModes |
getGetDataMode()
Returns the GetDataMode (see setGetDataMode).
|
SoLDMDataAccess.DataInfoBox |
getRequestedDataBox(int requestId)
Returns the data associated with @B requestID@b into @B infoBox@b.
|
SoLDMDataAccess.DataInfoLine |
getRequestedDataLine(int requestId)
Returns the data associated with @B requestID@b into @B infoLine@b.
|
SoLDMDataAccess.DataInfoPlane |
getRequestedDataPlane(int requestId)
Returns the data associated with @B requestID@b into @B infoPlane@b.
|
SoLDMDataAccess.DataInfoTrace |
getRequestedDataTrace(int requestId)
Returns the data associated with @B requestID @b into @B infoTrace @b.
|
double |
isTileUniform(int resolution,
SbVec3i32 dataPosition)
Returns true if the tile containing the data located at position dataPosition (IJK voxel coordinates) at the specified resolution is uniform (all voxels have the same value).
|
void |
releaseData(SoLDMTileID tileID)
Tells VolumeViz that this block of data (returned by getData above) is no longer in use by the application.
|
int |
requestData(int resolution,
SbBox3i32 subVolume0,
SbLine line,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates and a line, asynchronously copies the data intersecting the line and the subvolume into an application buffer.
|
int |
requestData(int resolution,
SbBox3i32 subVolume,
SbPlane plane,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates and a plane, asynchronously copies the data intersecting the plane and the subvolume into an application buffer.
|
int |
requestData(int resolution,
SbBox3i32 subVolume0,
SbVec2i32 coord,
SoBufferObject bufferObj)
Data values in a single seismic trace (a row of voxels along the volume X axis) are asynchronously copied into an application buffer.
|
int |
requestData(int resolution,
SbBox3i32 subVolume,
SbVec3i32[] polyline,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates and a stack of line, asynchronously copies the data intersecting each line and the subvolume into an application buffer.
|
int |
requestData(int resolution,
SbBox3i32 box,
SoBufferObject bufferObj)
Given a subvolume in voxel coordinates, asynchronously copies the associated data into an application buffer.
|
void |
setDataSet(SoDataSet v)
Set dataset to fetch data from.
|
boolean |
setGetDataMode(SoLDMDataAccess.GetDataModes getDataMode)
Set the GetDataMode.
|
SbVec3f |
voxelToXYZ(SbVec3i32 dataPosition)
Convert a voxel coordinate (I,J,K) to a geometry coordinate (X,Y,Z).
|
SbVec3i32 |
XYZToVoxel(SbVec3f dataPosition)
Convert a geometry coordinate (X,Y,Z) to a voxel coordinate (I,J,K).
|
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int CORRECT
SoLDMDataAccess.ErrorValues.CORRECT
instead.@Deprecated public static final int INCORRECT_RESOLUTION
SoLDMDataAccess.ErrorValues.INCORRECT_RESOLUTION
instead.@Deprecated public static final int INCORRECT_SUBVOLUME
SoLDMDataAccess.ErrorValues.INCORRECT_SUBVOLUME
instead.@Deprecated public static final int INCORRECT_LINE
SoLDMDataAccess.ErrorValues.INCORRECT_LINE
instead.@Deprecated public static final int INCORRECT_POLYLINE
SoLDMDataAccess.ErrorValues.INCORRECT_POLYLINE
instead.@Deprecated public static final int INCORRECT_PLANE
SoLDMDataAccess.ErrorValues.INCORRECT_PLANE
instead.@Deprecated public static final int INCORRECT_POSITION
SoLDMDataAccess.ErrorValues.INCORRECT_POSITION
instead.@Deprecated public static final int INCORRECT_COORDINATE
SoLDMDataAccess.ErrorValues.INCORRECT_COORDINATE
instead.@Deprecated public static final int MEMORY_FULL
SoLDMDataAccess.ErrorValues.MEMORY_FULL
instead.@Deprecated public static final int REQUEST_NOT_COMPLETED
SoLDMDataAccess.ErrorValues.REQUEST_NOT_COMPLETED
instead.@Deprecated public static final int REQUEST_NOT_FOUND
SoLDMDataAccess.ErrorValues.REQUEST_NOT_FOUND
instead.@Deprecated public static final int INCORRECT_BUFFER
SoLDMDataAccess.ErrorValues.INCORRECT_BUFFER
instead.@Deprecated public static final int CACHE
SoLDMDataAccess.GetDataModes.CACHE
instead.@Deprecated public static final int DIRECT
SoLDMDataAccess.GetDataModes.DIRECT
instead.@Deprecated public static final int DIRECT_AND_PREFETCH
SoLDMDataAccess.GetDataModes.DIRECT_AND_PREFETCH
instead.public SoLDMDataAccess()
public void endRequest(int requestId)
public SoLDMDataAccess.DataInfoBox getData(int resolution, SbBox3i32 subVolume)
public SoLDMDataAccess.DataInfoBox getData(int resolution, SbBox3i32 subVolume, SoBufferObject bufferObj)
The resolution is the power of 2 of the desired subsampling level (0:1/1, 1:1/2, 2:1/4, ...). Note: The data is copied.
All information is returned in the object DataInfoBox. Call this method with buffer = null to get the required size of the application buffer (in the bufferSize member of DataInfoBox).
public SoLDMDataAccess.DataInfoBox getData(int resolution, SbBox3i32 subVolume, java.nio.ByteBuffer buffer)
getData(int, SbBox3i32, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoBox getData(int resolution, SbBox3i32 subVolume, java.nio.Buffer buffer)
getData(int, SbBox3i32, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoPlane getData(int resolution, SbBox3i32 subVolume, SbPlane plane)
public SoLDMDataAccess.DataInfoPlane getData(int resolution, SbBox3i32 subVolume, SbPlane plane, SoBufferObject bufferObj)
The resolution is the power of 2 of the desired subsampling level (0:1/1, 1:1/2, 2:1/4, ...) Note: The data is copied.
All information is returned in the object DataInfoPlane. Call this method with buffer = null to get the required size of the application buffer (in the bufferSize member of DataInfoPlane).
public SoLDMDataAccess.DataInfoPlane getData(int resolution, SbBox3i32 subVolume, SbPlane plane, java.nio.ByteBuffer buffer)
getData(int, SbBox3i32, SbPlane, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoPlane getData(int resolution, SbBox3i32 subVolume, SbPlane plane, java.nio.Buffer buffer)
getData(int, SbBox3i32, SbPlane, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoLine getData(int resolution, SbBox3i32 subVolume, SbLine line)
public SoLDMDataAccess.DataInfoLine getData(int resolution, SbBox3i32 subVolume, SbLine line, SoBufferObject bufferObj)
The resolution is the power of 2 of the desired subsampling level (0:1/1, 1:1/2, 2:1/4, ...) Note: The data is copied.
All information is returned in the object DataInfoLine. Call this method with buffer = null to get the required size of the application buffer (in the bufferSize member of DataInfoLine).
public SoLDMDataAccess.DataInfoLine getData(int resolution, SbBox3i32 subVolume, SbLine line, java.nio.ByteBuffer buffer)
getData(int, SbBox3i32, SbLine, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoLine getData(int resolution, SbBox3i32 subVolume, SbLine line, java.nio.Buffer buffer)
getData(int, SbBox3i32, SbLine, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoTrace getData(int resolution, SbBox3i32 subVolume, SbVec2i32 coord)
public SoLDMDataAccess.DataInfoTrace getData(int resolution, SbBox3i32 subVolume, SbVec2i32 coord, SoBufferObject bufferObj)
The trace is identified by a YZ voxel coordinate. The range of values
returned is the intersection of the trace with the specified subvolume.
The resolution is the power of 2 of the desired subsampling level (0:1/1,
1:1/2, 2:1/4, ...). Note: The data is copied.
Returns a DataInfoTrace object containing errorFlag, bufferSize (number of
bytes) and bufferDimension (number of values).
Call this method with buffer = null to get the required size of the
application buffer (in the bufferSize member of DataInfoTrace).
public SoLDMDataAccess.DataInfoTrace getData(int resolution, SbBox3i32 subVolume, SbVec2i32 coord, java.nio.ByteBuffer buffer)
getData(int, SbBox3i32, SbVec2i32, SoBufferObject)
instead.public SoLDMDataAccess.DataInfoTrace getData(int resolution, SbBox3i32 subVolume, SbVec2i32 coord, java.nio.Buffer buffer)
getData(int, SbBox3i32, SbVec2i32, SoBufferObject)
instead.public SoLDMDataAccess.DataInfo getData(int resolution, SbVec3i32 dataPosition)
Note: The data is not copied.
public SoLDMDataAccess.DataInfoBox getRequestedDataBox(int requestId)
public SoLDMDataAccess.DataInfoLine getRequestedDataLine(int requestId)
public SoLDMDataAccess.DataInfoPlane getRequestedDataPlane(int requestId)
public SoLDMDataAccess.DataInfoTrace getRequestedDataTrace(int requestId)
public void releaseData(SoLDMTileID tileID)
public void setDataSet(SoDataSet v)
public SoDataSet getDataSet()
public SbVec3i32 XYZToVoxel(SbVec3f dataPosition)
public double isTileUniform(int resolution, SbVec3i32 dataPosition)
public SoLDMDataAccess.GetDataModes getGetDataMode()
public SbVec3f voxelToXYZ(SbVec3i32 dataPosition)
public boolean setGetDataMode(SoLDMDataAccess.GetDataModes getDataMode)
public int requestData(int resolution, SbBox3i32 subVolume0, SbVec2i32 coord, SoBufferObject bufferObj)
Returns a request ID. If requestID is positive, this value will be passed to the endRequest method when the requested data is ready, and can then be used with the getRequestedData method to complete the transaction. If requestID is negative, the data is already in memory, so endRequest will not be called, and -requestID (a positive value) should be used with the getRequestedData method.
Call this method with buffer = NULL to get the required size of the application buffer (in the bufferSize member of DataInfoTrace). Limitations :
public int requestData(int resolution, SbBox3i32 subVolume, SbVec3i32[] polyline, SoBufferObject bufferObj)
Returns a request ID. If requestID is positive, this value will be passed to the endRequest method when the requested data is ready, and can then be used with the getRequestedData method to complete the transaction. If requestID is negative, the data is already in memory, so endRequest will not be called, and -requestID (a positive value) should be used with the getRequestedData method.
Call this method with buffer = NULL to get the required size of the application buffer (in the bufferSize member of DataInfoLine). Limitations :
public int requestData(int resolution, SbBox3i32 subVolume, SbPlane plane, SoBufferObject bufferObj)
Returns a request ID. If requestID is positive, this value will be passed to the endRequest method when the requested data is ready, and can then be used with the getRequestedData method to complete the transaction. If requestID is negative, the data is already in memory, so endRequest will not be called, and -requestID (a positive value) should be used with the getRequestedData method.
Call this method with buffer = NULL to get the required size of the application buffer (in the bufferSize member of DataInfoPlane). Limitations :
public int requestData(int resolution, SbBox3i32 box, SoBufferObject bufferObj)
Returns a request ID. If requestID is positive, this value will be passed to the endRequest method when the requested data is ready, and can then be used with the getRequestedData method to complete the transaction. If requestID is negative, the data is already in memory, so endRequest will not be called, and -requestID (a positive value) should be used with the getRequestedData method.
Call this method with buffer = NULL to get the required size of the application buffer.
Limitations :
public int requestData(int resolution, SbBox3i32 subVolume0, SbLine line, SoBufferObject bufferObj)
Returns a request ID. If requestID is positive, this value will be passed to the endRequest method when the requested data is ready, and can then be used with the getRequestedData method to complete the transaction. If requestID is negative, the data is already in memory, so endRequest will not be called, and -requestID (a positive value) should be used with the getRequestedData method.
Call this method with buffer = NULL to get the required size of the application buffer (in the bufferSize member of DataInfoLine). Limitations :
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com