I have a vtkXMLPolyData file that stores point data (temperature, etc.), I wanted to probe it with vtkProbeFilter. The resulting file (out.vtp
) has all of the point data array names, but the ranges of the values in those arrays is all [0, 0]? I have also verified that the data (which sort of looks like a cone) has a tip at the origin, and does pass through the radius 1 area with nodes having nonzero temperature.
import sys, vtk
def project_onto_sphere(pd):
s = vtk.vtkSphereSource()
s.SetThetaResolution(60)
s.SetPhiResolution(30)
s.SetRadius(1)
pf = vtk.vtkProbeFilter()
pf.SetInputConnection(s.GetOutputPort())
pf.SetSourceData(pd)
pf.Update()
return pf.GetOutput()
if __name__ == "__main__":
r = vtk.vtkXMLPolyDataReader()
r.SetFileName(sys.argv[1])
r.Update()
b = project_onto_sphere(r.GetOutput())
w = vtk.vtkXMLPolyDataWriter()
w.SetFileName("out.vtp")
w.SetInputData(b)
w.Write()