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

Function compareImage

Wrapping/Python/vtkmodules/test/Testing.py:354–375  ·  view source on GitHub ↗

Compares renwin's (a vtkRenderWindow) contents with the image file whose name is given in the second argument. If the image file does not exist the image is generated and stored. If not the image in the render window is compared to that of the figure. This function also handles mul

(renwin, img_fname, threshold=0.05)

Source from the content-addressed store, hash-verified

352 print(output_string.get())
353
354def compareImage(renwin, img_fname, threshold=0.05):
355 """Compares renwin's (a vtkRenderWindow) contents with the image
356 file whose name is given in the second argument. If the image
357 file does not exist the image is generated and stored. If not the
358 image in the render window is compared to that of the figure.
359 This function also handles multiple images and finds the best
360 matching image. """
361
362 global _NO_IMAGE
363 if _NO_IMAGE:
364 return
365
366 w2if = vtkWindowToImageFilter()
367 w2if.ReadFrontBufferOff()
368 w2if.SetInput(renwin)
369 w2if.Update()
370 try:
371 compareImageWithSavedImage(w2if, img_fname, threshold)
372 except RuntimeError:
373 w2if.ReadFrontBufferOn()
374 compareImageWithSavedImage(w2if, img_fname, threshold)
375 return
376
377def main(cases):
378 """ Pass a list of tuples containing test classes and the starting

Callers 1

assertImageMatchMethod · 0.85

Calls 3

SetInputMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected