Пример #1
0
  def setup(self):
    # Instantiate and connect widgets ...

    # Collapsible button
    sampleCollapsibleButton = ctk.ctkCollapsibleButton()
    sampleCollapsibleButton.text = "A collapsible button"
    self.layout.addWidget(sampleCollapsibleButton)

    # Layout within the sample collapsible button
    self.sampleFormLayout = qt.QFormLayout(sampleCollapsibleButton)

    # HelloWorld button
    # (Insert Section A text here)
    helloWorldButton = qt.QPushButton("Hello World")
    helloWorldButton.toolTip = "Print 'Hello world' in standard ouput."
    self.sampleFormLayout.addWidget(helloWorldButton)
    helloWorldButton.connect('clicked(bool)',self.onHelloWorldButtonClicked())
    # (be sure to match indentation of the rest of this 
    # code)

    # Add vertical spacer
    self.layout.addStretch(1)

    # Set local var as instance attribute
    self.helloWorldButton = helloWorldButton
Пример #2
0
    def generateButton(self, iconOrLabel="", toolTip="", font = qt.QFont('Arial', 10, 10, False),  size = None, enabled=False):
        """ Creates a qt.QPushButton(), with the arguments.  Sets text, font,
        toolTip, icon, size, and enabled state.
        """
        
        button = qt.QPushButton()
        
        
        
        #--------------------
        # Set either Icon or label, depending on
        # whehter the icon file exists.
        #--------------------
        iconPath = os.path.join(self.MODULE.GLOBALS.LOCAL_URIS['icons'], iconOrLabel)
        if os.path.exists(iconPath):
            button.setIcon(qt.QIcon(iconPath))
        else:
            button.setText(iconOrLabel)

        
            button.setToolTip(toolTip)
            button.setFont(font)

        if size:
            button.setFixedHeight(size.height())
            button.setFixedWidth(size.width())

                
                
        button.setEnabled(enabled) 
        return button
Пример #3
0
    def create(self):
        super(FastGrowCutEffectOptions, self).create()
        self.helpLabel = qt.QLabel(
            "Run the Fast GrowCut segmentation on the current label/seed image.\n Background and foreground seeds will be used as starting points to fill in the rest of the volume.",
            self.frame)
        self.frame.layout().addWidget(self.helpLabel)

        #create a "Start Bot" button
        self.botButton = qt.QPushButton(self.frame)

        self.frame.layout().addWidget(self.botButton)
        self.botButton.connect('clicked()', self.onStartBot)

        self.locRadFrame = qt.QFrame(self.frame)
        self.locRadFrame.setLayout(qt.QHBoxLayout())
        self.frame.layout().addWidget(self.locRadFrame)
        self.widgets.append(self.locRadFrame)

        #HelpButton(self.frame, "TO USE: \n Start the interactive segmenter and initialize the segmentation with any other editor tool. \n KEYS: \n Press the following keys to interact: \n C: copy label slice \n V: paste label slice \n Q: evolve contour in 2D \n E: evolve contour in 3D \n A: toggle between draw/erase modes" )
        HelpButton(
            self.frame,
            "TO USE: \n Start the Fast GrowCut segmenter and initialize the segmentation with any other editor tool. \n KEYS: \n Press the following keys to interact: \n G: start Fast GrowCut \n S: toggle between seed image and segmentation result \n R: reset fast GrowCut \n"
        )
        self.frame.layout().addStretch(1)  # Add vertical spacer

        if hasattr(slicer.modules, 'FGCEditorBot'):
            slicer.util.showStatusMessage(
                slicer.modules.FGCEditorBot.logic.currentMessage)
            self.botButton.text = "Stop FastGrowCut Segmenter"
            if self.locRadFrame:
                self.locRadFrame.hide()
        else:
            self.botButton.text = "Start FastGrowCut Segmenter"
            if self.locRadFrame:
                self.locRadFrame.show()
    def setup(self):
        # Instantiate and connect widgets ...

        # Collapsible button
        testsCollapsibleButton = ctk.ctkCollapsibleButton()
        testsCollapsibleButton.text = "A collapsible button"
        self.layout.addWidget(testsCollapsibleButton)

        # Layout within the collapsible button
        formLayout = qt.QFormLayout(testsCollapsibleButton)

        # test buttons
        tests = (("Part 1: SelectMRIData", self.onSelectMRIData),
                 ("Part 2: LAEndoSegmentation", self.onLAEndoSegmentation))
        #,("Part 3: AxialDilate",
        #self.onAxialDilate), ("Part 3: BooleanRemove", self.onBooleanRemove), ("Part 3: LAWallCleanup", self.onLAWallCleanup), ("Part 3: PVAntrumCut",
        #self.onPVAntrumCut), ("Part 3: EndoNVIsosurface", self.onEndoNVIsosurface), ("Part 3: AutomaticLeftAtrialScar", self.onAutomaticLeftAtrialScar) )

        for text, slot in tests:
            testButton = qt.QPushButton(text)
            testButton.toolTip = "Run the test."
            formLayout.addWidget(testButton)
            testButton.connect('clicked(bool)', slot)

        # Add vertical spacer
        self.layout.addStretch(1)
Пример #5
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # Instantiate and connect widgets ...

        #
        # Parameters Area
        #
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "Parameters"
        self.layout.addWidget(parametersCollapsibleButton)

        # Layout within the dummy collapsible button
        parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

        # Apply Button
        #
        self.applyButton = qt.QPushButton("Apply")
        self.applyButton.toolTip = "Run the algorithm."
        self.applyButton.enabled = True
        parametersFormLayout.addRow(self.applyButton)

        # connections
        self.applyButton.connect('clicked(bool)', self.onApplyButton)

        # Add vertical spacer
        self.layout.addStretch(1)
