• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utility.ShortcutManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中volumina.utility.ShortcutManager的典型用法代码示例。如果您正苦于以下问题:Python ShortcutManager类的具体用法?Python ShortcutManager怎么用?Python ShortcutManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ShortcutManager类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _updateLabelShortcuts

    def _updateLabelShortcuts(self):
        numShortcuts = len(self._labelShortcuts)
        numRows = len(self._labelControlUi.labelListModel)

        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        # Add any shortcuts we don't have yet.
        for i in range(numShortcuts, numRows):
            toolTipObject = LabelListModel.EntryToolTipAdapter(
                self._labelControlUi.labelListModel, i)
            action_info = ActionInfo(
                "Labeling", "Select Label {}".format(i + 1),
                "Select Label {}".format(i + 1),
                partial(self._labelControlUi.labelListView.selectRow,
                        i), self._labelControlUi.labelListView, toolTipObject)
            mgr.register(str(i + 1), action_info)
            self._labelShortcuts.append(action_info)

        # Make sure that all shortcuts have an appropriate description
        for i in range(numRows):
            action_info = self._labelShortcuts[i]
            description = "Select " + self._labelControlUi.labelListModel[
                i].name
            new_action_info = mgr.update_description(action_info, description)
            self._labelShortcuts[i] = new_action_info
开发者ID:jenspetersen,项目名称:ilastik,代码行数:25,代码来源:labelingGui.py


示例2: createDrawerControls

    def createDrawerControls(self):
        op = self.topLevelOperatorView

        def configure_update_handlers( qt_signal, op_slot ):
            qt_signal.connect( self.configure_operator_from_gui )
            cleanup_fn = op_slot.notifyDirty( self.configure_gui_from_operator, defer=True )
            self.__cleanup_fns.append( cleanup_fn )

        # Controls
        feature_selection_button = QPushButton(text="Select Features",
                                               icon=QIcon(ilastikIcons.AddSel),
                                               toolTip="Select edge/superpixel features to use for classification.",
                                               clicked=self._open_feature_selection_dlg)
        self.train_from_gt_button = QPushButton(text="Auto-label",
                                                icon=QIcon(ilastikIcons.Segment),
                                                toolTip="Automatically label all edges according to your pre-loaded groundtruth volume.",
                                                clicked=self._handle_label_from_gt_clicked)
        self.clear_labels_button = QPushButton(text="Clear Labels",
                                               icon=QIcon(ilastikIcons.Clear),
                                               toolTip="Remove all edge labels. (Start over on this image.)",
                                               clicked=self._handle_clear_labels_clicked)
        self.live_update_button = QPushButton(text="Live Predict",
                                              checkable=True,
                                              icon=QIcon(ilastikIcons.Play),
                                              toolTip="Update the edge classifier predictions",
                                              clicked=self._handle_live_update_clicked)
        configure_update_handlers( self.live_update_button.toggled, op.FreezeCache )
        
        # Layout
        label_layout = QHBoxLayout()
        label_layout.addWidget(self.clear_labels_button)
        label_layout.addWidget(self.train_from_gt_button)
        label_layout.setSpacing(1)
        
        layout = QVBoxLayout()
        layout.addWidget(feature_selection_button)
        layout.setSpacing(1)
        layout.addLayout(label_layout)
        layout.addWidget(self.live_update_button)
        layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) )
        
        # Finally, the whole drawer widget
        drawer = QWidget(parent=self)
        drawer.setLayout(layout)

        # Widget Shortcuts
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcut_group = "Edge Training"
        mgr.register( "l", ActionInfo( shortcut_group,
                                       "Live Predict",
                                       "Toggle live edge classifier update mode",
                                       self.live_update_button.toggle,
                                       self.live_update_button,
                                       self.live_update_button ) )

        
        return drawer
开发者ID:DerThorsten,项目名称:ilastik,代码行数:58,代码来源:edgeTrainingGui.py


示例3: __initShortcuts

    def __initShortcuts(self):
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcutGroupName = "Labeling"

        if hasattr(self.labelingDrawerUi, "AddLabelButton"):
            mgr.register("a", ActionInfo( shortcutGroupName,
                                          "New Label",
                                          "Add New Label Class",
                                          self.labelingDrawerUi.AddLabelButton.click,
                                          self.labelingDrawerUi.AddLabelButton,
                                          self.labelingDrawerUi.AddLabelButton ) )

        mgr.register( "n", ActionInfo( shortcutGroupName,
                                       "Navigation Cursor",
                                       "Navigation Cursor",
                                       self.labelingDrawerUi.arrowToolButton.click,
                                       self.labelingDrawerUi.arrowToolButton,
                                       self.labelingDrawerUi.arrowToolButton ) )

        mgr.register( "b", ActionInfo( shortcutGroupName,
                                       "Brush Cursor",
                                       "Brush Cursor",
                                       self.labelingDrawerUi.paintToolButton.click,
                                       self.labelingDrawerUi.paintToolButton,
                                       self.labelingDrawerUi.paintToolButton ) )

        mgr.register( "e", ActionInfo( shortcutGroupName,
                                       "Eraser Cursor",
                                       "Eraser Cursor",
                                       self.labelingDrawerUi.eraserToolButton.click,
                                       self.labelingDrawerUi.eraserToolButton,
                                       self.labelingDrawerUi.eraserToolButton ) )

        self._labelShortcuts = []
