[vtk-developers] Error in VTKEdge volume rendering VTKEdge after VOI extraction (may be VTKEdge BUG)

Wagner Sales wsales at gmail.com
Tue Mar 10 15:10:14 EDT 2009


Hi all,

I'm rendering a volume using VTKEdge. After this, I'm using
vtkExtractVOI to extract a Volume Of Interest and renders.
Well, when I do this, my application crashes in the following line:
vtkKWEOpenGLGPUVolumeRayCastMapper.cxx:4770
Which contains the following code:
assert("check: wholeTextureExtent" && wholeTextureExtent[i]==0);
The problem, of course are because the wholeTextureExtend[i] ( in this
case, i = 0 ) aren't 0. But that's are correct? To provide more
resources, I'll detail more.
This line are portion of the following loop:
while(i<6)
    {
    assert("check: wholeTextureExtent" && wholeTextureExtent[i]==0);
    if(subvolumeTextureExtent[i]<wholeTextureExtent[i])
      {
      subvolumeTextureExtent[i]=wholeTextureExtent[i];
      }
    ++i; ///increase first time <---------------------
    if(subvolumeTextureExtent[i]>wholeTextureExtent[i])
      {
      subvolumeTextureExtent[i]=wholeTextureExtent[i];
      }
    ++i; ///increase second time <------------------------
    }
And the wholeTextureExtent are the extent of my image.

1 - First time I set the volume to render, the extents of image data are:
0, 511, 0, 511, 0, 182.
When enters in this loop, will check first extent (will be 0),
increase two times the variable "i", and then check ( will be 0 too,
since 511 aren't not checked because the increases ).

2 - I draw a box in my image and extract the coordinates for the VOI:
int voi[6];
voi [0] = (BoxExtractor->GetStartPosition()[0] -
this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
voi [1] = (BoxExtractor->GetEndPosition()[0] -
this->GetInput()->GetOrigin()[0])/this->GetInput()->GetSpacing()[0];
voi [2] = (BoxExtractor->GetStartPosition()[1] -
this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
voi [3] = (BoxExtractor->GetEndPosition()[1] -
this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
int minz = GetInput()->GetExtent()[4];
int maxz = GetInput()->GetExtent()[5];
voi [4] = minz;
voi [5] = maxz;

3 - Extract the VOI and disconnects the VTK image pipeline ( connected
will not work too ):

vtkExtractVOI *Extractor = vtkExtractVOI::New();
Extractor->SetInput(SourceImage);
Extractor->SetVOI(voi);
Extractor->Update();
vtkImageData *ima = vtkImageData::New();
ima->ShallowCopy(Extractor->GetOutput());
ima->UpdateData();

4 - Only for understand more, see the extent:
int textExtent[6];
ima->GetExtent(textExtent);

The problem will start here, because my extents will not start in zero
in the in xmin and ymin, and I can get an extent like this:
125,511,125,511,0,182
Which are the results after VOI extraction.

5 - When I set the image, of course in the loop, the assert will not
works and will crash.

If I comment this assert and others that's do the same test, the
volume aren't rendered.

This implementation are correct in VTKEdge? If are, what's I need to
do to achieve a correct render?

Best regards,

Wagner



More information about the vtk-developers mailing list