[vtkusers] Reading a .vtp

David Doria daviddoria+vtk at gmail.com
Wed May 19 10:49:53 EDT 2010

On Wed, May 19, 2010 at 10:33 AM,  <mariagrazia.madaschi at unibg.it> wrote:
> Hi,
> I really know very little about vtk. Maybe my answer could be a bit stupid
> to many of you.
> I've got a problem to resolve. I create a file .vtp with many cells of
> kidney. This cells are obviously composed of many points. I need to
> calculate the centroid of every cells and to do this I need all points
> coordinates of every cells.
> I know that .vtp contain the information I need, but I really don't know
> how to get it.
> (I usually use Python as language)
> Can someone help me?
> Thanks.


You will find an increasing number of python examples here:


Here is the closest one we have so far:

I imagine that this work work, though I've never tried it:

import vtk
filename = "myfile.vtp"
reader = vtk.vtkXMLPolyDataReader()
polyDataOutput = reader.GetOutput()

Please add examples as you figure out how to do things like this!



More information about the vtkusers mailing list