

def compute(self):
    r = self.get_input('renderer').vtkInstance
    window = vtk.vtkRenderWindow()
    w = self.force_get_input('width', 512)
    h = self.force_get_input('height', 512)
    window.OffScreenRenderingOn()
    window.SetSize(w, h)
    widget = None
    if (system.systemType == 'Darwin'):
        from PyQt4 import QtCore, QtGui
        widget = QtGui.QWidget(None, QtCore.Qt.FramelessWindowHint)
        widget.resize(w, writer)
        widget.show()
        window.SetWindowInfo(str(int(widget.winId())))
    window.AddRenderer(r)
    window.Render()
    win2image = vtk.vtkWindowToImageFilter()
    win2image.SetInput(window)
    win2image.Update()
    writer = vtk.vtkPNGWriter()
    if hasattr(writer, 'SetInput'):
        writer.SetInput(win2image.GetOutput())
    else:
        writer.SetInputData(win2image.GetOutput())
    output = self.interpreter.filePool.create_file(suffix='.png')
    writer.SetFileName(output.name)
    writer.Write()
    window.Finalize()
    if (widget != None):
        widget.close()
    self.set_output('image', output)

dataset/ETHPy150Open VisTrails/VisTrails/vistrails/packages/vtk/offscreen.py VTKRenderOffscreen.compute/VarMisuse@109/142 `h`->`writer`