Пример #6
0
    def createUserInterface(self):
        """ This step is mostly empty. A volume rendering threshold is added to be useful.
		"""

        self.__layout = self.__parent.createUserInterface()

        self.__threshRange = slicer.qMRMLRangeWidget()
        self.__threshRange.decimals = 0
        self.__threshRange.singleStep = 1
        self.__threshRange.connect('valuesChanged(double,double)',
                                   self.onThresholdChanged)
        qt.QTimer.singleShot(0, self.killButton)

        ThreshGroupBox = qt.QGroupBox()
        ThreshGroupBox.setTitle('3D Visualization Intensity Threshold')
        ThreshGroupBoxLayout = qt.QFormLayout(ThreshGroupBox)
        ThreshGroupBoxLayout.addRow(self.__threshRange)
        self.__layout.addRow(ThreshGroupBox)

        editorWidgetParent = slicer.qMRMLWidget()
        editorWidgetParent.setLayout(qt.QVBoxLayout())
        editorWidgetParent.setMRMLScene(slicer.mrmlScene)
        self.__editorWidget = EditorWidget(parent=editorWidgetParent)
        self.__editorWidget.setup()
        self.__layout.addRow(editorWidgetParent)
        self.hideUnwantedEditorUIElements()

        RestartGroupBox = qt.QGroupBox()
        RestartGroupBox.setTitle('Restart')
        RestartGroupBoxLayout = qt.QFormLayout(RestartGroupBox)

        self.__RestartButton = qt.QPushButton('Return to Step 1')
        RestartGroupBoxLayout.addRow(self.__RestartButton)

        self.__RemoveCroppedSubtractionMap = qt.QCheckBox()
        self.__RemoveCroppedSubtractionMap.checked = True
        self.__RemoveCroppedSubtractionMap.setToolTip(
            "Delete the cropped version of your subtaction map.")
        RestartGroupBoxLayout.addRow("Delete cropped subtraction map: ",
                                     self.__RemoveCroppedSubtractionMap)

        self.__RemoveFullSubtracitonMap = qt.QCheckBox()
        self.__RemoveFullSubtracitonMap.checked = True
        self.__RemoveFullSubtracitonMap.setToolTip(
            "Delete the full version of your subtaction map.")
        RestartGroupBoxLayout.addRow("Delete full subtraction map: ",
                                     self.__RemoveFullSubtracitonMap)

        self.__RemoveROI = qt.QCheckBox()
        self.__RemoveROI.checked = False
        self.__RemoveROI.setToolTip(
            "Delete the ROI resulting from your subtaction map.")
        RestartGroupBoxLayout.addRow("Delete ROI: ", self.__RemoveROI)

        # self.__RestartButton.setEnabled(0)

        self.__RestartButton.connect('clicked()', self.Restart)
        self.__RestartActivated = True

        self.__layout.addRow(RestartGroupBox)
    def createUserInterface(self):
        '''
    '''
        # TODO: might make sense to hide the button for the last step at this
        # point, but the widget does not have such option
        self.__layout = self.__parent.createUserInterface()
        # Status of the connection
        self.statusFrame = qt.QFrame()
        self.statusFrame.setLayout(qt.QHBoxLayout())

        self.statusLabel = qt.QLabel("Status: ")
        self.statusLabel.setToolTip("Status of the connection ...")

        self.statusBar = qt.QStatusBar()
        self.statusBar.showMessage("Disconnected")

        # Button to connect
        self.PlusServerConnection = qt.QPushButton("Connect to Tracker")
        # Add to the widget
        self.statusFrame.layout().addWidget(self.statusLabel)
        self.statusFrame.layout().addWidget(self.statusBar)

        self.__layout.addWidget(self.statusFrame)
        self.__layout.addWidget(self.PlusServerConnection)

        # Connections
        self.PlusServerConnection.connect("clicked()",
                                          self.onPlusServerConnection)

        self.updateWidgetFromParameters(self.parameterNode())

        self.ConnectedState = False
        self.DisconnectedState = False

        qt.QTimer.singleShot(0, self.killButton)
Пример #8
0
  def create(self):
    self.frame = qt.QFrame(self.parent)
    self.frame.objectName = 'EditColorFrame'
    self.frame.setLayout(qt.QHBoxLayout())
    self.parent.layout().addWidget(self.frame)

    self.label = qt.QLabel(self.frame)
    self.label.setText("Label: ")
    self.frame.layout().addWidget(self.label)

    self.labelName = qt.QLabel(self.frame)
    self.labelName.setText("")
    self.frame.layout().addWidget(self.labelName)

    self.colorSpin = qt.QSpinBox(self.frame)
    self.colorSpin.objectName = 'ColorSpinBox'
    self.colorSpin.setMaximum( 64000)
    self.colorSpin.setValue( EditUtil.getLabel() )
    self.colorSpin.setToolTip( "Click colored patch at right to bring up color selection pop up window.  Use the 'c' key to bring up color popup menu." )
    self.frame.layout().addWidget(self.colorSpin)

    self.colorPatch = qt.QPushButton(self.frame)
    self.colorPatch.setObjectName('ColorPatchButton')
    self.frame.layout().addWidget(self.colorPatch)

    self.updateParameterNode(slicer.mrmlScene, vtk.vtkCommand.ModifiedEvent)
    self.updateGUIFromMRML(self.parameterNode, vtk.vtkCommand.ModifiedEvent)

    self.frame.connect( 'destroyed()', self.cleanup)
    self.colorSpin.connect( 'valueChanged(int)', self.updateMRMLFromGUI)
    self.colorPatch.connect( 'clicked()', self.showColorBox )

    # TODO: change this to look for specfic events (added, removed...)
    # but this requires being able to access events by number from wrapped code
    self.addObserver(slicer.mrmlScene, vtk.vtkCommand.ModifiedEvent, self.updateParameterNode)
