Example #1
0
    def setCurrentImage(self, current_image):
        """
        Set the index of the model which denotes the current image to be
        displayed by the scene.  This can be either the index to a frame in a
        video, or to an image.
        """
        if current_image == self._image_item:
            return
        elif current_image is None:
            self.clear()
            self._image_item = None
            self._image      = None
            self._pixmap     = None
        else:
            self.clear()
            self._image_item = current_image
            current_image._seen = True
            assert self._image_item.model() == self._model
            self._image      = self._labeltool.getImage(self._image_item)
            self._pixmap     = QPixmap(toQImage(self._image))
            self._scene_item = QGraphicsPixmapItem(self._pixmap)
            self._scene_item.setZValue(-1)
            self.setSceneRect(0, 0, self._pixmap.width(), self._pixmap.height())
            self.addItem(self._scene_item)

            self.insertItems(0, len(self._image_item.children())-1)
            self.update()
Example #2
0
    def setCurrentImage(self, current_image):
        """
        Set the index of the model which denotes the current image to be
        displayed by the scene.  This can be either the index to a frame in a
        video, or to an image.
        """
        if current_image == self._image_item:
            return
        elif current_image is None:
            self.clear()
            self._image_item = None
            self._image = None
            self._pixmap = None
        else:
            self.clear()
            self._image_item = current_image
            current_image._seen = True
            assert self._image_item.model() == self._model
            self._image = self._labeltool.getImage(self._image_item)
            self._pixmap = QPixmap(toQImage(self._image))
            self._scene_item = QGraphicsPixmapItem(self._pixmap)
            self._scene_item.setZValue(-1)
            self.setSceneRect(0, 0, self._pixmap.width(),
                              self._pixmap.height())
            self.addItem(self._scene_item)

            self.insertItems(0, len(self._image_item.children()) - 1)
            self.update()
Example #3
0
    def setCurrentImage(self, current_image):
        """
        Set the index of the model which denotes the current image to be
        displayed by the scene.  This can be either the index to a frame in a
        video, or to an image.
        """
        if current_image == self._image_item:
            return

        if self.inputflag:
            self.setEndtime()
            self.addTime()
            self.inputflag = False

        if current_image is None:
            self.clear()
            self._image_item = None
            self._image = None
            self._pixmap = None
        else:
            self.clear()
            self._image_item = current_image
            self._opaque = 0.6
            current_image._seen = True
            # assert self._image_item.model() == self._model
            if isinstance(self._image_item, DicomImageModelItem):
                self._image = self._labeltool.getDcmImage(self._image_item)
            elif isinstance(self._image_item, ImageFileModelItem):
                self._image = self._labeltool.getImage(self._image_item)
            self._pixmap = QPixmap(toQImage(self._image))
            self._scene_item = QGraphicsPixmapItem(self._pixmap)
            self._scene_item.setZValue(-1)
            self.setSceneRect(0, 0, self._pixmap.width(),
                              self._pixmap.height())
            self.addItem(self._scene_item)
            self.insertItems(0,
                             len(self._image_item.children()) - 1,
                             edit=True)
            self.update()