将3D numpy导出到VTK文件以在Paraview/Mayavi中查看 [英] Exporting a 3D numpy to a VTK file for viewing in Paraview/Mayavi

查看:353
本文介绍了将3D numpy导出到VTK文件以在Paraview/Mayavi中查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于那些想要将简单的3D numpy数组(以及轴)导出到.vtk(或.vtr)文件以进行后处理并在Paraview或Mayavi中显示的用户,有一个名为

For those that want to export a simple 3D numpy array (along with axes) to a .vtk (or .vtr) file for post-processing and display in Paraview or Mayavi there's a little module called PyEVTK that does exactly that. The module supports structured and unstructured data etc.. Unfortunately, even though the code works fine in unix-based systems I couldn't make it work (keeps crashing) on any windows installation which simply makes things complicated. Ive contacted the developer but his suggestions did not work

因此,我的问题是: 如何使用from vtk.util import numpy_support函数将3D数组(该函数本身不支持3D数组)导出到.vtk文件?有没有创建vtkDatasets等的简单方法吗?

Therefore my question is: How can one use the from vtk.util import numpy_support function to export a 3D array (the function itself doesn't support 3D arrays) to a .vtk file? Is there a simple way to do it without creating vtkDatasets etc etc?

非常感谢!

推荐答案

它已经永远存在了,我完全忘记了问这个问题,但最终还是弄清楚了.我在我的博客(PyScience)中写了一篇有关它的文章,提供了有关如何在NumPy和VTK之间进行转换的教程.如果有兴趣,请看看:

It's been forever and I had entirely forgotten asking this question but I ended up figuring it out. I've written a post about it in my blog (PyScience) providing a tutorial on how to convert between NumPy and VTK. Do take a look if interested:

pyscience.wordpress.com/2014/09/06/numpy-to-vtk-converting-your-numpy-arrays-to-vtk-arrays-and-files/

这篇关于将3D numpy导出到VTK文件以在Paraview/Mayavi中查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