Пример #9
0
  def setup(self):
    ScriptedLoadableModuleWidget.setup(self)

    # Launcher panel
    launcherCollapsibleButton = ctk.ctkCollapsibleButton()
    launcherCollapsibleButton.text = "Slicelet launcher"
    self.layout.addWidget(launcherCollapsibleButton)
    self.launcherFormLayout = qt.QFormLayout(launcherCollapsibleButton)

    # Show slicelet button
    self.launchSliceletButton = qt.QPushButton("Switch to First Task slicelet")
    self.launchSliceletButton.toolTip = "Switch to the First Task customized slicelet"
    self.launcherFormLayout.addWidget(self.launchSliceletButton)
    self.launchSliceletButton.connect('clicked()', self.showSlicelet)

    # Add vertical spacer
    self.layout.addStretch(1)

    # Load style sheet
    self.styleSheet = self.loadStyleSheet()
    slicer.app.setStyleSheet(self.styleSheet)

    # Setup user interface
    self.createMainMenuDockWidget()
    self.setupConnections()

    # Reset views
    self.resetViews()
Пример #10
0
    def create(self):
        super(GrowCutEffectOptions, self).create()

        self.helpLabel = qt.QLabel(
            "Run the GrowCut segmentation on the current label map.\nThis will use your current segmentation as an example\nto fill in the rest of the volume.",
            self.frame)
        self.frame.layout().addWidget(self.helpLabel)

        self.apply = qt.QPushButton("Apply", self.frame)
        self.apply.objectName = self.__class__.__name__ + 'Apply'
        self.apply.setToolTip(
            "Apply to run segmentation.\nCreates a new label volume using the current volume as input"
        )
        self.frame.layout().addWidget(self.apply)
        self.widgets.append(self.apply)

        EditorLib.HelpButton(
            self.frame,
            "Use this tool to apply grow cut segmentation.\n\n Select different label colors and paint on foreground and background or as many different classes as you want using the standard drawing tools.\nTo run segmentation correctly, you need to supply a minimum or two class labels."
        )

        self.connections.append((self.apply, 'clicked()', self.onApply))

        # Add vertical spacer
        self.frame.layout().addStretch(1)
Пример #11
0
    def createUserInterface(self):
        '''
    '''
        # TODO: might make sense to hide the button for the last step at this
        # point, but the widget does not have such option
        self.__layout = self.__parent.createUserInterface()

        baselineScanLabel = qt.QLabel('Baseline scan:')
        self.__baselineVolumeSelector = slicer.qMRMLNodeComboBox()
        self.__baselineVolumeSelector.toolTip = "Choose the baseline scan"
        self.__baselineVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode']
        self.__baselineVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.__baselineVolumeSelector.addEnabled = 0

        followupScanLabel = qt.QLabel('Followup scan:')
        self.__followupVolumeSelector = slicer.qMRMLNodeComboBox()
        self.__followupVolumeSelector.toolTip = "Choose the followup scan"
        self.__followupVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode']
        self.__followupVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.__followupVolumeSelector.addEnabled = 0

        loadDataButton = qt.QPushButton('Load test data')
        self.__layout.addRow(loadDataButton)
        loadDataButton.connect('clicked()', self.loadData)

        self.__layout.addRow(baselineScanLabel, self.__baselineVolumeSelector)
        self.__layout.addRow(followupScanLabel, self.__followupVolumeSelector)

        self.updateWidgetFromParameters(self.parameterNode())

        qt.QTimer.singleShot(0, self.killButton)
Пример #12
0
    def create(self):
        super(ChangeLabelEffectOptions, self).create()
        self.logic.undoRedo = self.undoRedo
        import EditColor
        self.inputColor = EditColor.EditColor(self.frame,
                                              'ChangeLabelEffect,inputColor')
        self.inputColor.label.setText("Input Color:")
        self.inputColor.colorSpin.setToolTip("Set the label value to replace.")

        self.outputColor = EditColor.EditColor(
            self.frame, 'ChangeLabelEffect,outputColor')
        self.outputColor.label.setText("Output Color:")
        self.outputColor.colorSpin.setToolTip("Set the new label value")

        self.apply = qt.QPushButton("Apply", self.frame)
        self.apply.objectName = self.__class__.__name__ + 'Apply'
        self.apply.setToolTip(
            "Apply current threshold settings to the label map.")
        self.frame.layout().addWidget(self.apply)
        self.widgets.append(self.apply)

        EditorLib.HelpButton(
            self.frame,
            "Replace all instances of input color with output color in current label map"
        )

        self.connections.append((self.apply, 'clicked()', self.onApply))

        # Add vertical spacer
        self.frame.layout().addStretch(1)
