[vtkusers] xml data extraction
mathieu.malaterre at kitware.com
Mon Feb 21 10:48:30 EST 2005
Paul Cochrane wrote:
> Hi all,
> I'm a newbie to vtk, and have a question concerning the process of reading
> data from vtk xml files into vtk so that I can then manipulate and view the
> The vtk xml file contains an UnstructuredGrid, with Points for the locations
> of the data, PointData containing the scalar values of the data at those
> points, and various CellData elements containing tags, and connectivity etc.
> The process that I'm using is to read the data in like so:
> reader = vtk.vtkXMLUnstructuredGridReader()
> But then I run into my first wall. What do I do then? I assume that I
> should use some kind of data mapper, so I'd do something like:
> particleMapper = vtk.vtkDataSetMapper()
> But what data out of the UnstructuredGrid did I just grab? I want to
> generate spheres at the locations of the Points, with radii from the
> PointData, and use other attributes defined in the CellData to specify such
> things as colour etc. How do I do this?
> I have read the vtk User's Guide, and _many_ of the examples, but it still
> isn't clear to me how vtk thinks. I.e. where do I pipe what data to what
> object (and importantly why?).
You can always use the Print method to 'show' your vtk object.
Otherwise VTK by default display wireframe or surface, so you'll need to
glyph your unstructured grid with sphere to see the point.
Maybe a simplier approach would be to use paraview(*). Once you play
with it it is very easy to generate tcl script that will dump which vtk
classes where used.
More information about the vtkusers