MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkRegressionTestImage

Function vtkRegressionTestImage

Wrapping/Python/vtkmodules/util/misc.py:91–133  ·  view source on GitHub ↗

vtkRegressionTestImage(renWin) -- produce regression image for window This function writes out a regression .png file for a vtkWindow. Does anyone involved in testing care to elaborate?

(renWin)

Source from the content-addressed store, hash-verified

89 return tempDir
90
91def vtkRegressionTestImage(renWin):
92 """vtkRegressionTestImage(renWin) -- produce regression image for window
93
94 This function writes out a regression .png file for a vtkWindow.
95 Does anyone involved in testing care to elaborate?
96 """
97 from vtkmodules.vtkRenderingCore import vtkWindowToImageFilter
98 from vtkmodules.vtkIOImage import vtkPNGReader
99 from vtkmodules.vtkImagingCore import vtkImageDifference
100
101 fname = None
102 for i, argv in enumerate(sys.argv):
103 if argv == '-V' and i+1 < len(sys.argv):
104 fname = os.path.join(vtkGetDataRoot(), sys.argv[i+1])
105
106 if fname is None:
107 return 2
108
109 else:
110 rt_w2if = vtkWindowToImageFilter()
111 rt_w2if.SetInput(renWin)
112
113 if not os.path.isfile(fname):
114 rt_pngw = vtkPNGWriter()
115 rt_pngw.SetFileName(fname)
116 rt_pngw.SetInputConnection(rt_w2if.GetOutputPort())
117 rt_pngw.Write()
118 rt_pngw = None
119
120 rt_png = vtkPNGReader()
121 rt_png.SetFileName(fname)
122
123 rt_id = vtkImageDifference()
124 rt_id.SetInputConnection(rt_w2if.GetOutputPort())
125 rt_id.SetImageConnection(rt_png.GetOutputPort())
126 rt_id.Update()
127
128 if rt_id.GetThresholdedError() <= 10:
129 return 1
130 else:
131 sys.stderr.write('Failed image test: %f\n'
132 % rt_id.GetThresholdedError())
133 return 0

Callers 15

TestOBJReaderDoubleFunction · 0.85
TestPTSReaderFunction · 0.85
TestSTLReaderStreamFunction · 0.85
TestTecplotReaderFunction · 0.85
TestOpenFOAMReaderFunction · 0.85
TestMFIXReaderFunction · 0.85
TestAVSucdReaderFunction · 0.85
TestSTLReaderFunction · 0.85
TestWindBladeReaderFunction · 0.85

Calls 10

enumerateFunction · 0.85
vtkGetDataRootFunction · 0.85
joinMethod · 0.45
SetInputMethod · 0.45
SetFileNameMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
WriteMethod · 0.45
UpdateMethod · 0.45
writeMethod · 0.45

Tested by 15

TestOBJReaderDoubleFunction · 0.68
TestPTSReaderFunction · 0.68
TestSTLReaderStreamFunction · 0.68
TestTecplotReaderFunction · 0.68
TestOpenFOAMReaderFunction · 0.68
TestMFIXReaderFunction · 0.68
TestAVSucdReaderFunction · 0.68
TestSTLReaderFunction · 0.68
TestWindBladeReaderFunction · 0.68