开发者ID:burcin,项目名称:ilastik,代码行数:35,代码来源:labelingGui.py


示例4: __initShortcuts

    def __initShortcuts(self):
        mgr = ShortcutManager()
        shortcutGroupName = "Labeling"

        if hasattr(self.labelingDrawerUi, "AddLabelButton"):
            addLabel = QShortcut(QKeySequence("a"), self, member=self.labelingDrawerUi.AddLabelButton.click)
            mgr.register(shortcutGroupName, "Add New Label Class", addLabel, self.labelingDrawerUi.AddLabelButton)

        navMode = QShortcut(QKeySequence("n"), self, member=self.labelingDrawerUi.arrowToolButton.click)
        mgr.register(shortcutGroupName, "Navigation Cursor", navMode, self.labelingDrawerUi.arrowToolButton)

        brushMode = QShortcut(QKeySequence("b"), self, member=self.labelingDrawerUi.paintToolButton.click)
        mgr.register(shortcutGroupName, "Brush Cursor", brushMode, self.labelingDrawerUi.paintToolButton)

        eraserMode = QShortcut(QKeySequence("e"), self, member=self.labelingDrawerUi.eraserToolButton.click)
        mgr.register(shortcutGroupName, "Eraser Cursor", eraserMode, self.labelingDrawerUi.eraserToolButton)
        """
        changeBrushSize = QShortcut( QKeySequence("c"), self, member=self.labelingDrawerUi.brushSizeComboBox.showPopup )
        mgr.register( shortcutGroupName,
                      "Change Brush Size",
                      changeBrushSize,
                      self.labelingDrawerUi.brushSizeComboBox )
        """

        self._labelShortcuts = []
开发者ID:jennyhong,项目名称:ilastik,代码行数:25,代码来源:labelingGui.py


示例5: setUpShortcuts

    def setUpShortcuts(self):
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo

        selector = self.channelSelector

        def inc():
            selector.setValue(selector.value() + selector.singleStep())

        def dec():
            selector.setValue(selector.value() - selector.singleStep())

        # Can't pass channelSelector(QSpinBox) as tooltip widget
        # because it doesn't have # separate tooltips for arrows
        mgr.register(NEXT_CHANNEL_SEQ, ActionInfo("Navigation", "Next channel", "Next channel", inc, selector, None))
        mgr.register(PREV_CHANNEL_SEQ, ActionInfo("Navigation", "Prev channel", "Prev channel", dec, selector, None))
开发者ID:ilastik,项目名称:volumina,代码行数:16,代码来源:layerwidget.py


示例6: _initShortcuts

    def _initShortcuts(self):
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcutGroupName = "Predictions"

        mgr.register( "p", ActionInfo( shortcutGroupName,
                                       "Toggle Prediction",
                                       "Toggle Prediction Layer Visibility",
                                       self._viewerControlUi.checkShowPredictions.click,
                                       self._viewerControlUi.checkShowPredictions,
                                       self._viewerControlUi.checkShowPredictions ) )

        mgr.register( "s", ActionInfo( shortcutGroupName,
                                       "Toggle Segmentaton",
                                       "Toggle Segmentaton Layer Visibility",
                                       self._viewerControlUi.checkShowSegmentation.click,
                                       self._viewerControlUi.checkShowSegmentation,
                                       self._viewerControlUi.checkShowSegmentation ) )

        mgr.register( "l", ActionInfo( shortcutGroupName,
                                       "Live Prediction",
                                       "Toggle Live Prediction Mode",
                                       self.labelingDrawerUi.liveUpdateButton.toggle,
                                       self.labelingDrawerUi.liveUpdateButton,
                                       self.labelingDrawerUi.liveUpdateButton ) )
开发者ID:DerThorsten,项目名称:ilastik,代码行数:25,代码来源:pixelClassificationGui.py


