コード例 #1
0
    def __init__(self, parent):
        layout = qt.QGridLayout(parent)

        self.pathList = slicer.qSlicerDirectoryListView()
        layout.addWidget(self.pathList, 0, 0, 3, 1)

        self.addPathButton = qt.QToolButton()
        self.addPathButton.icon = qt.QIcon.fromTheme("list-add")
        self.addPathButton.text = "Add"
        layout.addWidget(self.addPathButton, 0, 1)

        self.removePathButton = qt.QToolButton()
        self.removePathButton.icon = qt.QIcon.fromTheme("list-remove")
        self.removePathButton.text = "Remove"
        layout.addWidget(self.removePathButton, 1, 1)
コード例 #2
0
    def createButtonRow(self, effects, rowLabel=""):
        """ create a row of the edit box given a list of
    effect names (items in _effects(list) """

        rowFrame = qt.QFrame(self.mainFrame)
        self.mainFrame.layout().addWidget(rowFrame)
        self.rowFrames.append(rowFrame)
        hbox = qt.QHBoxLayout()
        rowFrame.setLayout(hbox)

        if rowLabel:
            label = qt.QLabel(rowLabel)
            hbox.addWidget(label)

        for effect in effects:
            # check that the effect belongs in our list of effects before including
            if (effect in self.effects):
                i = self.icons[effect] = qt.QIcon(self.effectIconFiles[effect])
                a = self.actions[effect] = qt.QAction(i, '', rowFrame)
                self.effectButtons[effect] = b = self.buttons[
                    effect] = qt.QToolButton()
                b.setDefaultAction(a)
                b.setToolTip(effect)
                if EditBox.displayNames.has_key(effect):
                    b.setToolTip(EditBox.displayNames[effect])
                hbox.addWidget(b)

                # Setup the mapping between button and its associated effect name
                self.effectMapper.setMapping(self.buttons[effect], effect)
                # Connect button with signal mapper
                self.buttons[effect].connect('clicked()', self.effectMapper,
                                             'map()')

        hbox.addStretch(1)
コード例 #3
0
    def createButtonRow(self, effects, rowLabel=""):

        f = qt.QFrame(self.parent)
        self.parent.layout().addWidget(f)
        self.rowFrames.append(f)
        hbox = qt.QHBoxLayout()
        f.setLayout(hbox)

        if rowLabel:
            label = qt.QLabel(rowLabel)
            hbox.addWidget(label)

        for effect in effects:
            # check that the effect belongs in our list of effects before including
            if (effect in self.effects):
                i = self.icons[effect] = qt.QIcon(
                    self.effectIconFiles[effect, self.effectModes[effect]])
                a = self.actions[effect] = qt.QAction(i, '', f)
                self.effectButtons[effect] = b = self.buttons[
                    effect] = qt.QToolButton()
                b.setDefaultAction(a)
                b.setToolTip(effect)
                if EditBox.displayNames.has_key(effect):
                    b.setToolTip(EditBox.displayNames[effect])
                hbox.addWidget(b)
                if self.disabled.__contains__(effect):
                    b.setDisabled(1)

                # Setup the mapping between button and its associated effect name
                self.effectMapper.setMapping(self.buttons[effect], effect)
                # Connect button with signal mapper
                self.buttons[effect].connect('clicked()', self.effectMapper,
                                             'map()')

        hbox.addStretch(1)
        def createToolButton(text):
            tb = qt.QToolButton()

            tb.text = text
            tb.icon = icon

            font = tb.font
            font.setBold(True)
            font.setPixelSize(14)
            tb.font = font

            tb.iconSize = iconSize
            tb.toolButtonStyle = qt.Qt.ToolButtonTextBesideIcon
            tb.autoRaise = True

            return tb
