Reading a .VTK polydata file and converting it into Numpy array
<p>I want to convert a .VTK ASCII polydata file into numpy array of just the coordinates of the points. I first tried this: <a href="https://stackoverflow.com/a/11894302">https://stackoverflow.com/a/11894302</a> but it stores a (3,3) numpy array where each entry is actually the coordinates of THREE points that make that particular cell (in this case a triangle). However, I don't want the cells, I want the coordinates of each point (without repeatition). Next I tried this: <a href="https://stackoverflow.com/a/23359921/6619666">https://stackoverflow.com/a/23359921/6619666</a> with some modifications. Here is my final code. Instead of numpy array, the values are being stored as a tuple but I am not sure if that tuple represents each point.</p>

<pre><code>import sys

import numpy
import vtk
from vtk.util.numpy_support import vtk_to_numpy

reader = vtk.vtkPolyDataReader()
reader.SetFileName('Filename.vtk')
reader.ReadAllScalarsOn()
reader.ReadAllVectorsOn()
reader.Update()
nodes_vtk_array= reader.GetOutput().GetPoints().GetData()
print nodes_vtk_array
</code></pre>

<p>Please give suggestions.</p>