1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
"""
Common utilities for all of the vtkPiston python tests.
"""
import sys
import vtk
def parseArgs():
argv = sys.argv
result = {};
stripped_args = []
for i in range(0, len(argv)):
if argv[i] == '--save_data':
result["SaveData"] = True
elif argv[i] == '--gpu_render':
result["GPURender"] = True
elif argv[i] == '-I':
result["Interactive"] = True
stripped_args.append(argv[i])
elif argv[i] == '--normalize':
result["Normalize"] = True
else:
stripped_args.append(argv[i])
sys.argv = stripped_args
return result
def printDS(label, id):
print label
print id.__this__
print id.GetClassName()
print id.GetBounds()
print id.GetNumberOfPoints()
print id.GetNumberOfCells()
numarrays = id.GetPointData().GetNumberOfArrays()
print "Number of Point arrays", numarrays
for x in range(numarrays):
na = id.GetPointData().GetArray(x)
print na.GetName()
print na.GetDataType()
print na.GetNumberOfComponents()
print na.GetNumberOfTuples()
def printTDO(label, id):
print label
print id.__this__
print id.GetClassName()
print id.GetReferredType()
print id.GetReferredData()
def writeFile(ifilter, filename):
dsw = vtk.vtkDataSetWriter()
dsw.SetInputConnection(ifilter.GetOutputPort())
dsw.SetFileName(filename)
dsw.Write()
|