def _initEditor(self, crosshair):
        """
        Initialize the Volume Editor GUI.
        """
        self.editor = VolumeEditor(self.layerstack, crosshair=crosshair)

        # Replace the editor's navigation interpreter with one that has extra functionality
        self.clickReporter = ClickReportingInterpreter(
            self.editor.navInterpret, self.editor.posModel)
        self.editor.setNavigationInterpreter(self.clickReporter)
        self.clickReporter.rightClickReceived.connect(
            self._handleEditorRightClick)
        self.clickReporter.leftClickReceived.connect(
            self._handleEditorLeftClick)

        clickReporter2 = ClickReportingInterpreter(
            self.editor.brushingInterpreter, self.editor.posModel)
        clickReporter2.rightClickReceived.connect(self._handleEditorRightClick)
        self.editor.brushingInterpreter = clickReporter2

        self.editor.setInteractionMode('navigation')
        self.volumeEditorWidget.init(self.editor)

        self.editor._lastImageViewFocus = 0

        # Zoom at a 1-1 scale to avoid loading big datasets entirely...
        for view in self.editor.imageViews:
            view.doScaleTo(1)
Example #2
0
    def _initEditor(self, crosshair, is_3d_widget_visible):
        """
        Initialize the Volume Editor GUI.
        """
        self.editor = VolumeEditor(self.layerstack,
                                   parent=self,
                                   crosshair=crosshair,
                                   is_3d_widget_visible=is_3d_widget_visible)

        # Replace the editor's navigation interpreter with one that has extra functionality
        self.clickReporter = ClickReportingInterpreter(
            self.editor.navInterpret, self.editor.posModel)
        self.editor.setNavigationInterpreter(self.clickReporter)
        self.clickReporter.rightClickReceived.connect(
            self._handleEditorRightClick)
        self.clickReporter.leftClickReceived.connect(
            self._handleEditorLeftClick)
        self.clickReporter.toolTipReceived.connect(self._handleEditorToolTip)

        clickReporter2 = ClickReportingInterpreter(
            self.editor.brushingInterpreter, self.editor.posModel)
        clickReporter2.rightClickReceived.connect(self._handleEditorRightClick)
        self.editor.brushingInterpreter = clickReporter2

        self.editor.setInteractionMode('navigation')
        self.volumeEditorWidget.init(self.editor)

        self.editor._lastImageViewFocus = 0

        # Zoom at a 1-1 scale to avoid loading big datasets entirely...
        for view in self.editor.imageViews:
            view.doScaleTo(1)

        # Should we default to 2D?
        prefer_2d = False
        for multislot in self.observedSlots:
            for slot in multislot:
                if slot.ready() and slot.meta.prefer_2d:
                    prefer_2d = True
                    break
        if prefer_2d:
            # Default to Z (axis 2 in the editor)
            self.volumeEditorWidget.quadview.ensureMaximized(2)