本文整理汇总了Python中vtk.test.Testing.compareImageWithSavedImage方法的典型用法代码示例。如果您正苦于以下问题:Python Testing.compareImageWithSavedImage方法的具体用法?Python Testing.compareImageWithSavedImage怎么用?Python Testing.compareImageWithSavedImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk.test.Testing
的用法示例。
在下文中一共展示了Testing.compareImageWithSavedImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRasterEPS
# 需要导入模块: from vtk.test import Testing [as 别名]
# 或者: from vtk.test.Testing import compareImageWithSavedImage [as 别名]
def testRasterEPS(self):
"""Test EPS output when Write3DPropsAsRasterImage is on."""
# Get a temporary file name. Set the extension to empty since
# the exporter appends a suitable extension.
tmp_eps = tempfile.mktemp('')
# Write an EPS file.
exp = vtk.vtkGL2PSExporter()
exp.SetRenderWindow(self.renWin)
exp.SetFilePrefix(tmp_eps)
# Turn off compression so PIL can read file.
exp.CompressOff()
exp.SetSortToOff()
exp.DrawBackgroundOn()
exp.Write3DPropsAsRasterImageOn()
exp.Write()
# Now read the EPS file using PIL.
tmp_eps += '.eps'
im = Image.open(tmp_eps)
# Get a temporary name for the PNG file.
tmp_png = tempfile.mktemp('.png')
im.save(tmp_png)
# Now read the saved image and compare it for the test.
png_r = vtk.vtkPNGReader()
png_r.SetFileName(tmp_png)
png_r.Update()
img = png_r.GetOutput()
# Cleanup. Do this first because if the test fails, an
# exception is raised and the temporary files won't be
# removed.
self._cleanup([tmp_eps, tmp_png])
img_file = "TestGL2PSExporter.png"
Testing.compareImageWithSavedImage(img,
Testing.getAbsImagePath(img_file))
# Interact if necessary.
Testing.interact()