示例7: _initShortcuts

    def _initShortcuts(self):
        mgr = ShortcutManager()
        shortcutGroupName = "Predictions"

        togglePredictions = QShortcut(QKeySequence("p"), self, member=self._viewerControlUi.checkShowPredictions.click)
        mgr.register(
            shortcutGroupName,
            "Toggle Prediction Layer Visibility",
            togglePredictions,
            self._viewerControlUi.checkShowPredictions,
        )

        toggleSegmentation = QShortcut(
            QKeySequence("s"), self, member=self._viewerControlUi.checkShowSegmentation.click
        )
        mgr.register(
            shortcutGroupName,
            "Toggle Segmentaton Layer Visibility",
            toggleSegmentation,
            self._viewerControlUi.checkShowSegmentation,
        )

        toggleLivePredict = QShortcut(QKeySequence("l"), self, member=self.labelingDrawerUi.liveUpdateButton.toggle)
        mgr.register(
            shortcutGroupName, "Toggle Live Prediction Mode", toggleLivePredict, self.labelingDrawerUi.liveUpdateButton
        )
开发者ID:JensNRAD,项目名称:ilastik_public,代码行数:26,代码来源:pixelClassificationGui.py


示例8: __initShortcuts

    def __initShortcuts(self):
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcutGroupName = "Cropping"

        if hasattr(self.croppingDrawerUi, "AddCropButton"):
            mgr.register("n", ActionInfo( shortcutGroupName,
                                          "New Crop",
                                          "Add a new crop.",
                                          self.croppingDrawerUi.AddCropButton.click,
                                          self.croppingDrawerUi.AddCropButton,
                                          self.croppingDrawerUi.AddCropButton ) )

        if hasattr(self.croppingDrawerUi, "SetCropButton"):
            mgr.register("s", ActionInfo( shortcutGroupName,
                                          "Save Crop",
                                          "Save the current crop.",
                                          self.croppingDrawerUi.SetCropButton.click,
                                          self.croppingDrawerUi.SetCropButton,
                                          self.croppingDrawerUi.SetCropButton ) )

        self._cropShortcuts = []
开发者ID:ilastik,项目名称:ilastik,代码行数:22,代码来源:croppingGui.py


示例9: _initShortcuts

    def _initShortcuts(self):
        mgr = ShortcutManager()
        shortcutGroupName = "Manual Tracking"

        divisionEvent = QtGui.QShortcut( QtGui.QKeySequence("d"), self, member=self._drawer.divEvent.click )
        mgr.register( shortcutGroupName,
                      "Mark Division Event (Click on parent object first, then on the two children.)",
                      divisionEvent,
                      self._drawer.divEvent )
        
        newTrack = QtGui.QShortcut( QtGui.QKeySequence("s"), self, member=self._drawer.newTrack.click )
        mgr.register( shortcutGroupName,
                      "Start New Track",
                      newTrack,
                      self._drawer.newTrack )

        markMisdet = QtGui.QShortcut( QtGui.QKeySequence("f"), self, member=self._drawer.markMisdetection.click )
        mgr.register( shortcutGroupName,
                      "Mark False Detection",
                      markMisdet,
                      self._drawer.markMisdetection )
        
        activeTrackUp = QtGui.QShortcut( QtGui.QKeySequence("q"), self, member=self._incrementActiveTrack )
        mgr.register( shortcutGroupName,
                      "Increment Active Track ID",
                      activeTrackUp,)
        
        activeTrackDown = QtGui.QShortcut( QtGui.QKeySequence("a"), self, member=self._decrementActiveTrack )
        mgr.register( shortcutGroupName,
                      "Decrement Active Track ID",
                      activeTrackDown,)
        
        goToNext = QtGui.QShortcut( QtGui.QKeySequence("g"), self, member=self._onNextUnlabeledPressed )
        mgr.register( shortcutGroupName,
                      "Go To Next Unlabeled Object",
                      goToNext,)
开发者ID:jennyhong,项目名称:ilastik,代码行数:36,代码来源:manualTrackingGui.py