Пример #13
0
    def __init__(self, parent, dicomDatabase=None, detailsPopup=None):
        if dicomDatabase:
            self.dicomDatabase = dicomDatabase
        else:
            self.dicomDatabase = slicer.dicomDatabase
        self.detailsPopup = detailsPopup
        self.recentSeries = []
        self.widget = qt.QWidget(parent)
        self.widget.name = 'recentActivityWidget'
        self.layout = qt.QVBoxLayout()
        self.widget.setLayout(self.layout)

        self.statusLabel = qt.QLabel(self.widget)
        self.layout.addWidget(self.statusLabel)
        self.statusLabel.text = 'No inserts in the past hour'

        self.scrollArea = qt.QScrollArea()
        self.layout.addWidget(self.scrollArea)
        self.listWidget = qt.QListWidget()
        self.listWidget.name = 'recentActivityListWidget'
        self.scrollArea.setWidget(self.listWidget)
        self.scrollArea.setWidgetResizable(True)
        self.listWidget.setProperty('SH_ItemView_ActivateItemOnSingleClick', 1)
        self.listWidget.connect('activated(QModelIndex)', self.onActivated)

        self.refreshButton = qt.QPushButton(self.widget)
        self.layout.addWidget(self.refreshButton)
        self.refreshButton.text = 'Refresh'
        self.refreshButton.connect('clicked()', self.update)

        self.tags = {}
        self.tags['seriesDescription'] = "0008,103e"
        self.tags['patientName'] = "0010,0010"
Пример #14
0
    def create(self):
        self.frame = qt.QFrame(self.parent)
        self.frame.setLayout(qt.QHBoxLayout())
        self.parent.layout().addWidget(self.frame)

        self.label = qt.QLabel(self.frame)
        self.label.setText("Label: ")
        self.frame.layout().addWidget(self.label)

        self.labelName = qt.QLabel(self.frame)
        self.labelName.setText("")
        self.frame.layout().addWidget(self.labelName)

        self.colorSpin = qt.QSpinBox(self.frame)
        self.colorSpin.setValue(int(tcl('EditorGetPaintLabel')))
        self.colorSpin.setToolTip(
            "Click colored patch at right to bring up color selection pop up window.  Use the 'c' key to bring up color popup menu."
        )
        self.frame.layout().addWidget(self.colorSpin)

        self.colorPatch = qt.QPushButton(self.frame)
        self.frame.layout().addWidget(self.colorPatch)

        self.updateParameterNode(slicer.mrmlScene, "ModifiedEvent")
        self.updateGUIFromMRML(self.parameterNode, "ModifiedEvent")

        self.frame.connect('destroyed(QObject)', self.cleanup)
        self.colorSpin.connect('valueChanged(int)', self.updateMRMLFromGUI)
        self.colorPatch.connect('clicked()', self.showColorBox)

        # TODO: change this to look for specfic events (added, removed...)
        # but this requires being able to access events by number from wrapped code
        tag = slicer.mrmlScene.AddObserver("ModifiedEvent",
                                           self.updateParameterNode)
        self.observerTags.append((slicer.mrmlScene, tag))
Пример #15
0
    def createUserInterface(self):
        '''
    '''
        self.__layout = self.__parent.createUserInterface()

        ##TODO: Allow user to select the epi and endo or should the images be preloaded?

        #epiVolumeLabel = qt.QLabel( 'Epi Segmentation (Dilated) Label Image:' )
        #self.__epiVolumeSelector = slicer.qMRMLNodeComboBox()
        #self.__epiVolumeSelector.toolTip = "Select the epicardium segmentation image"
        #self.__epiVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode']
        #self.__epiVolumeSelector.setMRMLScene(slicer.mrmlScene)
        #self.__epiVolumeSelector.addEnabled = False
        #self.__epiVolumeSelector.renameEnabled = True
        #self.__layout.addRow( epiVolumeLabel, self.__epiVolumeSelector )

        #endoVolumeLabel = qt.QLabel( 'Endo Segmentation Label Image:' )
        #self.__endoVolumeSelector = slicer.qMRMLNodeComboBox()
        #self.__endoVolumeSelector.toolTip = "Select the endocardium segmentation image"
        #self.__endoVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode']
        #self.__endoVolumeSelector.setMRMLScene(slicer.mrmlScene)
        #self.__endoVolumeSelector.addEnabled = False
        #self.__endoVolumeSelector.renameEnabled = True
        #self.__layout.addRow( endoVolumeLabel, self.__endoVolumeSelector )

        booleanRemoveButton = qt.QPushButton('Load Boolean Remove Module')
        self.__layout.addRow(booleanRemoveButton)
        booleanRemoveButton.connect('clicked()', self.startBooleanRemove)
Пример #16
0
    def setup(self):
        tests = (
            ('Get Sample Data', self.downloadMRHead),
            ('Reslicing', self.reslicing),
            ('Chart Test', self.chartTest),
            ('Web View Test', self.webViewTest),
            ('Memory Check', self.memoryCheck),
            # ( 'timeProbe', self.timeProbe ),
            # ( 'sizeProbe', self.sizeProbe),
            # ( 'fakewin', self.fakewin ),
        )

        for test in tests:
            b = qt.QPushButton(test[0])
            self.layout.addWidget(b)
            b.connect('clicked()', test[1])

        self.tclEnabled = qt.QCheckBox("Tcl Enabled")
        self.layout.addWidget(self.tclEnabled)
        self.tclEnabled.setToolTip(
            "Toggles processing of tcl events - disables tcl-based functionality including pan/zoom, window/level, and Editor module."
        )
        self.tclEnabled.setChecked(
            not bool(int(tcl('set ::SWidget::DISABLE_CALLBACKS'))))
        self.tclEnabled.connect("clicked()", self.onTclEnabled)

        self.log = qt.QTextEdit()
        self.log.readOnly = True
        self.layout.addWidget(self.log)
        self.log.insertHtml('<p>Status: <i>Idle</i>\n')
        self.log.insertPlainText('\n')
        self.log.ensureCursorVisible()

        # Add spacer to layout
        self.layout.addStretch(1)
