[Paraview] How to replace data in a pipeline source with new data?
Adebayo Olowoyeye
aolowoye at umail.iu.edu
Fri Jul 30 13:04:35 EDT 2010
Hi,
I am loading a volume using:
reader = builder->createReader(QString("internal_sources"),
QString("XMLImageDataReaderCore"), files, server);
after creating a view and representation for the volume. I need to access
the volume data and change it. I am using the following to access the
volume data:
vtkSMProxyManager *pm = vtkSMObject::GetProxyManager();
rep =
vtkSMClientDeliveryRepresentationProxy::SafeDownCast(pm->NewProxy("representations","ClientDeliveryRepresentation"));
rep->AddInput((vtkSMSourceProxy*)proxy, "DONTCARE");
rep->SetReductionType(1);
rep->UpdateVTKObjects();
rep->Update();
currVolume = (vtkImageData*)(rep->GetOutput());
Once I have the data as a vtkImageData, I use
currVolume->SetScalarComponentFromFloat(i, j, k, 0, value);
to set the data. This is a very slow way to access the data. I also tried:
float* pixel = static_cast<float*> (currVolume->GetScalarPointer(i,j,k));
pixel[0] = value;
this is faster, but I would like to create an array, fill it with new data
(without accessing ImageData) and then use it to replace the array stored
within the ImageData without having to iterate.
Is there a better way to do this with paraview objects?
Any input is appreciated
Thanks!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100730/200b8545/attachment.htm>
More information about the ParaView
mailing list