[vtkusers] Extracting selection from UnstructuredGridDataset using python

Amine Aboufirass amine.aboufirass at gmail.com
Thu Nov 16 11:25:02 EST 2017


Hello,

I am trying to extract specific points and their corresponding values from
an unstructured grid dataset using python. My objective is to provide a
list of pointID's or X,Y,Z locations, the name of the result I would like
to extract and in return get a list containing the values.. The values
associated with the points are in vector, scalar and/or tensor form. I've
made several attempts using the following classes of objects described in
the vtk class documentation:

   - vtkExtractSelection
   - vtkSelection
   - vtkSelectionNode
   - vtkSelectionSource
   - vtkUnstructuredGridReader

It appears that these objects are somewhat related. For instance the
vtkExtractSelection object can take in a vtkObject output from an
unstructured grid reader and a vtkSelection. A vtkSelection can carry any
number of vtkSelectionNodes. The vtkSelection node stores selection
parameters for a list of properties and a list of selection values. The
list of properties can contain information about what is stored by the node
such as GLOBALID and LOCATION. It is also possible to assign several
vtkSelectionNodes as ContentTypes and FieldTypes to a
vtkSelectionSourceObject. The vtkSelectionSource object itself outputs a
vtkSelection when piece id and cell id pairs are provided as input.  I have
also noticed it is possible to .AddID and .AddLocation to a
vtkSelectionSource object.

Furthermore I have searched through the available examples including the
following:

https://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Examples/Infovis/Python/graph_selection_subtract.py

https://www.programcreek.com/python/example/21682/vtk.
vtkExtractUnstructuredGrid

I also asked a fairly detailed question on stackexchange:

https://stackoverflow.com/questions/47332100/selectionnode-object-from-vtk-library

The stackexchange post has of yet received no response, and the examples
were helpful but didn't quite get me there.

In light of what I have explained above, does anyone have further
indications of what I can do to achieve this? Thanks you kindly for your
consideration and look forward to your responses.

Regards,

Amine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171116/a145656f/attachment.html>


More information about the vtkusers mailing list