Announcement

Collapse
No announcement yet.

cannot read data of a SoObliqueSlice

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • cannot read data of a SoObliqueSlice

    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?

  • #2
    Originally posted by lilly_li View Post
    I've tried to get the data of the palne of SoObliqueSlice. The code is as belows:
    Code:
        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 );
    The problem is that info.bufferSize is 0, meaning it failed to get data. Would you please tell me why?
    I can't say for sure. I tried a quick test with your code, setting the plane at the center of the volume (arbitrary valid position) and it worked fine.

    So one possible problem is that the plane you're computing from the dragger is outside the bounds of the volume. In this case the value returned in info.errorFlag should be INCORRECT_PLANE.

    Comment


    • #3
      error flag is CORRECT

      I checked the errorFlag. It is 0 ( CORRECT ).

      Comment


      • #4
        Originally posted by lilly_li View Post
        I checked the errorFlag. It is 0 ( CORRECT ).
        OK, it's strange that the buffer size is zero if errorFlag is zero and the plane intersects the volume. I did confirm that your data access code is OK (it works in a test program for me). But I don't know what plane is being returned by your dragger. Can you submit a simple test case?
        If not, can you send the volume dimensions, the volume extent in 3D and the values in the SbPlane parameter you're passing to the getData() function?

        Comment


        • #5
          pars and sorry for reply so so late.

          Dear Mike,

          Sorry to reply so late.

          the extent of the volume data is x: 3800-4600, y : 0 - 22542.9, z: 0 - 11026.1

          the plane normal is : 0, 0, 1 and the position is 4200, 11271.4, 5515.05

          Comment

          Working...
          X