Question

I have a large binary file that contains all the information I want to plot. The data is ordered in such a way that its easiest to read into a 3D numpy array, this worked fine when I was using Mayavi to plot it using the contour3d() function. Now I'm using Paraview and I can't find any examples of how I could accomplish the same thing. It seems like the only way to get data in is to read it directly from a file in one of many formats and not a numpy array. Any ideas?

Was it helpful?

Solution

As far as I understand, mayavi is build on tvtk, a wrapper of vtk designed for Traits support and an easier handling of NumPy.

ParaView on the other hand is based on pure vtk, which makes it a tad less straightforward to manipulate ndarrays directly. However, some support functions are readily available:

>>> from vtk.util import numpy_support as npvtk
>>> vtkarray = npvtk.numpy_to_vtk(numpy_array)
>>> numpy_array = npvtk.vtk_to_numpy(vtkarray)

More reading:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top