def paintEvent(self, event):
        imageqt = ImageQt.ImageQt(self.display_image)
        p = QtGui.QPainter()
        p.begin(self)
        p.setRenderHint(QtGui.QPainter.Antialiasing, True);
        scale = self.height() / float(imageqt.height() + 10)
        p.scale(scale, scale)
        p.translate((self.width() / 2 / scale - imageqt.width()  / 2),
                    (self.height() / 2 / scale - imageqt.height() / 2))
        p.fillRect(0, 0, imageqt.width(), imageqt.height(), QtGui.QColor(0, 0, 0))
        p.drawImage(0, 0, imageqt)
        NODE_RADIUS = 4
        # draw nodes
        for loop in self.snake.loops:
            for i in range(len(loop.nodes)):
                p.setPen(QtGui.QColor(255, 0, 0))
                p.setBrush(QtGui.QBrush(QtGui.QColor(255, 0, 0)))
                p.drawEllipse(loop.nodes[i][1] - NODE_RADIUS / 2.0,
                        loop.nodes[i][0] - NODE_RADIUS / 2.0, NODE_RADIUS, NODE_RADIUS)
        # draw lines between nodes
        for loop in self.snake.loops:
            for i in range(len(loop.nodes)):
                if len(loop.nodes) > 1:
                    n = i+1
                    if n == len(loop.nodes):
                        n = 0
                    p.setPen(QtGui.QColor(0, 255, 0))
                    p.drawLine(loop.nodes[i][1], loop.nodes[i][0], loop.nodes[n][1], loop.nodes[n][0])
        p.end()
dataset/ETHPy150Open nasa/CrisisMappingToolkit/bin/test_active_contour.py/ActiveContourWindow.paintEvent/original