示例10: __init__

    def __init__(self, labelingSlots, topLevelOperatorView, drawerUiPath=None, rawInputSlot=None ):
        self.topLevelOperatorView = topLevelOperatorView

        # We provide our own UI file (which adds an extra control for interactive mode)
        directory = os.path.split(__file__)[0]
        carvingDrawerUiPath = os.path.join(directory, 'carvingDrawer.ui')

        super(CarvingGui, self).__init__(labelingSlots, topLevelOperatorView, carvingDrawerUiPath, rawInputSlot)
        
        mgr = ShortcutManager()
        
        #set up keyboard shortcuts
        segmentShortcut = QShortcut(QKeySequence("3"), self, member=self.labelingDrawerUi.segment.click,
                                    ambiguousMember=self.labelingDrawerUi.segment.click)
        mgr.register("Carving", "Run interactive segmentation", segmentShortcut, self.labelingDrawerUi.segment)
        

        self._doneSegmentationLayer = None

        #volume rendering
        try:
            self.render = True
            self._shownObjects3D = {}
            self._renderMgr = RenderingManager(
                renderer=self.editor.view3d.qvtk.renderer,
                qvtk=self.editor.view3d.qvtk)
        except:
            self.render = False

        def onSegmentButton():
            print "segment button clicked"
            self.topLevelOperatorView.opCarving.Trigger.setDirty(slice(None))
        self.labelingDrawerUi.segment.clicked.connect(onSegmentButton)
        self.labelingDrawerUi.segment.setEnabled(True)

        def onUncertaintyFGButton():
            print "uncertFG button clicked"
            pos = self.topLevelOperatorView.opCarving.getMaxUncertaintyPos(label=2)
            self.editor.posModel.slicingPos = (pos[0], pos[1], pos[2])
        self.labelingDrawerUi.pushButtonUncertaintyFG.clicked.connect(onUncertaintyFGButton)
        self.labelingDrawerUi.pushButtonUncertaintyFG.setEnabled(True)

        def onUncertaintyBGButton():
            print "uncertBG button clicked"
            pos = self.topLevelOperatorView.opCarving.getMaxUncertaintyPos(label=1)
            self.editor.posModel.slicingPos = (pos[0], pos[1], pos[2])
        self.labelingDrawerUi.pushButtonUncertaintyBG.clicked.connect(onUncertaintyBGButton)
        self.labelingDrawerUi.pushButtonUncertaintyBG.setEnabled(True)


        def onBackgroundPrioritySpin(value):
            print "background priority changed to %f" % value
            self.topLevelOperatorView.opCarving.BackgroundPriority.setValue(value)
        self.labelingDrawerUi.backgroundPrioritySpin.valueChanged.connect(onBackgroundPrioritySpin)

        def onuncertaintyCombo(value):
            if value == 0:
                value = "none"
            if value == 1:
                value = "localMargin"
            if value == 2:
                value = "exchangeCount"
            if value == 3:
                value = "gabow"
            print "uncertainty changed to %r" % value
            self.topLevelOperatorView.opCarving.UncertaintyType.setValue(value)
        self.labelingDrawerUi.uncertaintyCombo.currentIndexChanged.connect(onuncertaintyCombo)

        def onBackgroundPriorityDirty(slot, roi):
            oldValue = self.labelingDrawerUi.backgroundPrioritySpin.value()
            newValue = self.topLevelOperatorView.opCarving.BackgroundPriority.value
            if  newValue != oldValue:
                self.labelingDrawerUi.backgroundPrioritySpin.setValue(newValue)
        self.topLevelOperatorView.opCarving.BackgroundPriority.notifyDirty(onBackgroundPriorityDirty)
        
        def onNoBiasBelowDirty(slot, roi):
            oldValue = self.labelingDrawerUi.noBiasBelowSpin.value()
            newValue = self.topLevelOperatorView.opCarving.NoBiasBelow.value
            if  newValue != oldValue:
                self.labelingDrawerUi.noBiasBelowSpin.setValue(newValue)
        self.topLevelOperatorView.opCarving.NoBiasBelow.notifyDirty(onNoBiasBelowDirty)
        
        def onNoBiasBelowSpin(value):
            print "background priority changed to %f" % value
            self.topLevelOperatorView.opCarving.NoBiasBelow.setValue(value)
        self.labelingDrawerUi.noBiasBelowSpin.valueChanged.connect(onNoBiasBelowSpin)

        def onSaveAsButton():
            print "save object as?"
            if self.topLevelOperatorView.opCarving.dataIsStorable():
                name, ok = QInputDialog.getText(self, 'Save Object As', 'object name') 
                name = str(name)
                if not ok:
                    return
                objects = self.topLevelOperatorView.opCarving.AllObjectNames[:].wait()
                if name in objects:
                    QMessageBox.critical(self, "Save Object As", "An object with name '%s' already exists.\nPlease choose a different name." % name)
                    return
                self.topLevelOperatorView.opCarving.saveObjectAs(name)
                print "save object as %s" % name
#.........这里部分代码省略.........
开发者ID:fblumenthal,项目名称:ilastik,代码行数:101,代码来源:carvingGui.py