Пример #17
0
 def loadExistingSnapshotsFirstLoad(self):
   """Loads all the existing snapshot nodes currently present in the scene.
   It initializes the object self.snapshotsCached that will store the state for all the snapshots.
   It also creates the Reload snapshots button"""  
   self.snapshotsCached = dict()         
   # Get the nodes of type Snapshot   
   snapshotNodes = slicer.mrmlScene.GetNodesByClass('vtkMRMLAnnotationSnapshotNode')
   
   snapshotNodes.InitTraversal()
   snapshotNode = snapshotNodes.GetNextItemAsObject() 
   if not snapshotNode:
     # There is not any snapshot
     self.noItemsLabel.show()    
   else:
     # Add all the nodes
     self.noItemsLabel.hide()     
     while snapshotNode:
       self.__addNewSnapshot__(snapshotNode)
       snapshotNode = snapshotNodes.GetNextItemAsObject() 
         
   # Reload button
   self.btnReloadSnaps = qt.QPushButton("Reload snapshots")
   self.btnReloadSnaps.toolTip = ("Reload all the current snapshots and set them to the initial state (equivalent to the first load of the module)."  
                                 "\nThis is useful if you want to re-upload any snapshots")
   self.btnReloadSnaps.setIcon(qt.QIcon(self.CIP_ICON_DIR + "/Reload - 16.png"))
   self.btnReloadSnaps.setStyleSheet("margin-top: 15px")
   self.btnReloadSnaps.setFixedSize(150,40)
   
   self.currentSnapshotsLayout.addWidget(self.btnReloadSnaps)
   
   self.btnReloadSnaps.connect('clicked (bool)', self.onbtnReloadSnapsClicked)
Пример #18
0
 def setup(self):
     ### DEVELOPER ###
     self.reloadButton = qt.QPushButton('Reload')
     self.reloadButton.toolTip = 'Developer reload button'
     self.reloadButton.name = 'FastFiducial Reload'
     self.layout.addWidget(self.reloadButton)
     self.reloadButton.connect('clicked()', self.onReload)
     ###    END    ###
     self.slicerVersion = int(slicer.app.majorVersion)
     self.fixed = ImageDataContainer(self.slicerVersion)
     self.fixed.addToScene(slicer.mrmlScene)
     self.moving = ImageDataContainer(self.slicerVersion)
     self.interactor = slicer.mrmlScene.AddNode(
         slicer.vtkMRMLInteractionNode())
     self.selector = slicer.mrmlScene.AddNode(slicer.vtkMRMLSelectionNode())
     # self._threeByThreeCompareView()
     self._inputLayoutSection()
     self._fiducialLayoutSection()
     self._registrationLayoutSection()
     ### DEVELOPER ###
     import os
     if os.environ['USER'] == 'dmwelch':
         self.logic.testingData()
         self.fixedVolumeSelector.setCurrentNode(
             slicer.util.getNode('fixed*'))
         self.movingVolumeSelector.setCurrentNode(
             slicer.util.getNode('moving*'))
     ### ***END*** ###
     self.layout.addStretch(1)
Пример #19
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # Instantiate and connect widgets ...

        #
        # Module Selection Button
        #
        dummyCollapsibleButton = ctk.ctkCollapsibleButton()
        dummyCollapsibleButton.text = "Select Module (must be CLI)"
        self.layout.addWidget(dummyCollapsibleButton)
        dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton)
        label = qt.QLabel('Module Name:')
        label.setToolTip(
            "Module Name must be one word w/ 1st letters capitalized (e.g. 'Label Map Smoothing' module becomes 'LabelMapSmoothing'). Module parameters are then listed in the Python terminal (Ctrl+3) "
        )
        self.__veLabel = qt.QLineEdit()
        dummyFormLayout.addRow(label, self.__veLabel)

        #
        # Apply Button
        #
        self.applyButton = qt.QPushButton("Apply")
        self.applyButton.toolTip = "Run the algorithm."
        self.applyButton.enabled = True
        dummyFormLayout.addRow(self.applyButton)
        self.applyButton.connect('clicked(bool)', self.onApplyButton)
Пример #20
0
  def setup(self):
    # Instantiate and connect widgets ...

    # reload button
    # (use this during development, but remove it when delivering
    #  your module to users)
    self.reloadButton = qt.QPushButton("Reload")
    self.reloadButton.toolTip = "Reload this module."
    self.reloadButton.name = "sceneImport2428 Reload"
    self.layout.addWidget(self.reloadButton)
    self.reloadButton.connect('clicked()', self.onReload)

    # test button
    # (use this during development, but remove it when delivering
    #  your module to users)
    self.testButton = qt.QPushButton("Test")
    self.testButton.toolTip = "Run the self tests."
    self.layout.addWidget(self.testButton)
    self.testButton.connect('clicked()', self.onTest)

    # reload and test button
    # (use this during development, but remove it when delivering
    #  your module to users)
    self.reloadAndTestButton = qt.QPushButton("Reload and Test")
    self.reloadAndTestButton.toolTip = "Reload this module and then run the self tests."
    self.layout.addWidget(self.reloadAndTestButton)
    self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest)

    # Collapsible button
    dummyCollapsibleButton = ctk.ctkCollapsibleButton()
    dummyCollapsibleButton.text = "A collapsible button"
    self.layout.addWidget(dummyCollapsibleButton)

    # Layout within the dummy collapsible button
    dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton)

    # HelloWorld button
    helloWorldButton = qt.QPushButton("Hello world")
    helloWorldButton.toolTip = "Print 'Hello world' in standard ouput."
    dummyFormLayout.addWidget(helloWorldButton)
    helloWorldButton.connect('clicked(bool)', self.onHelloWorldButtonClicked)

    # Add vertical spacer
    self.layout.addStretch(1)

    # Set local var as instance attribute
    self.helloWorldButton = helloWorldButton
Пример #21
0
    def createUserInterface(self):

        self.__layout = self.__parent.createUserInterface()

        #load sample data
        self.__loadSampleCtDataButton = qt.QPushButton("Load sample spine CT")
        self.__layout.addRow(self.__loadSampleCtDataButton)
        self.__loadSampleCtDataButton.connect('clicked(bool)',
                                              self.loadSampleVolume)

        #clones DICOM scriptable module
        self.__dicomWidget = slicer.modules.dicom.widgetRepresentation()

        #extract button that launches DICOM browser from widget
        colButtons = self.__dicomWidget.findChildren('ctkCollapsibleButton')
        dicomButton = colButtons[1].findChild('QPushButton')
        dicomButton.setText('Load spine CT from DICOM')
        self.__layout.addRow(dicomButton)

        #open load data dialog for adding nrrd files
        self.__loadScrewButton = qt.QPushButton(
            "Load spine CT from other file")
        self.__layout.addRow(self.__loadScrewButton)
        self.__loadScrewButton.connect('clicked(bool)', self.loadVolume)

        #Active Volume text
        self.activeText = qt.QLabel("Active Volume Data:")
        self.__layout.addRow(self.activeText)

        #select volume
        #creates combobox and populates it with all vtkMRMLScalarVolumeNodes in the scene
        self.__inputSelector = slicer.qMRMLNodeComboBox()
        self.__inputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.__inputSelector.addEnabled = False
        self.__inputSelector.removeEnabled = False
        self.__inputSelector.setMRMLScene(slicer.mrmlScene)
        self.__layout.addRow(self.__inputSelector)

        # self.updateWidgetFromParameters(self.parameterNode())
        qt.QTimer.singleShot(0, self.killButton)

        transform = slicer.vtkMRMLLinearTransformNode()
        transform.SetName("Camera Transform")
        slicer.mrmlScene.AddNode(transform)

        cam = slicer.mrmlScene.GetNodeByID('vtkMRMLCameraNode1')
        cam.SetAndObserveTransformNodeID('vtkMRMLLinearTransformNode4')
    def setup(self):
        # Instantiate and connect widgets ...

        # Collapsible button
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "Parameters"
        self.layout.addWidget(parametersCollapsibleButton)

        # Layout within the parameters collapsible button
        parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

        # fiber
        self.fiberSelector = slicer.qMRMLNodeComboBox(
            parametersCollapsibleButton)
        self.fiberSelector.nodeTypes = (("vtkMRMLFiberBundleNode"), "")
        self.fiberSelector.selectNodeUponCreation = False
        self.fiberSelector.addEnabled = False
        self.fiberSelector.removeEnabled = False
        self.fiberSelector.noneEnabled = True
        self.fiberSelector.showHidden = False
        self.fiberSelector.showChildNodeTypes = False
        self.fiberSelector.setMRMLScene(slicer.mrmlScene)
        self.fiberSelector.setToolTip(
            "Pick the full-brain tractography in VTK format: It must be a vtkPolyData object where all the cells are lines."
        )
        parametersFormLayout.addRow("Fiber Bundle", self.fiberSelector)

        # label map
        self.labelSelector = slicer.qMRMLNodeComboBox(
            parametersCollapsibleButton)
        self.labelSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        #self.labelSelector.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", 1 )
        self.labelSelector.selectNodeUponCreation = False
        self.labelSelector.addEnabled = False
        self.labelSelector.removeEnabled = False
        self.labelSelector.noneEnabled = True
        self.labelSelector.showHidden = False
        self.labelSelector.showChildNodeTypes = False
        self.labelSelector.setMRMLScene(slicer.mrmlScene)
        self.labelSelector.setToolTip(
            "Pick A brain parcellation, obtained from freesurfer in the same space as the full-brain tractography."
        )
        parametersFormLayout.addRow("Brain Parcellation ", self.labelSelector)

        # query script
        self.queryScript = qt.QTextEdit()
        self.queryScript.setToolTip("WMQL query text.")
        #self.labelValue.setValue(1)
        parametersFormLayout.addWidget(self.queryScript)

        # apply
        self.applyButton = qt.QPushButton(parametersCollapsibleButton)
        self.applyButton.text = "Apply"
        parametersFormLayout.addWidget(self.applyButton)

        self.applyButton.connect('clicked()', self.onApply)

        # Add vertical spacer
        self.layout.addStretch(1)
