[Paraview] Accessing VTK data from a Paraview plugin

Mike Jackson imikejackson at gmail.com
Mon Feb 18 20:22:51 EST 2008


You probably want to write a Filter plugin for ParaView. Look on the  
Wiki for more information.

Mike

On Feb 18, 2008, at 8:16 PM, Miron Sadziak wrote:

> Hi
>
> I want to write a plugin for Paraview to manipulate the data Paraview
> has opened.
> It will be mostly ImageData or PolyData but I would like to understand
> the general idea how to do it.
> Im using C++ so the code i have figured out by now looks like that:
>
> #Getting the active source
> pqApplicationCore* core = pqApplicationCore::instance();
> pqServerManagerSelection sels = *core->getSelectionModel()- 
> >selectedItems();
> pqPipelineSource* source = 0;
> pqServerManagerModelItem* item = 0;
> pqServerManagerSelection::ConstIterator iter = sels.begin();
> item = *iter;
> source = dynamic_cast<pqPipelineSource*>(item);
>
> #Trying to access the data of the source.
> #Here I can access data information only, not raw-data
> vtkPVDataInformation*
> datainfo=source->getOutputPort(0)->getDataInformation(true);
> cout << "PointsNumber " << datainfo->GetNumberOfPoints() << "\n";
> cout << "DataClassName " << datainfo->GetDataClassName() << "\n";
>
> It all works but its just data information.
> I would like to access a function like GetData or GetDataArray to be
> able to read the data contained in the VTK object. To read/write
> directly from/to the data array. The problem is that I cant find a
> suitable function in any of the classes like pqPipelineSource,
> vtkPVDataInformation etc.
> What should I do ?
>
> I would be thankful for any help,
> Paraview user
>
>


More information about the ParaView mailing list