示例11: createDrawerControls

    def createDrawerControls(self):
        """
        This is a separate function from initAppletDrawer() so that it can be
        called and used within another applet (this class is a mixin).
        """
        op = self.__topLevelOperatorView

        def configure_update_handlers(qt_signal, op_slot):
            qt_signal.connect(self.configure_operator_from_gui)
            op_slot.notifyDirty(self.configure_gui_from_operator)
            self.__cleanup_fns.append(partial(op_slot.unregisterDirty, self.configure_gui_from_operator))

        def control_layout(label_text, widget):
            row_layout = QHBoxLayout()
            row_layout.addWidget(QLabel(label_text))
            row_layout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding))
            row_layout.addWidget(widget)
            return row_layout

        drawer_layout = QVBoxLayout()
        drawer_layout.setSpacing(1)

        # Beta
        beta_box = QDoubleSpinBox(
            decimals=2,
            minimum=0.01,
            maximum=0.99,
            singleStep=0.1,
            toolTip="Bias parameter for the multicut optimization.",
        )
        configure_update_handlers(beta_box.valueChanged, op.Beta)
        beta_layout = control_layout("Beta", beta_box)
        drawer_layout.addLayout(beta_layout)
        self.beta_box = beta_box

        # Solver
        solver_name_combo = QComboBox(
            toolTip="Multicut optimization technique. Available solvers depend on which optimizer library you have installed."
        )
        for solver_name in AVAILABLE_SOLVER_NAMES:
            solver_name_combo.addItem(solver_name)
        configure_update_handlers(solver_name_combo.currentIndexChanged, op.SolverName)
        drawer_layout.addLayout(control_layout("Solver", solver_name_combo))
        self.solver_name_combo = solver_name_combo

        # Update Button
        update_button = QPushButton(
            text="Update Multicut", icon=QIcon(ilastikIcons.Play), clicked=self.onUpdateMulticutButton
        )
        drawer_layout.addWidget(update_button)

        # Layout
        drawer_layout.addSpacerItem(QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding))

        # Finally, the whole drawer widget
        drawer = QWidget(parent=self)
        drawer.setLayout(drawer_layout)

        # Widget Shortcuts
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcut_group = "Multicut"
        mgr.register(
            "u",
            ActionInfo(
                shortcut_group,
                "UpdateMulticut",
                "Run the multicut optimization using the current edge probabilities",
                update_button.click,
                update_button,
                update_button,
            ),
        )

        return drawer
开发者ID:ilastik,项目名称:ilastik,代码行数:75,代码来源:multicutGui.py


示例12: __init__

    def __init__(self, parentApplet, topLevelOperatorView, drawerUiPath=None ):
        self.topLevelOperatorView = topLevelOperatorView

        #members
        self._doneSegmentationLayer = None
        self._showSegmentationIn3D = False
        #self._showUncertaintyLayer = False
        #end: members

        labelingSlots = LabelingGui.LabelingSlots()
        labelingSlots.labelInput       = topLevelOperatorView.WriteSeeds
        labelingSlots.labelOutput      = topLevelOperatorView.opLabelArray.Output
        labelingSlots.labelEraserValue = topLevelOperatorView.opLabelArray.EraserLabelValue
        labelingSlots.labelNames       = topLevelOperatorView.LabelNames
        labelingSlots.labelDelete      = topLevelOperatorView.opLabelArray.DeleteLabel
        labelingSlots.maxLabelValue    = topLevelOperatorView.opLabelArray.MaxLabelValue
        
        # We provide our own UI file (which adds an extra control for interactive mode)
        directory = os.path.split(__file__)[0]
        if drawerUiPath is None:
            drawerUiPath = os.path.join(directory, 'carvingDrawer.ui')
        self.dialogdirCOM = os.path.join(directory, 'carvingObjectManagement.ui')
        self.dialogdirSAD = os.path.join(directory, 'saveAsDialog.ui')

        super(CarvingGui, self).__init__(parentApplet, labelingSlots, topLevelOperatorView, drawerUiPath)
        
        self.labelingDrawerUi.currentObjectLabel.setText("<not saved yet>")

        # Init special base class members
        self.minLabelNumber = 2
        self.maxLabelNumber = 2
        
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        
        #set up keyboard shortcuts
        mgr.register( "3", ActionInfo( "Carving", 
                                       "Run interactive segmentation", 
                                       "Run interactive segmentation", 
                                       self.labelingDrawerUi.segment.click,
                                       self.labelingDrawerUi.segment,
                                       self.labelingDrawerUi.segment  ) )

        
        # Disable 3D view by default
        self.render = False
        tagged_shape = defaultdict(lambda: 1)
        tagged_shape.update( topLevelOperatorView.InputData.meta.getTaggedShape() )
        is_3d = (tagged_shape['x'] > 1 and tagged_shape['y'] > 1 and tagged_shape['z'] > 1)

        if is_3d:
            try:
                self._renderMgr = RenderingManager( self.editor.view3d )
                self._shownObjects3D = {}
                self.render = True
            except:
                self.render = False

        # Segmentation is toggled on by default in _after_init, below.
        # (We can't enable it until the layers are all present.)
        self._showSegmentationIn3D = False
        self._segmentation_3d_label = None
                
        self.labelingDrawerUi.segment.clicked.connect(self.onSegmentButton)
        self.labelingDrawerUi.segment.setEnabled(True)

        self.topLevelOperatorView.Segmentation.notifyDirty( bind( self._update_rendering ) )
        self.topLevelOperatorView.HasSegmentation.notifyValueChanged( bind( self._updateGui ) )

        ## uncertainty

        #self.labelingDrawerUi.pushButtonUncertaintyFG.setEnabled(False)
        #self.labelingDrawerUi.pushButtonUncertaintyBG.setEnabled(False)

        #def onUncertaintyFGButton():
        #    logger.debug( "uncertFG button clicked" )
        #    pos = self.topLevelOperatorView.getMaxUncertaintyPos(label=2)
        #    self.editor.posModel.slicingPos = (pos[0], pos[1], pos[2])
        #self.labelingDrawerUi.pushButtonUncertaintyFG.clicked.connect(onUncertaintyFGButton)

        #def onUncertaintyBGButton():
        #    logger.debug( "uncertBG button clicked" )
        #    pos = self.topLevelOperatorView.getMaxUncertaintyPos(label=1)
        #    self.editor.posModel.slicingPos = (pos[0], pos[1], pos[2])
        #self.labelingDrawerUi.pushButtonUncertaintyBG.clicked.connect(onUncertaintyBGButton)

        #def onUncertaintyCombo(value):
        #    if value == 0:
        #        value = "none"
        #        self.labelingDrawerUi.pushButtonUncertaintyFG.setEnabled(False)
        #        self.labelingDrawerUi.pushButtonUncertaintyBG.setEnabled(False)
        #        self._showUncertaintyLayer = False
        #    else:
        #        if value == 1:
        #            value = "localMargin"
        #        elif value == 2:
        #            value = "exchangeCount"
        #        elif value == 3:
        #            value = "gabow"
        #        else:
#.........这里部分代码省略.........
开发者ID:JaimeIvanCervantes,项目名称:ilastik,代码行数:101,代码来源:carvingGui.py


示例13: _initShortcuts

    def _initShortcuts(self):
        # TODO: Fix this dependency on ImageView/HUD internals
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        mgr.register(
            "x",
            ActionInfo(
                "Navigation",
                "Minimize/Maximize x-Window",
                "Minimize/Maximize x-Window",
                self.quadview.switchXMinMax,
                self.editor.imageViews[0].hud.buttons["maximize"],
                self.editor.imageViews[0].hud.buttons["maximize"],
            ),
        )

        mgr.register(
            "y",
            ActionInfo(
                "Navigation",
                "Minimize/Maximize y-Window",
                "Minimize/Maximize y-Window",
                self.quadview.switchYMinMax,
                self.editor.imageViews[1].hud.buttons["maximize"],
                self.editor.imageViews[1].hud.buttons["maximize"],
            ),
        )

        mgr.register(
            "z",
            ActionInfo(
                "Navigation",
                "Minimize/Maximize z-Window",
                "Minimize/Maximize z-Window",
                self.quadview.switchZMinMax,
                self.editor.imageViews[2].hud.buttons["maximize"],
                self.editor.imageViews[2].hud.buttons["maximize"],
            ),
        )

        for i, v in enumerate(self.editor.imageViews):
            mgr.register("+", ActionInfo("Navigation", "Zoom in", "Zoom in", v.zoomIn, v, None))
            mgr.register("-", ActionInfo("Navigation", "Zoom out", "Zoom out", v.zoomOut, v, None))

            mgr.register("c", ActionInfo("Navigation", "Center image", "Center image", v.centerImage, v, None))

            mgr.register("h", ActionInfo("Navigation", "Toggle hud", "Toggle hud", v.toggleHud, v, None))

            # FIXME: The nextChannel/previousChannel functions don't work right now.
            # self._shortcutHelper("q", "Navigation", "Switch to next channel",     v, self.editor.nextChannel,     Qt.WidgetShortcut))
            # self._shortcutHelper("a", "Navigation", "Switch to previous channel", v, self.editor.previousChannel, Qt.WidgetShortcut))

            def sliceDelta(axis, delta):
                newPos = copy.copy(self.editor.posModel.slicingPos)
                newPos[axis] += delta
                newPos[axis] = max(0, newPos[axis])
                newPos[axis] = min(self.editor.posModel.shape[axis] - 1, newPos[axis])
                self.editor.posModel.slicingPos = newPos

            def jumpToFirstSlice(axis):
                newPos = copy.copy(self.editor.posModel.slicingPos)
                newPos[axis] = 0
                self.editor.posModel.slicingPos = newPos

            def jumpToLastSlice(axis):
                newPos = copy.copy(self.editor.posModel.slicingPos)
                newPos[axis] = self.editor.posModel.shape[axis] - 1
                self.editor.posModel.slicingPos = newPos

            # TODO: Fix this dependency on ImageView/HUD internals
            mgr.register(
                "Ctrl+Up",
                ActionInfo(
                    "Navigation", "Slice up", "Slice up", partial(sliceDelta, i, 1), v, v.hud.buttons["slice"].upLabel
                ),
            )

            mgr.register(
                "Ctrl+Down",
                ActionInfo(
                    "Navigation",
                    "Slice up",
                    "Slice up",
                    partial(sliceDelta, i, -1),
                    v,
                    v.hud.buttons["slice"].downLabel,
                ),
            )

            #            self._shortcutHelper("p", "Navigation", "Slice up (alternate shortcut)",   v, partial(sliceDelta, i, 1),  Qt.WidgetShortcut)
            #            self._shortcutHelper("o", "Navigation", "Slice down (alternate shortcut)", v, partial(sliceDelta, i, -1), Qt.WidgetShortcut)

            mgr.register(
                "Ctrl+Shift+Up",
                ActionInfo("Navigation", "10 slices up", "10 slices up", partial(sliceDelta, i, 10), v, None),
            )

            mgr.register(
                "Ctrl+Shift+Down",
                ActionInfo("Navigation", "10 slices down", "10 slices down", partial(sliceDelta, i, -10), v, None),
#.........这里部分代码省略.........
开发者ID:ilastik,项目名称:volumina,代码行数:101,代码来源:volumeEditorWidget.py


示例14: __initShortcuts

    def __initShortcuts(self):
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcutGroupName = "Labeling"

        if hasattr(self.labelingDrawerUi, "AddLabelButton"):

            mgr.register("a", ActionInfo(shortcutGroupName,
                                         "New Label",
                                         "Add New Label Class",
                                         self.labelingDrawerUi.AddLabelButton.click,
                                         self.labelingDrawerUi.AddLabelButton,
                                         self.labelingDrawerUi.AddLabelButton))

        mgr.register("n", ActionInfo(shortcutGroupName,
                                     "Navigation Cursor",
                                     "Navigation Cursor",
                                     self.labelingDrawerUi.arrowToolButton.click,
                                     self.labelingDrawerUi.arrowToolButton,
                                     self.labelingDrawerUi.arrowToolButton))

        mgr.register("b", ActionInfo( shortcutGroupName,
                                      "Brush Cursor",
                                      "Brush Cursor",
                                      self.labelingDrawerUi.paintToolButton.click,
                                      self.labelingDrawerUi.paintToolButton,
                                      self.labelingDrawerUi.paintToolButton))

        mgr.register("e", ActionInfo(shortcutGroupName,
                                     "Eraser Cursor",
                                     "Eraser Cursor",
                                     self.labelingDrawerUi.eraserToolButton.click,
                                     self.labelingDrawerUi.eraserToolButton,
                                     self.labelingDrawerUi.eraserToolButton))

        mgr.register(",", ActionInfo( shortcutGroupName,
                                      "Decrease Brush Size",
                                      "Decrease Brush Size",
                                      partial(self._tweakBrushSize, False),
                                      self.labelingDrawerUi.brushSizeComboBox,
                                      self.labelingDrawerUi.brushSizeComboBox))

        mgr.register(".", ActionInfo(shortcutGroupName,
                                     "Increase Brush Size",
                                     "Increase Brush Size",
                                     partial(self._tweakBrushSize, True),
                                     self.labelingDrawerUi.brushSizeComboBox,
                                     self.labelingDrawerUi.brushSizeComboBox))

        if hasattr(self.labelingDrawerUi, "thresToolButton"):
            mgr.register("t", ActionInfo(shortcutGroupName,
                                           "Window Leveling",
                                           "<p>Window Leveling can be used to adjust the data range used for visualization. Pressing the left mouse button while moving the mouse back and forth changes the window width (data range). Moving the mouse in the left-right plane changes the window mean. Pressing the right mouse button resets the view back to the original data.",
                                           self.labelingDrawerUi.thresToolButton.click,
                                           self.labelingDrawerUi.thresToolButton,
                                           self.labelingDrawerUi.thresToolButton))


        self._labelShortcuts = []
开发者ID:ilastik,项目名称:ilastik,代码行数:59,代码来源:labelingGui.py


示例15: __init__

    def __init__(self, topLevelOperatorView, drawerUiPath=None ):
        self.topLevelOperatorView = topLevelOperatorView

        labelingSlots = LabelingGui.LabelingSlots()
        labelingSlots.labelInput = topLevelOperatorView.WriteSeeds
        labelingSlots.labelOutput = topLevelOperatorView.opLabelArray.Output
        labelingSlots.labelEraserValue = topLevelOperatorView.opLabelArray.EraserLabelValue
        labelingSlots.labelDelete = topLevelOperatorView.opLabelArray.DeleteLabel
        labelingSlots.maxLabelValue = topLevelOperatorView.opLabelArray.MaxLabelValue
        labelingSlots.labelsAllowed = topLevelOperatorView.LabelsAllowed

        # We provide our own UI file (which adds an extra control for interactive mode)
        directory = os.path.split(__file__)[0]
        if drawerUiPath is None:
            drawerUiPath = os.path.join(directory, 'carvingDrawer.ui')
        self.dialogdirCOM = os.path.join(directory, 'carvingObjectManagement.ui')
        self.dialogdirSAD = os.path.join(directory, 'saveAsDialog.ui')

        rawInputSlot = topLevelOperatorView.RawData        
        super(CarvingGui, self).__init__(labelingSlots, topLevelOperatorView, drawerUiPath, rawInputSlot)

        # Init special base class members
        self.minLabelNumber = 2
        self.maxLabelNumber = 2
        
        mgr = ShortcutManager()
        
        #set up keyboard shortcuts
        segmentShortcut = QShortcut(QKeySequence("3"), self, member=self.labelingDrawerUi.segment.click,
                                    ambiguousMember=self.labelingDrawerUi.segment.click)
        mgr.register("Carving", "Run interactive segmentation", segmentShortcut, self.labelingDrawerUi.segment)
        

        self._doneSegmentationLayer = None
        self._showSegmentationIn3D = False
        
        #volume rendering
        try:
            self.render = True
            self._shownObjects3D = {}
            self._renderMgr = RenderingManager(
                renderer=self.editor.view3d.qvtk.renderer,
                qvtk=self.editor.view3d.qvtk)
        except:
            self.render = False

        
        self.labelingDrawerUi.segment.clicked.connect(self.onSegmentButton)
        self.labelingDrawerUi.segment.setEnabled(True)

        self.topLevelOperatorView.Segmentation.notifyDirty( bind( self._update_rendering ) )

        def onUncertaintyFGButton():
            print "uncertFG button clicked"
            pos = self.topLevelOperatorView.getMaxUncertaintyPos(label=2)
            self.editor.posModel.slicingPos = (pos[0], pos[1], pos[2])
        self.labelingDrawerUi.pushButtonUncertaintyFG.clicked.connect(onUncertaintyFGButton)
        self.labelingDrawerUi.pushButtonUncertaintyFG.setEnabled(True)

        def onUncertaintyBGButton():
            print "uncertBG button clicked"
            pos = self.topLevelOperatorView.getMaxUncertaintyPos(label=1)
            self.editor.posModel.slicingPos = (pos[0], pos[1], pos[2])
        self.labelingDrawerUi.pushButtonUncertaintyBG.clicked.connect(onUncertaintyBGButton)
        self.labelingDrawerUi.pushButtonUncertaintyBG.setEnabled(True)


        def onBackgroundPrioritySpin(value):
            print "background priority changed to %f" % value
            self.topLevelOperatorView.BackgroundPriority.setValue(value)
        self.labelingDrawerUi.backgroundPrioritySpin.valueChanged.connect(onBackgroundPrioritySpin)

        def onuncertaintyCombo(value):
            if value == 0:
                value = "none"
            if value == 1:
                value = "localMargin"
            if value == 2:
                value = "exchangeCount"
            if value == 3:
                value = "gabow"
            print "uncertainty changed to %r" % value
            self.topLevelOperatorView.UncertaintyType.setValue(value)
        self.labelingDrawerUi.uncertaintyCombo.currentIndexChanged.connect(onuncertaintyCombo)

        def onBackgroundPriorityDirty(slot, roi):
            oldValue = self.labelingDrawerUi.backgroundPrioritySpin.value()
            newValue = self.topLevelOperatorView.BackgroundPriority.value
            if  newValue != oldValue:
                self.labelingDrawerUi.backgroundPrioritySpin.setValue(newValue)
        self.topLevelOperatorView.BackgroundPriority.notifyDirty(onBackgroundPriorityDirty)
        
        def onNoBiasBelowDirty(slot, roi):
            oldValue = self.labelingDrawerUi.noBiasBelowSpin.value()
            newValue = self.topLevelOperatorView.NoBiasBelow.value
            if  newValue != oldValue:
                self.labelingDrawerUi.noBiasBelowSpin.setValue(newValue)
        self.topLevelOperatorView.NoBiasBelow.notifyDirty(onNoBiasBelowDirty)
        
        def onNoBiasBelowSpin(value):
#.........这里部分代码省略.........
开发者ID:hanslovsky,项目名称:ilastik,代码行数:101,代码来源:carvingGui.py


示例16: __initShortcuts

    def __initShortcuts(self):
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcutGroupName = "Labeling"

        if hasattr(self.labelingDrawerUi, "AddLabelButton"):

            mgr.register("a", ActionInfo( shortcutGroupName,
                                          "New Label",
                                          "Add New Label Class",
                                          self.labelingDrawerUi.AddLabelButton.click,
                                          self.labelingDrawerUi.AddLabelButton,
                                          self.labelingDrawerUi.AddLabelButton ) )

        mgr.register( "n", 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python volumeRendering.RenderingManager类代码示例发布时间:2022-05-26
下一篇:
Python utility.encode_from_qstring函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap