[Paraview] ImageAlgorithmm Readers, and Volume of Interest
Mike Jackson
imikejackson at gmail.com
Mon Feb 4 16:18:39 EST 2008
I am trying to write a new reader for PV 3 based on the
vtkImageAlgorithm class. I have some basics completed but my
RequestData() method is running multiple times where I don't really
think it should be. I had this problem last year with another reader
but I don't think I ever figured out what I was doing wrong.
One of the sticking points I am having trouble getting my head
wrapped around is how to extract a subvolume from the main volume.
The size of the vtkImageData is like 10,000 x 10,000 x 300 which will
cause memory issues. At this point I would just like to render a
subvolume of data from the main volume. In our RequestInformation()
method we are setting the WHOLE_EXTENT to the actual volume size (10k
x 10k x 300).
int vtkH5RoboMetReader::RequestInformation(vtkInformation *vtkNotUsed
(request),
vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *outputVector)
{
...
outInfo->Set( vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
this->DataExtent, 6 );
...
}
and then in the RequestData() method we are only extracting volume of
interest:
int vtkH5RoboMetReader::RequestData( vtkInformation* vtkNotUsed
(request),
vtkInformationVector** vtkNotUsed(inputVector),
vtkInformationVector* outputVector )
{
vtkImageData *output =
vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT
()));
int32 requestedExtent[6];
if(outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT()))
{
// Get the requested data extent.
requestedExtent[0] = 0;
requestedExtent[1] = 1291;
requestedExtent[2] = 0;
requestedExtent[3] = 967;
requestedExtent[4] = 100;
requestedExtent[5] = 101;
}
output->SetExtent(requestedExtent);
output->SetOrigin(static_cast<double>(requestedExtent[0]),
static_cast<double>(requestedExtent[2]),
static_cast<double>(requestedExtent[4]));
output->SetSpacing(this->DataSpacing);
output->SetScalarTypeToUnsignedChar();
output->SetNumberOfScalarComponents(1);
output->AllocateScalars();
//Load data from file
return 1;
}
When I run the test program that renders the subvolume I get the
RequestData() method being called multiple times. Is there something
obvious that I am just missing? I tried looking at some of the other
readers in vtk/paraview but nothing is really jumping out at me.
Thanks for any help
--
Mike Jackson
imikejackson & gmail * com
More information about the ParaView
mailing list