Пример #23
0
    def setup(self):
        # Instantiate and connect widgets ...

        # Collapsible button
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "Parameters"
        self.layout.addWidget(parametersCollapsibleButton)

        # Layout within the parameters collapsible button
        parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

        # fiber
        self.fiberSelector = slicer.qMRMLNodeComboBox(
            parametersCollapsibleButton)
        self.fiberSelector.nodeTypes = (("vtkMRMLFiberBundleNode"), "")
        self.fiberSelector.selectNodeUponCreation = False
        self.fiberSelector.addEnabled = False
        self.fiberSelector.removeEnabled = False
        self.fiberSelector.noneEnabled = True
        self.fiberSelector.showHidden = False
        self.fiberSelector.showChildNodeTypes = False
        self.fiberSelector.setMRMLScene(slicer.mrmlScene)
        self.fiberSelector.setToolTip("Pick the fiber bundle to be converted.")
        parametersFormLayout.addRow("Fiber Bundle", self.fiberSelector)

        # label map
        self.labelSelector = slicer.qMRMLNodeComboBox(
            parametersCollapsibleButton)
        self.labelSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.labelSelector.addAttribute("vtkMRMLScalarVolumeNode", "LabelMap",
                                        1)
        self.labelSelector.selectNodeUponCreation = False
        self.labelSelector.addEnabled = False
        self.labelSelector.removeEnabled = False
        self.labelSelector.noneEnabled = True
        self.labelSelector.showHidden = False
        self.labelSelector.showChildNodeTypes = False
        self.labelSelector.setMRMLScene(slicer.mrmlScene)
        self.labelSelector.setToolTip(
            "Pick the target label volume.  Must already exists in order to define sampling grid.  If needed, create one in the Editor module based on template volume."
        )
        parametersFormLayout.addRow("Target LabelMap", self.labelSelector)

        # label value
        self.labelValue = qt.QSpinBox(parametersCollapsibleButton)
        self.labelValue.setToolTip(
            "The numerical value for the rasterized fiber label.")
        self.labelValue.setValue(1)
        parametersFormLayout.addRow("Label Value", self.labelValue)

        # apply
        self.applyButton = qt.QPushButton(parametersCollapsibleButton)
        self.applyButton.text = "Apply"
        parametersFormLayout.addWidget(self.applyButton)

        self.applyButton.connect('clicked()', self.onApply)

        # Add vertical spacer
        self.layout.addStretch(1)
Пример #24
0
 def createBtn(self, label, func, parentLayout, toolTip=''):
     '''Create a button'''
     btn = qt.QPushButton(label)
     btn.toolTip = toolTip
     btn.maximumWidth = 800
     btn.connect('clicked(bool)', func)
     parentLayout.addWidget(btn)
     return btn
Пример #25
0
    def createUserInterface(self):

        font = qt.QFont("Sans Serif", 12, qt.QFont.Bold)

        self.__layout = qt.QFormLayout(self)
        self.botonRegistro = qt.QPushButton('Realizar Registro')
        self.botonRegistro.connect('clicked(bool)', self.onApplyRegistro)
        self.__layout.addRow(self.botonRegistro)
Пример #26
0
    def createUserInterface(self):
        '''
    '''
        self.__layout = super(EMSegmentQuickStep5, self).createUserInterface()

        infoLabel = qt.QLabel(
            'The segmentation finished!\n\nThe results are displayed as labelMaps in the slice viewers.\n\n'
        )
        infoLabel.setFont(self.getBoldFont())
        self.__layout.addWidget(infoLabel)

        self.__top = qt.QGroupBox()
        self.__top.setTitle('Statistics')
        self.__top.toolTip = 'This table shows label statistics for the segmentation results.'
        self.__topLayout = qt.QVBoxLayout(self.__top)

        self.__layout.addWidget(self.__top)

        # deactivate next button since it is the last step
        self.buttonBoxHints = self.NextButtonDisabled

        # the volume node
        workingDataNode = self.mrmlManager().GetWorkingDataNode()

        if workingDataNode:
            # set flags in the mrml nodes
            workingDataNode.SetAlignedTargetNodeIsValid(1)
            workingDataNode.SetAlignedAtlasNodeIsValid(1)

            # show preprocessing output in sliceViews
            volumeCollection = workingDataNode.GetInputTargetNode()
            if volumeCollection:
                outputNode = volumeCollection.GetNthVolumeNode(0)

        labelStatisticsWidget = LabelStatisticsWidget(self.__top)
        labelStatisticsWidget.setup()
        labelStatisticsWidget.labelNode = self.mrmlManager(
        ).GetOutputVolumeNode()
        labelStatisticsWidget.grayscaleNode = outputNode

        labelStatisticsWidget.applyButton.visible = False
        labelStatisticsWidget.labelSelectorFrame.visible = False
        labelStatisticsWidget.grayscaleSelectorFrame.visible = False
        labelStatisticsWidget.saveButton.visible = False
        labelStatisticsWidget.grayscaleSelector.visible = False
        labelStatisticsWidget.labelSelector.visible = False

        labelStatisticsWidget.onApply()

        infoLabel2 = qt.QLabel(
            '\n\nIt is now possible to change parameters and click "Segment" again or to reset the module.'
        )
        #infoLabel2.setFont( self.getBoldFont() )
        self.__layout.addWidget(infoLabel2)

        resetButton = qt.QPushButton('Reset Module')
        resetButton.connect('clicked()', self.onResetButton)
        self.__layout.addWidget(resetButton)