コード例 #5
0
ファイル: EditBox.py プロジェクト: WYZ621/Slicer
  def createButtonRow(self, effects, rowLabel=""):
    """ create a row of the edit box given a list of
    effect names (items in _effects(list) """

    rowFrame = qt.QFrame(self.mainFrame)
    self.mainFrame.layout().addWidget(rowFrame)
    self.rowFrames.append(rowFrame)
    rowFrame.objectName = "RowFrame%s" % len(self.rowFrames)
    hbox = qt.QHBoxLayout()
    rowFrame.setLayout( hbox )

    if rowLabel:
      label = qt.QLabel(rowLabel)
      hbox.addWidget(label)

    for effect in effects:
      # check that the effect belongs in our list of effects before including
      if (effect in self.effects):
        i = self.icons[effect] = qt.QIcon(self.effectIconFiles[effect])
        a = self.actions[effect] = qt.QAction(i, '', rowFrame)
        a.objectName = effect + 'Action'
        self.effectButtons[effect] = b = self.buttons[effect] = qt.QToolButton()
        b.objectName = effect + 'ToolButton'
        b.setDefaultAction(a)
        b.setToolTip(effect)
        if EditBox.displayNames.has_key(effect):
          b.setToolTip(EditBox.displayNames[effect])
        hbox.addWidget(b)

        if effect not in ('EraseLabel', 'PreviousCheckPoint', 'NextCheckPoint'):
          # Mapping between action and its associated effect, is done
          # in function'_onEffectActionTriggered' by retrieving the 'effectName'
          # property.
          a.checkable = True
          a.setProperty('effectName', effect)
          self.effectActionGroup.addAction(a)
        elif effect == 'EraseLabel':
          a.checkable = True
          a.connect('triggered(bool)', self._onEraseLabelActionTriggered)
        elif effect == 'PreviousCheckPoint':
          a.connect('triggered(bool)', self.undoRedo.undo)
        elif effect == 'NextCheckPoint':
          a.connect('triggered(bool)', self.undoRedo.redo)

    hbox.addStretch(1)
コード例 #6
0
    def configurationSetup(self):
        #### Create a Collapsible Button
        self.setupCB = ctk.ctkCollapsibleButton()
        self.setupCB.text = "ContactPositionEstimator - Configuration"
        self.setupCB.collapsed = True
        self.layout.addWidget(self.setupCB)

        #### Collapsible button layout
        self.setupFL = qt.QFormLayout(self.setupCB)

        #### Tool Box for changing deeto Executable
        self.deetoTB = qt.QToolButton()
        self.deetoTB.setText("...")
        self.deetoTB.toolTip = "Change deeto executable"
        self.deetoTB.enabled = True
        self.deetoTB.connect('clicked(bool)', self.ondeetoTB)

        #### Line Edit button, where the executable path is shown
        self.deetoLE = qt.QLineEdit(
            slicer.modules.ContactPositionEstimatorInstance.deetoExecutablePath
        )
        self.deetoLE.setDisabled(True)
        self.deetoLE.setMaximumWidth(100)
        self.deetoLE.setFixedWidth(400)

        #### Buttons Layout
        self.deetoButtonsHBL = qt.QHBoxLayout()
        self.deetoButtonsHBL.addWidget(self.deetoLE)
        self.deetoButtonsHBL.addWidget(self.deetoTB)

        #### Aggiungo il bottone al layout
        self.setupFL.addRow("ContactPositionEstimator executable: ",
                            self.deetoButtonsHBL)

        #### Button to change the deeto executable location
        #### It is called in ondeetoTB, when deetoTB is selected
        self.deetoFD = qt.QFileDialog()
        self.deetoFD.setFileMode(qt.QFileDialog.AnyFile)
        self.deetoFD.setToolTip("Pick the input to the algorithm.")
