# Convert VTI File to Numpy Array in Python Programming

**URL:** https://discourse.vtk.org/t/convert-vti-file-to-numpy-array-in-python-programming/459
**Category:** Support
**Created:** [March 12, 2019, 2:03am UTC](https://discourse.vtk.org/t/convert-vti-file-to-numpy-array-in-python-programming/459 "2019-03-12T02:03:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![qmaaj](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/q/b3f665/32.png) [@qmaaj](https://discourse.vtk.org/u/qmaaj)
#### Post date: [March 12, 2019, 2:03am UTC](https://discourse.vtk.org/t/convert-vti-file-to-numpy-array-in-python-programming/459/1 "2019-03-12T02:03:22Z")

</div>

Suppose I have a vti file containing a scalar field (such as velocity) and its corresponding spatial coordinates (x, y, z coordinates), how should I read the vti file using Python programming and convert the vtil file to a numpy array in Python programming?

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [March 12, 2019, 5:20am UTC](https://discourse.vtk.org/t/convert-vti-file-to-numpy-array-in-python-programming/459/2 "2019-03-12T05:20:34Z")

</div>

You should check out the [`vtki` Python package](http://docs.vtki.org). It provides a NumPy interface back to all VTK data objects.

Installation is simply

```auto
pip install vtki

```

Then in Python, reading your file is simply:

```python
import vtki
data = vtki.read(‘my_file.vti’)
# Get points as NumPy array
points = data.points

```

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [March 13, 2019, 7:50pm UTC](https://discourse.vtk.org/t/convert-vti-file-to-numpy-array-in-python-programming/459/3 "2019-03-13T19:50:03Z")

</div>

Please see this series of blog posts on using VTK and numpy for a thorough overview on how to do this. [https://blog.kitware.com/improved-vtk-numpy-integration/](https://blog.kitware.com/improved-vtk-numpy-integration/)