Пример #27
0
    def setupPanel(self, parentWidget):
        logging.debug('UltraSound.setupPanel')
        collapsibleButton = ctk.ctkCollapsibleButton()

        collapsibleButton.setProperty('collapsedHeight', 20)
        collapsibleButton.text = "Ultrasound"
        parentWidget.addWidget(collapsibleButton)

        ultrasoundLayout = qt.QFormLayout(collapsibleButton)
        ultrasoundLayout.setContentsMargins(12, 4, 4, 4)
        ultrasoundLayout.setSpacing(4)

        self.startStopRecordingButton = qt.QPushButton("  Start Recording")
        self.startStopRecordingButton.setCheckable(True)
        self.startStopRecordingButton.setIcon(self.recordIcon)
        self.startStopRecordingButton.setToolTip("If clicked, start recording")

        self.freezeUltrasoundButton = qt.QPushButton('Freeze')

        hbox = qt.QHBoxLayout()
        hbox.addWidget(self.startStopRecordingButton)
        hbox.addWidget(self.freezeUltrasoundButton)
        ultrasoundLayout.addRow(hbox)

        self.usFrozen = False

        self.brigthnessContrastButtonNormal = qt.QPushButton()
        self.brigthnessContrastButtonNormal.text = "Normal"
        self.brigthnessContrastButtonNormal.setEnabled(True)

        self.brigthnessContrastButtonBright = qt.QPushButton()
        self.brigthnessContrastButtonBright.text = "Bright"
        self.brigthnessContrastButtonBright.setEnabled(True)

        self.brigthnessContrastButtonBrighter = qt.QPushButton()
        self.brigthnessContrastButtonBrighter.text = "Brighter"
        self.brigthnessContrastButtonBrighter.setEnabled(True)

        brightnessContrastBox = qt.QHBoxLayout()
        brightnessContrastBox.addWidget(self.brigthnessContrastButtonNormal)
        brightnessContrastBox.addWidget(self.brigthnessContrastButtonBright)
        brightnessContrastBox.addWidget(self.brigthnessContrastButtonBrighter)
        ultrasoundLayout.addRow(brightnessContrastBox)

        return collapsibleButton, ultrasoundLayout
Пример #28
0
  def create(self):
    super(MakeModelEffectOptions,self).create()

    self.goToModelMaker = qt.QPushButton("Go To Model Maker", self.frame)
    self.goToModelMaker.setToolTip( "The Model Maker interface contains a whole range of options for building sets of models and controlling the parameters." )
    self.frame.layout().addWidget(self.goToModelMaker)
    self.widgets.append(self.goToModelMaker)

    self.smooth = qt.QCheckBox("Smooth Model", self.frame)
    self.smooth.checked = True
    self.smooth.setToolTip("When smoothed, the model will look better, but some details of the label map will not be visible on the model.  When not smoothed you will see individual voxel boundaries in the model.  Smoothing here corresponds to Decimation of 0.25 and Smooting iterations of 10.")
    self.frame.layout().addWidget(self.smooth)
    self.widgets.append(self.smooth)

    #
    # model name
    #
    self.nameFrame = qt.QFrame(self.frame)
    self.nameFrame.setLayout(qt.QHBoxLayout())
    self.frame.layout().addWidget(self.nameFrame)
    self.widgets.append(self.nameFrame)

    self.modelNameLabel = qt.QLabel("Model Name: ", self.nameFrame)
    self.modelNameLabel.setToolTip( "Select the name for the newly created model." )
    self.nameFrame.layout().addWidget(self.modelNameLabel)
    self.widgets.append(self.modelNameLabel)

    self.modelName = qt.QLineEdit(self.nameFrame)
    self.modelName.setText( self.getUniqueModelName( self.editUtil.getLabelName() ) )
    self.nameFrame.layout().addWidget(self.modelName)
    self.widgets.append(self.modelName)

    self.apply = qt.QPushButton("Apply", self.frame)
    self.apply.objectName = self.__class__.__name__ + 'Apply'
    self.apply.setToolTip("Build a model for the current label value of the label map being edited in the Red slice window.  Model will be created in the background." )
    self.frame.layout().addWidget(self.apply)
    self.widgets.append(self.apply)

    EditorLib.HelpButton(self.frame, "Use this tool build a model.  A subset of model building options is provided here.  Go to the Model Maker module to expose a range of parameters.  Use Merge and Build button in the Advanced... tab to quickly make a model of all defined structures in the merge label map.")

    # Add vertical spacer
    self.frame.layout().addStretch(1)

    self.connections.append( (self.apply, 'clicked()', self.onApply) )
    self.connections.append( (self.goToModelMaker, 'clicked()', self.onGoToModelMaker) )
Пример #29
0
 def addTagButton(self, pos):
     """Add a new tag button to the current list"""
     btn = qt.QPushButton()
     btn.setCheckable(True)
     btn.text = self.tags[pos]
     btn.toolTip = self.tags[pos]
     btn.setStyleSheet("background-color: #2A83A4; color: white")
     self.tagsLayout.addWidget(btn, int(pos / 3) + 3, pos % 3)
     self.btnTags.append(btn)
Пример #30
0
 def __init__(self, parent, helpString = ""):
   self.helpString = helpString
   self.message = qt.QMessageBox()
   self.message.setWindowTitle("Editor Help")
   self.button = qt.QPushButton("?", parent)
   self.button.setMaximumWidth(15)
   self.button.setToolTip("Bring up a help window")
   parent.layout().addWidget(self.button)
   self.button.connect('clicked()', self.showHelp)