コード例 #7
0
ファイル: Finalizer.py プロジェクト: timeanddoctor/SEEGA
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        #### Collapsible Button --- montage
        self.finalizerCBSave = ctk.ctkCollapsibleButton()
        self.finalizerCBSave.text = "1. Montage"
        self.finalizerCBSave.contentsLineWidth = 1
        self.layout.addWidget(self.finalizerCBSave)

        #### Collapsible Button layout
        self.finalizerFLSave = qt.QFormLayout(self.finalizerCBSave)

        self.tableBox = slicer.qMRMLNodeComboBox()
        self.tableBox.nodeTypes = (("vtkMRMLMarkupsFiducialNode"), "")
        self.tableBox.selectNodeUponCreation = False
        self.tableBox.addEnabled = False
        self.tableBox.removeEnabled = False
        self.tableBox.noneEnabled = True
        self.tableBox.setMRMLScene(slicer.mrmlScene)
        self.tableBox.setToolTip("Select a fiducial list")

        # Create montage files
        # NOTE: TODO fix this using qSlicerDataDialog i.e. add the 21E file format
        #   to the supported file formats in slicer, implement a reader that converts the
        #   21E to a markup fiducial list.
        self.channelFileTB = qt.QToolButton()
        self.channelFileTB.setText("...")
        self.channelFileTB.toolTip = "Channel File"
        self.channelFileTB.enabled = True
        self.channelFileTB.connect('clicked(bool)', self.onChannelFileTB)

        #### Line Edit button, where the executable path is shown
        self.channelFileLE = qt.QLineEdit()
        self.channelFileLE.setDisabled(True)
        self.channelFileLE.setMaximumWidth(200)
        self.channelFileLE.setFixedWidth(300)

        badChannelList = slicer.qSlicerSimpleMarkupsWidget()
        badChannelList.setMRMLScene(slicer.mrmlScene)
        badChannelList.setCurrentNode(slicer.util.getNode('recon'))

        self.finalizerFLSave.addWidget(badChannelList)

        #### Buttons Layout
        self.channelFileHBL = qt.QHBoxLayout()
        self.channelFileHBL.addWidget(self.channelFileLE)
        self.channelFileHBL.addWidget(self.channelFileTB)

        self.saveMontagePB = qt.QPushButton("Save Montage")
        self.saveMontagePB.toolTip = "Save Montage"
        self.saveMontagePB.enabled = False
        self.saveMontagePB.connect('clicked(bool)', self.onSaveMontageClick)

        self.createMontagePB = qt.QPushButton("Create Montage")
        self.createMontagePB.toolTip = "Create Montage"
        self.createMontagePB.enabled = True
        self.createMontagePB.connect('clicked(bool)', self.onMontageCreation)

        self.finalizerFLSave.addRow(self.channelFileHBL)
        self.finalizerFLSave.addWidget(self.tableBox)

        self.finalizerFLSave.addWidget(self.createMontagePB)
        self.finalizerFLSave.addWidget(self.saveMontagePB)

        #### Collapsible Button --- Split Fiducial
        self.finalizerCBSplit = ctk.ctkCollapsibleButton()
        self.finalizerCBSplit.text = "2. Split Fiducials"
        self.finalizerCBSplit.contentsLineWidth = 1
        self.layout.addWidget(self.finalizerCBSplit)
        #### Collapsible Button layout
        self.finalizerFLSplit = qt.QFormLayout(self.finalizerCBSplit)

        # SPLIT Fiducial Combobox
        self.fiducialSplitBox = slicer.qMRMLNodeComboBox()
        self.fiducialSplitBox.nodeTypes = (("vtkMRMLMarkupsFiducialNode"), "")
        self.fiducialSplitBox.selectNodeUponCreation = False
        self.fiducialSplitBox.addEnabled = False
        self.fiducialSplitBox.removeEnabled = False
        self.fiducialSplitBox.noneEnabled = True
        self.fiducialSplitBox.setMRMLScene(slicer.mrmlScene)
        self.fiducialSplitBox.setToolTip("Select a fiducial list")

        # SPLIT Fiducials Button
        self.splitFiducialPB = qt.QPushButton("Split Fiducial List")
        self.splitFiducialPB.toolTip = "Split Fiducial file, one for each electrode"
        self.splitFiducialPB.enabled = True
        self.splitFiducialPB.connect('clicked(bool)',
                                     self.onsplitFiducialClick)

        self.finalizerFLSplit.addWidget(self.fiducialSplitBox)
        self.finalizerFLSplit.addWidget(self.splitFiducialPB)

        # Collapsible Button Layout - Report
        self.finalizerCBDoc = ctk.ctkCollapsibleButton()
        self.finalizerCBDoc.text = "3. Report"
        self.finalizerCBDoc.contentsLineWidth = 1
        self.layout.addWidget(self.finalizerCBDoc)
