[vtkusers] Strange behavior of vtkImageAlgorithm subclass - empty output
David Doria
daviddoria+vtk at gmail.com
Fri Jan 29 18:34:10 EST 2010
Would someone mind taking a look at this:
http://www.rpi.edu/~doriad/VTK_List/vtkVoxelizePolyData/
I write a file (inside.vti) of the output at the very end of
RequestData. This works properly, the file is correct.
However, as soon as I get the output of the filter, I write another
file, outside.vti. I would expect this to be identical to inside.vti.
However, it is empty (0 cell, 0 points)!
Here is a potential clue:
I write the ImageData called "grid" (this is the part that produces
the correct file)
vtkSmartPointer<vtkXMLImageDataWriter> writer =
vtkSmartPointer<vtkXMLImageDataWriter>::New();
writer->SetFileName("inside.vti");
writer->SetInput(grid);
writer->Write();
Then I copy it into the output:
output->ShallowCopy(grid);
Then, still from inside RequestData, I try to write the file again,
this time using "output" instead of "grid":
{
vtkSmartPointer<vtkXMLImageDataWriter> writer =
vtkSmartPointer<vtkXMLImageDataWriter>::New();
writer->SetFileName("inside_output.vti");
writer->SetInput(output);
writer->Write();
}
and it segfaults.
Any thoughts on why this might be happening?
Thanks,
David
More information about the vtkusers
mailing list