Difference between revisions of "Convert a File from LegacyVTK to VTI"

From KitwarePublic
Jump to: navigation, search
Line 16: Line 16:
print "wrote to \"%s\"" % output_filename
print "wrote to \"%s\"" % output_filename
back to [[ParaView/PythonRecipes]].
Back to [[ParaView/PythonRecipes]].

Latest revision as of 13:34, 16 October 2018

This program can be run with the pvpython executable that is distributed with ParaView. Note that this program directly uses low-level VTK classes, not high-level ParaView features.

import sys
import paraview.vtk.io as vtk_io
if len(sys.argv) < 2:
	print "Usage\n\tpvpython vtk2vti.py FILE.vtk [more FILES.vtk...]\n"
for arg in sys.argv[1:]:
	reader = vtk_io.vtkStructuredPointsReader()
	writer = vtk_io.vtkXMLImageDataWriter()
	output_filename = arg + ".vti"
	print "wrote to \"%s\"" % output_filename

Back to ParaView/PythonRecipes.

ParaView: [Welcome | Site Map]