コード例 #8
0
    def setup(self):

        self.__clippingModelNode = None
        self.__clippingMarkupNode = None
        self.__clippingMarkupNodeObserver = None

        self.toFids = slicer.vtkMRMLMarkupsFiducialNode()
        self.fromFids = slicer.vtkMRMLMarkupsFiducialNode()
        self.toFids.SetName('toFids')
        self.fromFids.SetName('fromFids')
        slicer.mrmlScene.AddNode(self.toFids)
        slicer.mrmlScene.AddNode(self.fromFids)
        self.__markupList = []
        # create a callapsible button
        collapsibleButton = ctk.ctkCollapsibleButton()
        collapsibleButton.text = "Cubic Spline Image Segmentation Correction"

        # bind collapsibleButton to root Layout
        self.layout.addWidget(collapsibleButton)

        # new layout for collapsible button
        self.formLayout = qt.QFormLayout(collapsibleButton)

        # volume selector
        self.formFrame = qt.QFrame(collapsibleButton)
        self.formFrame1 = qt.QFrame(collapsibleButton)
        self.formFrame4 = qt.QFrame(collapsibleButton)
        self.formFrame2 = qt.QFrame(collapsibleButton)
        self.formFrame5 = qt.QFrame(collapsibleButton)
        self.formFrame3 = qt.QFrame(collapsibleButton)

        # set a layout to horizontal
        self.formFrame.setLayout(qt.QHBoxLayout())
        self.formFrame1.setLayout(qt.QHBoxLayout())
        self.formFrame4.setLayout(qt.QHBoxLayout())
        self.formFrame2.setLayout(qt.QHBoxLayout())
        self.formFrame5.setLayout(qt.QHBoxLayout())
        self.formFrame3.setLayout(qt.QHBoxLayout())

        # bind a new frame to existing layout in collapsible menu
        self.formLayout.addWidget(self.formFrame)
        self.formLayout.addWidget(self.formFrame1)
        self.formLayout.addWidget(self.formFrame4)
        self.formLayout.addWidget(self.formFrame2)
        self.formLayout.addWidget(self.formFrame5)
        self.formLayout.addWidget(self.formFrame3)

        # creating new volume selector
        self.inputSelector = qt.QLabel("Input Volume: ", self.formFrame)
        self.formFrame.layout().addWidget(self.inputSelector)
        self.inputSelector = slicer.qMRMLNodeComboBox(self.formFrame)
        self.inputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.inputSelector.addEnabled = False
        self.inputSelector.removeEnabled = False

        self.inputSelector1 = qt.QLabel("Input segmentation: ",
                                        self.formFrame1)
        self.formFrame1.layout().addWidget(self.inputSelector1)
        self.inputSelector1 = slicer.qMRMLNodeComboBox(self.formFrame1)
        self.inputSelector1.nodeTypes = (("vtkMRMLSegmentationNode"), "")
        self.inputSelector1.addEnabled = False
        self.inputSelector1.removeEnabled = False

        self.inputSelector4 = qt.QLabel("Input transformation: ",
                                        self.formFrame4)
        self.formFrame4.layout().addWidget(self.inputSelector4)
        self.inputSelector4 = slicer.qMRMLNodeComboBox(self.formFrame4)
        self.inputSelector4.nodeTypes = (("vtkMRMLTransformNode"), "")
        self.inputSelector4.addEnabled = False
        self.inputSelector4.removeEnabled = False

        self.inputSelector2 = qt.QLabel("Set default Segmentation display : ",
                                        self.formFrame2)
        self.formFrame2.layout().addWidget(self.inputSelector2)

        self.inputSelector5 = qt.QLabel("Add markups : ", self.formFrame3)
        self.formFrame5.layout().addWidget(self.inputSelector5)

        self.inputSelector3 = qt.QLabel("Segmentation Correction: ",
                                        self.formFrame3)
        self.formFrame3.layout().addWidget(self.inputSelector3)

        # bind the current volume selector to the current scene of slicer
        self.inputSelector.setMRMLScene(slicer.mrmlScene)
        self.inputSelector1.setMRMLScene(slicer.mrmlScene)
        self.inputSelector4.setMRMLScene(slicer.mrmlScene)

        # bind the input selector to the frame
        self.formFrame.layout().addWidget(self.inputSelector)
        self.formFrame1.layout().addWidget(self.inputSelector1)
        self.formFrame4.layout().addWidget(self.inputSelector4)

        # testing
        button = qt.QPushButton("Load Volume")
        self.formFrame.layout().addWidget(button)
        button.connect("clicked()", slicer.util.openAddVolumeDialog)
        button.show()

        # button for importing mesh files
        button1 = qt.QPushButton("Load Segemntation")
        self.formFrame1.layout().addWidget(button1)
        button1.connect("clicked()", slicer.util.openAddSegmentationDialog)
        button1.show()

        # button for importing mesh files
        button4 = qt.QPushButton("Load Transform")
        self.formFrame4.layout().addWidget(button4)
        button4.connect("clicked()", slicer.util.openAddTransformDialog)
        button4.show()

        # button for setting default segmentation display
        button2 = qt.QPushButton("Set default")
        self.formFrame2.layout().addWidget(button2)
        button2.connect("clicked(bool)", self.SetDefaultValuesClicked)
        button2.show()

        # button for Final work
        self.button5 = qt.QToolButton()
        self.button5.icon = qt.QIcon(
            os.path.join(os.path.dirname(__file__),
                         'MarkupsMouseModePlace.png'))
        self.button5.setCheckable(1)
        self.formFrame5.layout().addWidget(self.button5)
        self.button5.connect("clicked(bool)", self.enableaddmarkuponclick)
        self.button5.show()

        # button for Final work
        button3 = qt.QPushButton("Do corrections")
        self.formFrame3.layout().addWidget(button3)
        button3.connect("clicked(bool)", self.do_correctionsClicked)
        button3.show()