[Paraview] Accessing VTK data from a Paraview plugin

Mike Jackson imikejackson at gmail.com
Tue Feb 19 10:27:59 EST 2008


Just a guess:

vtkImageData* datainfo = vtkImageData::SafeDownCast(outInfo->Get 
(vtkDataObject::DATA_OBJECT()));

Mike

On Feb 19, 2008, at 2:35 AM, Miron Sadziak wrote:

> Thank you for you help. I checked the filter plugin description and  
> the examples but I think thats not what I want. At least I cant  
> figure out how I can use it to read the raw data through the  
> client. The code I posted in the previous mail is already a part of  
> a plugin which shows a toolbar with buttons in Paraview client.  
> Clicking on a button should pop up a window with the point  
> coordinates of all points of the selected source. Thats the aim but  
> now it only shows the number of points and the vtk class name  
> "vtkImageData". Since these informations are already on the client  
> there must be a simple way to get also all the point coordinates/ 
> point data of that vtkImageData class. How to do it ?
>
>
> Mike Jackson さんは書きました:
>> 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