Dear Mike,
I've tried to get the data of the palne of SoObliqueSlice. The code is as belows:
SbPlane plane;
SbVec3f planePosition = mpDragger->translation.getValue(); // plane clip dragger
SbRotation rotation = mpDragger->rotation.getValue();
SbVec3f planeNormal;
rotation.multVec( SbVec3f(0,1,0), planeNormal );
plane = SbPlane( planeNormal, planePosition );
SbVec3i32 volDim = mpVolume3D->data.getSize();
SbBox3i32 box;
box.setBounds( 0, 0, 0, volDim[0] - 1, volDim[1] - 1, volDim[2] - 1 );
SoVolumeData::LDMDataAccess:
ataInfoPlane info;
SoLDMDataAccess& dataAccess( mpVolume3D->getLdmDataAccess() );
SoDataSet* DS = dataAccess.getDataSet();
SoDataSet:
ataType DT = DS->getDataType();
//query size of data buffer
info = mpVolume3D->getLdmDataAccess().getData( 0, box, plane );
SoRef<SoCpuBufferObject> bufferObj = new SoCpuBufferObject;
if ( info.bufferSize )
{
bufferObj->setSize(info.bufferSize);
info = dataAccess.getData( 0, box, plane, bufferObj.ptr());
if ( !(info.errorFlag == SoVolumeData::LDMDataAccess::CORRECT) )
SoError:
ost("Error while data access request");
SbVec2i32 buffDim = info.bufferDimension;
int buffSize = info.bufferSize;
int32_t nx,ny,nz;
buffDim.getValue(nx,ny);
int buffElements = nx*ny;
SoVolumeHistogram aHisto(DT);
aHisto.setInputValueRange( mOriDataMinValue, mOriDataMaxValue );
aHisto.addValues(bufferObj.ptr(),buffElements);
size_t numBins = aHisto.getHistoSize();
int64_t* hvalues = aHisto.getHistogram();
}
The problem is that info.bufferSize is 0, meaing it failed to get data. Would you please tell me why?
I've tried to get the data of the palne of SoObliqueSlice. The code is as belows:
SbPlane plane;
SbVec3f planePosition = mpDragger->translation.getValue(); // plane clip dragger
SbRotation rotation = mpDragger->rotation.getValue();
SbVec3f planeNormal;
rotation.multVec( SbVec3f(0,1,0), planeNormal );
plane = SbPlane( planeNormal, planePosition );
SbVec3i32 volDim = mpVolume3D->data.getSize();
SbBox3i32 box;
box.setBounds( 0, 0, 0, volDim[0] - 1, volDim[1] - 1, volDim[2] - 1 );
SoVolumeData::LDMDataAccess:

SoLDMDataAccess& dataAccess( mpVolume3D->getLdmDataAccess() );
SoDataSet* DS = dataAccess.getDataSet();
SoDataSet:

//query size of data buffer
info = mpVolume3D->getLdmDataAccess().getData( 0, box, plane );
SoRef<SoCpuBufferObject> bufferObj = new SoCpuBufferObject;
if ( info.bufferSize )
{
bufferObj->setSize(info.bufferSize);
info = dataAccess.getData( 0, box, plane, bufferObj.ptr());
if ( !(info.errorFlag == SoVolumeData::LDMDataAccess::CORRECT) )
SoError:

SbVec2i32 buffDim = info.bufferDimension;
int buffSize = info.bufferSize;
int32_t nx,ny,nz;
buffDim.getValue(nx,ny);
int buffElements = nx*ny;
SoVolumeHistogram aHisto(DT);
aHisto.setInputValueRange( mOriDataMinValue, mOriDataMaxValue );
aHisto.addValues(bufferObj.ptr(),buffElements);
size_t numBins = aHisto.getHistoSize();
int64_t* hvalues = aHisto.getHistogram();
}
The problem is that info.bufferSize is 0, meaing it failed to get data. Would you please tell me why?
Comment