[Paraview] Python - Accessing Image Data

Christian Werner christian.werner at rwth-aachen.de
Sun Apr 18 15:21:35 EDT 2010


Hi Berk,

"by selected by the user" I mean the selection mechanism in Paraview. It 
would be nice to be able to loop through these selected points and get 
their coordinates and RegionId. That's also why I wanted to know if the 
actual PointData can be read out in Python.

Given some Polydata as a Contouring>Connectivity result, the goal is 
that the users selects a few out of many objects and calls a plugin that 
processes these objects. The selection should be as easy as to simply 
click on the object (object = set of points with equal RegionId). So, 
one click should select all points with the same Region ID. I have 
already posted that this functionality would be nice to have but until 
then I have to find some workaround.

Sadly, I am a little sparse on time so I will not dive into the 
vtkExtractSelection Filter to extract whole objects on the base of cell 
representatives. I will do the following: All selected points will be 
extracted and written into a file containing only their coordinate and 
region ID (done already). Python will open that file, read out all 
RegionIDs and do the nice FindData selection to select all cells with 
these RegionIDy and extract them. Now the user can verify if he selected 
the right objects, just as if Paraview was able to select a complete 
object with a simple click.
(in case you wonder: the coordinates are needed for correspondance to 
the original volume data that will be analyzed with ITK classses).

Paraview is a great tool and the results that I have already achieved 
are very good. This "object selection" issue is the only thing that 
works against me. What would already help a extreme lot is if one could 
activate some kind of "multiselect", so that the users doesn't have to 
use the CTRL-Key when selecting the next object (cell). Forgetting this 
one time kills the whole selection that you were doing for the last 15 
minutes in a bad case. Or maybe an option that warns about losing your 
current selection when turned on.

Best regards,
Christian


Berk Geveci wrote:
> What do you mean by "selected by the user"? Through the ParaView
> selection mechanism or some variable in the data? Also, what do you
> mean by "read out"? What is the end goal?
>
> On Thu, Apr 15, 2010 at 10:24 AM, Christian Werner
> <christian.werner at rwth-aachen.de> wrote:
>   
>> Hi!
>>
>> Is it actually possible to read and/or manipulate actual image data within
>> the Python Shell? I can somehow access field and array data like this:
>>
>> inputVolume=GetActiveSource()
>> pd=inputVolume.GetPointData
>> array=pd.GetArray(0)
>>
>> Then I can do array.sort(), array.reverse() and such. But this has no
>> noticable effect and isn't what I want anyway. I also tried GetFieldData and
>> GetCellData, but their GetNumberOfArrays() returned 0.
>>
>> This is just a general question. What I actually need is to read out which
>> Points have been selected by the user.
>>
>> Best regards,
>> Christian
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at:
>> http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>>     



More information about the ParaView mailing list