[vtkusers] Problem displaying the modification of output from VTKStructuredPointsReader.

Delcypher delcypher at gmail.com
Thu Mar 8 13:31:08 EST 2012


Hi, I have a program that displays a newly created VTKStructuredPoints
in memory. I.e.

VtkSmartPointer<vtkStructuredPoints> segblock = vtkStructuredPoints::New();

I have code that draws into this structure which is displayed in a
QVTKWidget (via the VTKImageViewer2 class). When "segblock" is
modified it calls the following methods so that widget shows the
updated image.

segblock->Modified();
imageViewer2->GetRenderWindow()->Render();
qvtkwidget->update();

This works. Every time these get called the QVTKWidget correctly
displays the modifications to the "segblock" data structure.

Now later on during the program segblock gets changed so that it now
comes from the output of a VtkStructuredPointsReader  (readerSegBlock)
which reads a structured points file.

segblock = readerSegBlock->GetOutput();

I'm hoping that VtkSmartPointer does the right thing here so that the
previously allocated memory for "segblock" is cleaned up.

As before the code then does some drawing into the this structure by
doing something like

char* p = static_cast<char*>(segblock->GetScalarPointer(x,y,z));
p = 5;

Now I try to get the QVTKWidget to update so that it displays the
modifications to the "segblock" data structure. So again I call....

segblock->Modified();
imageViewer2->GetRenderWindow()->Render();
qvtkwidget->update();

This time it FAILS. The changes are not visible in the QVTKWidget. If
I change the slice number I am looking at via VTKImageViewer2 and then
go back to the slice I was on before I can then see the modifications.

So it appears that the

segblock->Modified();

line is not working when the segblock comes from a
VtkStructuredPointsReader. Does anyone have any idea what's wrong?

Thanks,
Dan Liew.



More information about the vtkusers mailing list