1.10.4. Get trace

This request returns a row of voxels along the volume X axis, bounded by a “box” or subvolume. In addition to the resolution and bufferObj parameters, this request takes an SbBox3i32( C++ | Java ) specifying the bounds of the subvolume in voxel (IJK) coordinates and an SbVec2i32( C++ | Java ) specifying the coordinates of the trace. To request the complete trace set the subvolume parameter to the full extent of the volume. The requested trace must be inside the subvolume. The trace coordinate is specified in voxels along the volume Z and Y axes. Typically for a seismic volume this is the line number and trace (or crossline) number.

The request returns a DataInfoBox struct (defined in class SoLDMDataAccess( C++ | Java | .NET )) containing:

The data type is not returned in this struct, but can be queried from the volume data node as shown in a previous section.

DataInfoTrace query

Figure 1.100. DataInfoTrace query


The following example shows how to extract one trace from a volume. In this example the application is requesting the complete trace at full resolution data (resolution = 0) and the volume contains unsigned integer data. The example code does not show error checking. In production code the application should check the errorFlag parameter in the returned struct.


C++
// Get subvolume bounds equal to volume dimensions
const SbVec3i32& volDim = pVolData->data.getSize();
const SbBox3i32 subVol( 0,0,0, volDim[0]-1,volDim[1]-1,volDim[2]-1 );

SbVec2i32 coord(0,63); // ZY coordinates (e.g. line 0, trace 63)

// Call with null to get size of data
int res = 0;
SoLDMDataAccess& access = pVolData->getLdmDataAccess();
SoLDMDataAccess::DataInfoTrace info;
info = access.getData( res, subVol, coord );

// Create a buffer and set size large enough for returned data
SoRef<SoCpuBufferObject> pBuffer = new SoCpuBufferObject;
pBuffer->setSize( info.bufferSize );

// Call to get the actual data
info = access.getData( res, subVol, coord, pBuffer.ptr() );

// Access the data then unmap the buffer
unsigned int* pData = (unsigned int*)pBuffer->map(SoBufferObject::READ_ONLY);
unsigned int value = pData[0];
. . .
pBuffer->unmap();

.NET
// Get subvolume bounds equal to volume dimensions
SbVec3i32 volDim = VolData.data.GetSize();
SbBox3i32 subVol = new SbBox3i32( 0,0,0, volDim[0]-1,volDim[1]-1,volDim[2]-1 );

SbVec2i32 coord = new SbVec2i32(0,63); // ZY coordinates (e.g. line 0, trace 63)

// Call with null to get size of data
int res = 0;
SoLDMDataAccess access = VolData.GetLdmDataAccess();
SoLDMDataAccess.DataInfoTrace info;
info = access.GetData( res, subVol, coord );

// Create a buffer and set size large enough for returned data
SoCpuBufferObject buffer = new SoCpuBufferObject();
buffer.SetSize((ulong)info.BufferSize);

// Call to get the actual data
info = access.GetData( res, subVol, coord, buffer );

// Access the data then unmap the buffer
SbNativeArray<uint> data = (SbNativeArray<uint>)buffer.Map(SoBufferObject.AccessModes.READ_ONLY);
uint value = data[0];
. . .
buffer.Unmap();
    

Java
// Get subvolume bounds equal to volume dimensions
SbVec3i32 volDim = volData.data.getSize();
SbBox3i32 subVol = new SbBox3i32( 0,0,0, volDim.getX()-1,volDim.getY()-1,volDim.getZ()-1 );
  
SbVec2i32 coord = new SbVec2i32(0,0); // ZY coordinates (e.g. line 0, trace 63)

// Call with null to get size of data
int res = 0;
SoLDMDataAccess access = volData.getLdmDataAccess();
SoLDMDataAccess.DataInfoTrace info;
info = access.getData(res, subVol, coord, null);
  
// Create a buffer and set size large enough for returned data
ByteBuffer buffer = ByteBuffer.allocateDirect( info.bufferSize );
buffer.order(ByteOrder.nativeOrder());

// Call to get the actual data
info = access.getData(res, subVol, coord, buffer);
  
// Access the data
IntBuffer ibuffer = buffer.asIntBuffer();
int value = ibuffer.get(0);
. . .