convert vti files to open it with python

让人想犯罪 __ 提交于 2021-01-28 03:04:32

问题


I have several .vti files . How can I convert .vti files into a standard format of 2D images? I've tried ParaView, but didn't find any option to convert in one of above mentioned formats like JPEG or PNG.


回答1:


In ParaView: load your vti file, then in the File menu click "Save Data..." and chose the image file format you prefer (I tested with PNG, it works).

In Python, this script reads test.vti and saves test.jpg:

import vtk

reader = vtk.vtkXMLImageDataReader()
reader.SetFileName("test.vti")
reader.Update()
image = reader.GetOutput()

writer = vtk.vtkJPEGWriter()
writer.SetInputData(image)
writer.SetFileName("test.jpg")
writer.Write()


来源:https://stackoverflow.com/questions/55258810/convert-vti-files-to-open-it-with-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!