Example #1
0
  def colorSelectDialog(self):
    """color table dialog"""

    if not self.colorSelect:
      self.colorSelect = qt.QDialog(slicer.util.mainWindow())
      self.colorSelect.objectName = 'EditorColorSelectDialog'
      self.colorSelect.setLayout( qt.QVBoxLayout() )

      self.colorPromptLabel = qt.QLabel()
      self.colorSelect.layout().addWidget( self.colorPromptLabel )

      self.colorSelectorFrame = qt.QFrame()
      self.colorSelectorFrame.objectName = 'ColorSelectorFrame'
      self.colorSelectorFrame.setLayout( qt.QHBoxLayout() )
      self.colorSelect.layout().addWidget( self.colorSelectorFrame )

      self.colorSelectorLabel = qt.QLabel()
      self.colorPromptLabel.setText( "Color Table: " )
      self.colorSelectorFrame.layout().addWidget( self.colorSelectorLabel )

      self.colorSelector = slicer.qMRMLColorTableComboBox()
      # TODO
      self.colorSelector.nodeTypes = ("vtkMRMLColorNode", "")
      self.colorSelector.hideChildNodeTypes = ("vtkMRMLDiffusionTensorDisplayPropertiesNode", "")
      self.colorSelector.addEnabled = False
      self.colorSelector.removeEnabled = False
      self.colorSelector.noneEnabled = False
      self.colorSelector.selectNodeUponCreation = True
      self.colorSelector.showHidden = True
      self.colorSelector.showChildNodeTypes = True
      self.colorSelector.setMRMLScene( slicer.mrmlScene )
      self.colorSelector.setToolTip( "Pick the table of structures you wish to edit" )
      self.colorSelect.layout().addWidget( self.colorSelector )

      # pick the default editor LUT for the user
      defaultID = self.colorLogic.GetDefaultEditorColorNodeID()
      defaultNode = slicer.mrmlScene.GetNodeByID(defaultID)
      if defaultNode:
        self.colorSelector.setCurrentNode( defaultNode )

      self.colorButtonFrame = qt.QFrame()
      self.colorButtonFrame.objectName = 'ColorButtonFrame'
      self.colorButtonFrame.setLayout( qt.QHBoxLayout() )
      self.colorSelect.layout().addWidget( self.colorButtonFrame )

      self.colorDialogApply = qt.QPushButton("Apply", self.colorButtonFrame)
      self.colorDialogApply.objectName = 'ColorDialogApply'
      self.colorDialogApply.setToolTip( "Use currently selected color node." )
      self.colorButtonFrame.layout().addWidget(self.colorDialogApply)

      self.colorDialogCancel = qt.QPushButton("Cancel", self.colorButtonFrame)
      self.colorDialogCancel.objectName = 'ColorDialogCancel'
      self.colorDialogCancel.setToolTip( "Cancel current operation." )
      self.colorButtonFrame.layout().addWidget(self.colorDialogCancel)

      self.colorDialogApply.connect("clicked()", self.onColorDialogApply)
      self.colorDialogCancel.connect("clicked()", self.colorSelect.hide)

    self.colorPromptLabel.setText( "Create a merge label map for selected master volume %s.\nNew volume will be %s.\nSelect the color table node will be used for segmentation labels." %(self.master.GetName(), self.master.GetName()+"-label"))
    self.colorSelect.show()
    def __init__(self):
        '''
        Constructor
        '''
        qt.QWidget.__init__(self)
        self.propertiesMenuWidget=qt.QFrame()
        self.propertiesMenuWidget.setLayout(qt.QVBoxLayout())
        #self.checkBoxVisible2D = qt.QCheckBox()
        #self.checkBoxVisible2D.setTristate(False)
        self.checkBoxVisible3D = qt.QCheckBox()
        self.checkBoxVisible3D.setTristate(False)
        
        #self.propertiesMenuWidget.setCellWidget(0,0,qt.QLabel("Visible2D"))
        #self.propertiesMenuWidget.setCellWidget(0,1,self.checkBoxVisible2D)
        self.visible3DFrame=qt.QFrame()
        self.visible3DFrame.setLayout(qt.QHBoxLayout())
        self.visible3DFrame.layout().addWidget(qt.QLabel("Visible in 3D"))
        self.visible3DFrame.layout().addWidget(self.checkBoxVisible3D)
    
        
        self.thresholdFrame=qt.QFrame()
        self.thresholdFrame.setLayout(qt.QHBoxLayout())
        self.thresholdLabel = qt.QLabel("Opacity Range:")
        self.thresholdLabel.setToolTip("Set the opacity range.")
        self.thresholdFrame.layout().addWidget(self.thresholdLabel)
   
        self.threshold = ctk.ctkRangeWidget()
        self.threshold.spinBoxAlignment = 0xff # put enties on top

        self.threshold.minimum = 0.
        self.threshold.maximum = 255.
        self.threshold.singleStep = 1.
        # set min/max based on current range
        self.thresholdFrame.layout().addWidget(self.threshold)
        
        self.colorFrame=qt.QFrame()
        self.colorFrame.setLayout(qt.QHBoxLayout())
        self.colorLabel = qt.QLabel("Color Range:")
        self.colorLabel.setToolTip("Set the color range.")
        self.colorFrame.layout().addWidget(self.colorLabel)
   
        self.colorRangeSlider = ctk.ctkRangeWidget()
        self.colorRangeSlider.spinBoxAlignment = 0xff # put enties on top
        self.colorRangeSlider.singleStep = 0.01
        self.colorRangeSlider.minimum = 0.
        self.colorRangeSlider.maximum = 255.
        # set min/max based on current range
        self.colorFrame.layout().addWidget(self.colorRangeSlider)
        
        #success, lo, hi = self.getBackgroundScalarRange()
        #if success:
        #  self.threshold.minimum, self.threshold.maximum = lo, hi
        #  self.threshold.singleStep = (hi - lo) / 1000.
        
        #self.thresholdFrame.layout().addWidget(self.threshold)

        self.propertiesMenuWidget.layout().addWidget(self.visible3DFrame)
        self.propertiesMenuWidget.layout().addWidget(self.thresholdFrame )
        self.propertiesMenuWidget.layout().addWidget(self.colorFrame )
Example #3
0
  def labelSelectDialog(self):
    """label table dialog"""

    if not self.labelSelect:
      self.labelSelect = qt.QFrame()
      self.labelSelect.setLayout( qt.QVBoxLayout() )

      self.labelPromptLabel = qt.QLabel()
      self.labelSelect.layout().addWidget( self.labelPromptLabel )


      self.labelSelectorFrame = qt.QFrame()
      self.labelSelectorFrame.setLayout( qt.QHBoxLayout() )
      self.labelSelect.layout().addWidget( self.labelSelectorFrame )

      self.labelSelectorLabel = qt.QLabel()
      self.labelPromptLabel.setText( "Label Map: " )
      self.labelSelectorFrame.layout().addWidget( self.labelSelectorLabel )

      self.labelSelector = slicer.qMRMLNodeComboBox()
      self.labelSelector.nodeTypes = ( "vtkMRMLScalarVolumeNode", "" )
      self.labelSelector.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", "1" )
      # todo addAttribute
      self.labelSelector.selectNodeUponCreation = False
      self.labelSelector.addEnabled = False
      self.labelSelector.noneEnabled = False
      self.labelSelector.removeEnabled = False
      self.labelSelector.showHidden = False
      self.labelSelector.showChildNodeTypes = False
      self.labelSelector.setMRMLScene( slicer.mrmlScene )
      self.labelSelector.setToolTip( "Pick the label map to edit" )
      self.labelSelectorFrame.layout().addWidget( self.labelSelector )

      self.labelButtonFrame = qt.QFrame()
      self.labelButtonFrame.setLayout( qt.QHBoxLayout() )
      self.labelSelect.layout().addWidget( self.labelButtonFrame )

      self.labelDialogApply = qt.QPushButton("Apply", self.labelButtonFrame)
      self.labelDialogApply.setToolTip( "Use currently selected label node." )
      self.labelButtonFrame.layout().addWidget(self.labelDialogApply)

      self.labelDialogCancel = qt.QPushButton("Cancel", self.labelButtonFrame)
      self.labelDialogCancel.setToolTip( "Cancel current operation." )
      self.labelButtonFrame.layout().addWidget(self.labelDialogCancel)

      self.labelButtonFrame.layout().addStretch(1)

      self.labelDialogCreate = qt.QPushButton("Create New...", self.labelButtonFrame)
      self.labelDialogCreate.setToolTip( "Cancel current operation." )
      self.labelButtonFrame.layout().addWidget(self.labelDialogCreate)

      self.labelDialogApply.connect("clicked()", self.onLabelDialogApply)
      self.labelDialogCancel.connect("clicked()", self.labelSelect.hide)
      self.labelDialogCreate.connect("clicked()", self.onLabelDialogCreate)

    self.labelPromptLabel.setText( "Select existing label map volume to edit." )
    p = qt.QCursor().pos()
    self.labelSelect.setGeometry(p.x(), p.y(), 400, 200)
    self.labelSelect.show()
Example #4
0
    def createDockPanel(self):
        self.modules = []

        self.dockPanel = qt.QDockWidget('Plane Control')
        self.dockPanel.windowTitle = "Plane Control"
        self.dockPanel.setAllowedAreas(qt.Qt.LeftDockWidgetArea
                                       | qt.Qt.RightDockWidgetArea)

        self.dockFrame = qt.QFrame(self.dockPanel)
        self.dockFrame.setFrameStyle(qt.QFrame.NoFrame)
        self.dockLayout = qt.QVBoxLayout()

        ## Button Frame
        self.dockButtonFrame = qt.QFrame(self.dockFrame)
        self.dockButtonFrame.setFrameStyle(qt.QFrame.NoFrame)
        self.dockButtonLayout = qt.QHBoxLayout()

        self.dockButtonFrame.setLayout(self.dockButtonLayout)

        ## Wizard Frame
        self.dockWizardFrame = qt.QFrame(self.dockFrame)
        self.dockWizardFrame.setFrameStyle(qt.QFrame.NoFrame)
        self.dockWizardLayout = qt.QHBoxLayout()

        self.transversalCheckBox = ctk.ctkCheckBox()
        self.transversalCheckBox.text = "Transversal"
        self.transversalCheckBox.enabled = True
        self.transversalCheckBox.checked = False

        self.inplane0CheckBox = ctk.ctkCheckBox()
        self.inplane0CheckBox.text = "Inplane0"
        self.inplane0CheckBox.enabled = True
        self.inplane0CheckBox.checked = False

        self.inplane90CheckBox = ctk.ctkCheckBox()
        self.inplane90CheckBox.text = "Inplane90"
        self.inplane90CheckBox.enabled = True
        self.inplane90CheckBox.checked = False

        self.dockWizardLayout.addWidget(self.transversalCheckBox)
        self.dockWizardLayout.addWidget(self.inplane0CheckBox)
        self.dockWizardLayout.addWidget(self.inplane90CheckBox)

        self.dockWizardFrame.setLayout(self.dockWizardLayout)
        self.dockLayout.addWidget(self.dockWizardFrame)

        self.dockFrame.setLayout(self.dockLayout)
        self.dockPanel.setWidget(self.dockFrame)

        self.dockButtonFrame.show()
        self.dockWizardFrame.show()
        mw = slicer.util.mainWindow()
        mw.addDockWidget(qt.Qt.LeftDockWidgetArea, self.dockPanel)
        self.dockFrame.show()
Example #5
0
    def setup(self):
        # Collapsible button
        self.laplaceCollapsibleButton = ctk.ctkCollapsibleButton()
        self.laplaceCollapsibleButton.text = "Sharpen Operator"
        self.layout.addWidget(self.laplaceCollapsibleButton)

        # Layout within the laplace collapsible button
        self.laplaceFormLayout = qt.QFormLayout(self.laplaceCollapsibleButton)

        #
        # the volume selectors
        #
        self.inputFrame = qt.QFrame(self.laplaceCollapsibleButton)
        self.inputFrame.setLayout(qt.QHBoxLayout())
        self.laplaceFormLayout.addWidget(self.inputFrame)
        self.inputSelector = qt.QLabel("Input Volume: ", self.inputFrame)
        self.inputFrame.layout().addWidget(self.inputSelector)
        self.inputSelector = slicer.qMRMLNodeComboBox(self.inputFrame)
        self.inputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.inputSelector.addEnabled = False
        self.inputSelector.removeEnabled = False
        self.inputSelector.setMRMLScene(slicer.mrmlScene)
        self.inputFrame.layout().addWidget(self.inputSelector)

        self.outputFrame = qt.QFrame(self.laplaceCollapsibleButton)
        self.outputFrame.setLayout(qt.QHBoxLayout())
        self.laplaceFormLayout.addWidget(self.outputFrame)
        self.outputSelector = qt.QLabel("Output Volume: ", self.outputFrame)
        self.outputFrame.layout().addWidget(self.outputSelector)
        self.outputSelector = slicer.qMRMLNodeComboBox(self.outputFrame)
        self.outputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.outputSelector.setMRMLScene(slicer.mrmlScene)
        self.outputFrame.layout().addWidget(self.outputSelector)

        # Section A - add code here
        # (be sure to match indentation)
        self.sharpen = qt.QCheckBox("Sharpen", self.laplaceCollapsibleButton)
        self.sharpen.toolTip = "When checked, subtract laplacian from input volume"
        self.sharpen.checked = True
        self.laplaceFormLayout.addWidget(self.sharpen)

        # Apply button
        laplaceButton = qt.QPushButton("Apply")
        laplaceButton.toolTip = "Run the Laplace or Sharpen Operator."
        self.laplaceFormLayout.addWidget(laplaceButton)
        laplaceButton.connect('clicked(bool)', self.onApply)

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

        # Set local var as instance attribute
        self.laplaceButton = laplaceButton
    def setup(self):
        # Collapsible button
        self.sampleCollapsibleButton = ctk.ctkCollapsibleButton()
        self.sampleCollapsibleButton.text = "ROI Segmentation"
        self.layout.addWidget(self.sampleCollapsibleButton)

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

        self.inputFrame = qt.QFrame(self.sampleCollapsibleButton)
        self.inputFrame.setLayout(qt.QHBoxLayout())
        self.sampleFormLayout.addWidget(self.inputFrame)
        self.inputSelector = qt.QLabel("Input Volume: ", self.inputFrame)
        self.inputFrame.layout().addWidget(self.inputSelector)
        self.inputSelector = slicer.qMRMLNodeComboBox(self.inputFrame)
        self.inputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.inputSelector.addEnabled = False
        self.inputSelector.removeEnabled = False
        self.inputSelector.setMRMLScene(slicer.mrmlScene)
        self.inputFrame.layout().addWidget(self.inputSelector)

        self.outputFrame = qt.QFrame(self.sampleCollapsibleButton)
        self.outputFrame.setLayout(qt.QHBoxLayout())
        self.sampleFormLayout.addWidget(self.outputFrame)
        self.outputSelector = qt.QLabel("Output Volume: ", self.outputFrame)
        self.outputFrame.layout().addWidget(self.outputSelector)
        self.outputSelector = slicer.qMRMLNodeComboBox(self.outputFrame)
        self.outputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.outputSelector.setMRMLScene(slicer.mrmlScene)
        self.outputFrame.layout().addWidget(self.outputSelector)

        selectionNode = slicer.mrmlScene.GetNodeByID(
            "vtkMRMLSelectionNodeSingleton")
        selectionNode.SetReferenceActivePlaceNodeClassName(
            "vtkMRMLAnnotationROINode")
        interactionNode = slicer.mrmlScene.GetNodeByID(
            "vtkMRMLInteractionNodeSingleton")
        interactionNode.SetPlaceModePersistence(1)
        interactionNode.SetCurrentInteractionMode(1)
        print(help(interactionNode))

        # Add a reload button for debug
        reloadButton = qt.QPushButton("Reload")
        reloadButton.toolTip = "Reload this Module"
        self.sampleFormLayout.addWidget(reloadButton)
        reloadButton.connect('clicked()', self.onReload)

        # Set local var as instance attribute
        self.reloadButton = reloadButton

        # Add vertical spacer
        self.layout.addStretch(1)
Example #7
0
    def setup(self):
        collapsibleButton = ctk.ctkCollapsibleButton()
        collapsibleButton.text = "Robex Brain Extraction"
        self.layout.addWidget(collapsibleButton)
        self.formLayout = qt.QFormLayout(collapsibleButton)
        self.formFrame = qt.QFrame(collapsibleButton)
        self.formFrame.setLayout(qt.QHBoxLayout())
        self.formLayout.addWidget(self.formFrame)

        # folder text field
        # will search under this folder and 1 level below this folder
        self.textfield = qt.QTextEdit()
        self.formLayout.addRow("folder", self.textfield)

        # input file name text field
        # will search for files matching this name
        self.brainfileTextfield = qt.QTextEdit()
        self.formLayout.addRow("input files", self.brainfileTextfield)

        button = qt.QPushButton("Generate brain.obj and brainmask.nii")
        button.connect("clicked(bool)", self.robexBrainExtractionButtonClicked)
        self.formLayout.addRow(button)

        # output file name
        # input file names and output file names will match line by line
        self.brainOutputTextfield = qt.QTextEdit()
        self.formLayout.addRow("output files", self.brainOutputTextfield)

        collapsibleButtonB = ctk.ctkCollapsibleButton()
        collapsibleButtonB.text = "Tumor Segmentation"
        self.layout.addWidget(collapsibleButtonB)
        self.formLayoutB = qt.QFormLayout(collapsibleButtonB)
        self.formFrameB = qt.QFrame(collapsibleButtonB)
        self.formFrameB.setLayout(qt.QHBoxLayout())
        self.formLayoutB.addWidget(self.formFrameB)

        self.textfieldB = qt.QTextEdit()
        self.formLayoutB.addRow("folder", self.textfieldB)

        self.segmentationfileTextfield = qt.QTextEdit()
        self.formLayoutB.addRow("input files", self.segmentationfileTextfield)

        buttonB = qt.QPushButton("Generate segmentation.obj")
        buttonB.connect("clicked(bool)", self.informationButtonClicked)
        self.formLayoutB.addRow(buttonB)

        self.segmentationOutputTextfield = qt.QTextEdit()
        self.formLayoutB.addRow("output files",
                                self.segmentationOutputTextfield)
Example #8
0
  def setup(self):
    self.manageAPIsWidget = qt.QWidget()
    self.APISettingsPopupLayout.addWidget(self.manageAPIsWidget)
    self.manageAPIsLayout = qt.QVBoxLayout(self.manageAPIsWidget)
    label = qt.QLabel('Manage APIs')
    self.manageAPIsLayout.addWidget(label)

    self.apiTable = APITable()
    self.apiTable.connect('cellClicked(int,int)',self.apiSelected)
    self.manageAPIsLayout.addWidget(self.apiTable)

    self.manageButtonsWidget = qt.QWidget()
    self.manageButtonsLayout = qt.QHBoxLayout(self.manageButtonsWidget)
    self.manageAPIsLayout.addWidget(self.manageButtonsWidget)
    self.manageButtonsLayout.addStretch(1)

    self.addAPIButton = qt.QPushButton('Add')
    self.manageButtonsLayout.addWidget(self.addAPIButton)

    self.editAPIButton = qt.QPushButton('Edit')
    self.editAPIButton.enabled = False
    self.manageButtonsLayout.addWidget(self.editAPIButton)

    self.deleteAPIButton = qt.QPushButton('Delete')
    self.deleteAPIButton.enabled = False
    self.manageButtonsLayout.addWidget(self.deleteAPIButton)
    
    self.restartLabel = qt.QLabel('')
    self.restartLabel.setVisible(False)
    self.restartLabel.setText("<font color='red'>* Restart Required</font>")
    self.APISettingsPopupLayout.addWidget(self.restartLabel)

    self.APISettingsPopupButtonsWidget = qt.QWidget()
    self.APISettingsPopupButtonsLayout = qt.QHBoxLayout(self.APISettingsPopupButtonsWidget)
    self.APISettingsPopupButtonsLayout.addStretch(1)
    self.APISettingsPopupLayout.addWidget(self.APISettingsPopupButtonsWidget)

    self.doneButton = qt.QPushButton('Done')
    self.APISettingsPopupButtonsLayout.addWidget(self.doneButton)

    self.cancelButton = qt.QPushButton('Cancel')
    self.APISettingsPopupButtonsLayout.addWidget(self.cancelButton)

    # Connections
    self.addAPIButton.connect('clicked(bool)', self.onAddApiButton)
    self.editAPIButton.connect('clicked(bool)', self.onEditApiButton)
    self.deleteAPIButton.connect('clicked(bool)', self.onDeleteApiButton)
    self.doneButton.connect('clicked(bool)', self.onDoneButton)
    self.cancelButton.connect('clicked(bool)', self.onCancelButton)
Example #9
0
  def create(self):
    super(WandEffectOptions,self).create()

    self.toleranceFrame = qt.QFrame(self.frame)
    self.toleranceFrame.setLayout(qt.QHBoxLayout())
    self.frame.layout().addWidget(self.toleranceFrame)
    self.widgets.append(self.toleranceFrame)
    self.toleranceLabel = qt.QLabel("Tolerance:", self.toleranceFrame)
    self.toleranceLabel.setToolTip("Set the tolerance of the wand in terms of background pixel values")
    self.toleranceFrame.layout().addWidget(self.toleranceLabel)
    self.widgets.append(self.toleranceLabel)
    self.toleranceSpinBox = qt.QDoubleSpinBox(self.toleranceFrame)
    self.toleranceSpinBox.setToolTip("Set the tolerance of the wand in terms of background pixel values")
    self.toleranceSpinBox.minimum = 0
    self.toleranceSpinBox.maximum = 1000
    self.toleranceSpinBox.suffix = ""
    self.toleranceFrame.layout().addWidget(self.toleranceSpinBox)
    self.widgets.append(self.toleranceSpinBox)

    self.maxPixelsFrame = qt.QFrame(self.frame)
    self.maxPixelsFrame.setLayout(qt.QHBoxLayout())
    self.frame.layout().addWidget(self.maxPixelsFrame)
    self.widgets.append(self.maxPixelsFrame)
    self.maxPixelsLabel = qt.QLabel("Max Pixels per click:", self.maxPixelsFrame)
    self.maxPixelsLabel.setToolTip("Set the maxPixels for each click")
    self.maxPixelsFrame.layout().addWidget(self.maxPixelsLabel)
    self.widgets.append(self.maxPixelsLabel)
    self.maxPixelsSpinBox = qt.QDoubleSpinBox(self.maxPixelsFrame)
    self.maxPixelsSpinBox.setToolTip("Set the maxPixels for each click")
    self.maxPixelsSpinBox.minimum = 1
    self.maxPixelsSpinBox.maximum = 100000
    self.maxPixelsSpinBox.suffix = ""
    self.maxPixelsFrame.layout().addWidget(self.maxPixelsSpinBox)
    self.widgets.append(self.maxPixelsSpinBox)

    HelpButton(self.frame, "Use this tool to label all voxels that are within a tolerance of where you click")

    # don't connect the signals and slots directly - instead, add these
    # to the list of connections so that gui callbacks can be cleanly 
    # disabled while the gui is being updated.  This allows several gui
    # elements to be interlinked with signal/slots but still get updated
    # as a unit to the new value of the mrml node.
    self.connections.append( 
        (self.toleranceSpinBox, 'valueChanged(double)', self.onToleranceSpinBoxChanged) )
    self.connections.append( 
        (self.maxPixelsSpinBox, 'valueChanged(double)', self.onMaxPixelsSpinBoxChanged) )

    # Add vertical spacer
    self.frame.layout().addStretch(1)
Example #10
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # Collapsible button
        self.selectionCollapsibleButton = ctk.ctkCollapsibleButton()
        self.selectionCollapsibleButton.text = "Selection"
        self.layout.addWidget(self.selectionCollapsibleButton)

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

        #
        # the volume selectors
        #
        self.inputFrame = qt.QFrame(self.selectionCollapsibleButton)
        self.inputFrame.setLayout(qt.QHBoxLayout())
        self.formLayout.addWidget(self.inputFrame)
        self.inputSelector = qt.QLabel("Input Vector Volume: ",
                                       self.inputFrame)
        self.inputFrame.layout().addWidget(self.inputSelector)
        self.inputSelector = slicer.qMRMLNodeComboBox(self.inputFrame)
        self.inputSelector.nodeTypes = ["vtkMRMLVectorVolumeNode"]
        self.inputSelector.addEnabled = False
        self.inputSelector.removeEnabled = False
        self.inputSelector.setMRMLScene(slicer.mrmlScene)
        self.inputFrame.layout().addWidget(self.inputSelector)

        self.outputFrame = qt.QFrame(self.selectionCollapsibleButton)
        self.outputFrame.setLayout(qt.QHBoxLayout())
        self.formLayout.addWidget(self.outputFrame)
        self.outputSelector = qt.QLabel("Output Scalar Volume: ",
                                        self.outputFrame)
        self.outputFrame.layout().addWidget(self.outputSelector)
        self.outputSelector = slicer.qMRMLNodeComboBox(self.outputFrame)
        self.outputSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.outputSelector.setMRMLScene(slicer.mrmlScene)
        self.outputSelector.addEnabled = True
        self.outputSelector.renameEnabled = True
        self.outputSelector.baseName = "Scalar Volume"
        self.outputFrame.layout().addWidget(self.outputSelector)

        # Apply button
        self.applyButton = qt.QPushButton("Apply")
        self.applyButton.toolTip = "Run Convert the vector to scalar."
        self.formLayout.addWidget(self.applyButton)
        self.applyButton.connect('clicked(bool)', self.onApply)

        # Add vertical spacer
        self.layout.addStretch(1)
Example #11
0
    def breachWarningLight(self):
        lnNode = slicer.util.getNode(self.moduleName)

        self.breachWarningLightCheckBox = qt.QCheckBox()
        checkBoxLabel = qt.QLabel()
        hBoxCheck = qt.QHBoxLayout()
        hBoxCheck.setAlignment(0x0001)
        checkBoxLabel.setText("Use Breach Warning Light: ")
        hBoxCheck.addWidget(checkBoxLabel)
        hBoxCheck.addWidget(self.breachWarningLightCheckBox)
        hBoxCheck.setStretch(1, 2)
        self.launcherFormLayout.addRow(hBoxCheck)

        if (lnNode is not None
                and lnNode.GetParameter('EnableBreachWarningLight')):
            # logging.debug("There is already a connector EnableBreachWarningLight parameter " + lnNode.GetParameter('EnableBreachWarningLight'))
            self.breachWarningLightCheckBox.checked = lnNode.GetParameter(
                'EnableBreachWarningLight')
            self.breachWarningLightCheckBox.setDisabled(True)
        else:
            self.breachWarningLightCheckBox.setEnabled(True)
            settings = slicer.app.userSettings()
            lightEnabled = settings.value(
                self.moduleName + '/Configurations/' +
                self.selectedConfigurationName + '/EnableBreachWarningLight',
                'True')
            self.breachWarningLightCheckBox.checked = (lightEnabled == 'True')

        self.breachWarningLightCheckBox.connect(
            'stateChanged(int)', self.onBreachWarningLightChanged)
    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)
Example #13
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)
Example #14
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)
Example #15
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))
Example #16
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)
Example #17
0
    def addTumorContouringToUltrasoundPanel(self):

        self.ultrasoundCollapsibleButton.text = "Tumor contouring"

        self.placeButton = qt.QPushButton("Mark points")
        self.placeButton.setCheckable(True)
        self.placeButton.setIcon(qt.QIcon(":/Icons/MarkupsMouseModePlace.png"))
        setButtonStyle(self.placeButton)
        self.ultrasoundLayout.addRow(self.placeButton)

        self.deleteLastFiducialButton = qt.QPushButton("Delete last")
        self.deleteLastFiducialButton.setIcon(
            qt.QIcon(":/Icons/MarkupsDelete.png"))
        setButtonStyle(self.deleteLastFiducialButton)
        self.deleteLastFiducialButton.setEnabled(False)

        self.deleteAllFiducialsButton = qt.QPushButton("Delete all")
        self.deleteAllFiducialsButton.setIcon(
            qt.QIcon(":/Icons/MarkupsDeleteAllRows.png"))
        setButtonStyle(self.deleteAllFiducialsButton)
        self.deleteAllFiducialsButton.setEnabled(False)

        hbox = qt.QHBoxLayout()
        hbox.addWidget(self.deleteLastFiducialButton)
        hbox.addWidget(self.deleteAllFiducialsButton)
        self.ultrasoundLayout.addRow(hbox)
Example #18
0
    def addLauncherWidgets(self):
        GuideletWidget.addLauncherWidgets(self)
        # Add the second Plus connection info entry
        try:
            slicer.modules.plusremote
        except:
            return

        self.agilentServerHostNamePortLineEdit = qt.QLineEdit()
        leLabel = qt.QLabel()
        leLabel.setText("Set the Agilent Plus Server Host and Name Port:")
        hbox = qt.QHBoxLayout()
        hbox.addWidget(leLabel)
        hbox.addWidget(self.agilentServerHostNamePortLineEdit)
        self.launcherFormLayout.addRow(hbox)

        lnNode = slicer.util.getNode(self.moduleName)
        if lnNode is not None and lnNode.GetParameter(
                'AgilentServerHostNamePort'):
            # logging.debug("There is already a connector PlusServerHostNamePort parameter " + lnNode.GetParameter('PlusServerHostNamePort'))
            self.agilentServerHostNamePortLineEdit.setDisabled(True)
            self.agilentServerHostNamePortLineEdit.setText(
                lnNode.GetParameter('AgilentServerHostNamePort'))
        else:
            agilentServerHostNamePort = slicer.app.userSettings().value(
                self.moduleName + '/Configurations/' +
                self.selectedConfigurationName + '/AgilentServerHostNamePort')
            self.agilentServerHostNamePortLineEdit.setText(
                agilentServerHostNamePort)

        self.agilentServerHostNamePortLineEdit.connect(
            'editingFinished()', self.onAgilentServerPreferencesChanged)
Example #19
0
    def __init__(self, parent):
        vLayout = qt.QVBoxLayout(parent)
        hLayout = qt.QHBoxLayout()

        self.icon = qt.QLabel()
        self.icon.setPixmap(_dialogIcon(qt.QStyle.SP_MessageBoxQuestion))
        hLayout.addWidget(self.icon, 0)

        self.label = qt.QLabel()
        self.label.wordWrap = True
        hLayout.addWidget(self.label, 1)

        vLayout.addLayout(hLayout)

        self.moduleList = qt.QListWidget()
        self.moduleList.selectionMode = qt.QAbstractItemView.NoSelection
        vLayout.addWidget(self.moduleList)

        self.addToSearchPaths = qt.QCheckBox()
        vLayout.addWidget(self.addToSearchPaths)

        self.buttonBox = qt.QDialogButtonBox()
        self.buttonBox.setStandardButtons(qt.QDialogButtonBox.Yes
                                          | qt.QDialogButtonBox.No)
        vLayout.addWidget(self.buttonBox)
Example #20
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()
Example #21
0
  def __init__(self, widgetClass=None):
    self.parent = qt.QFrame()
    self.parent.setLayout( qt.QHBoxLayout() )

    self.sliceletPanel = qt.QFrame(self.parent)
    self.sliceletPanelLayout = qt.QVBoxLayout(self.sliceletPanel)
    self.sliceletPanelLayout.setMargin(4)
    self.sliceletPanelLayout.setSpacing(0)
    self.parent.layout().addWidget(self.sliceletPanel,1)

    # TODO: should have way to pop up python interactor
    # self.buttons = qt.QFrame()
    # self.buttons.setLayout( qt.QHBoxLayout() )
    # self.parent.layout().addWidget(self.buttons)
    # self.addDataButton = qt.QPushButton("Add Data")
    # self.buttons.layout().addWidget(self.addDataButton)
    # self.addDataButton.connect("clicked()",slicer.app.ioManager().openAddDataDialog)
    # self.loadSceneButton = qt.QPushButton("Load Scene")
    # self.buttons.layout().addWidget(self.loadSceneButton)
    # self.loadSceneButton.connect("clicked()",slicer.app.ioManager().openLoadSceneDialog)

    self.layoutManager = slicer.qMRMLLayoutWidget()
    self.layoutManager.setMRMLScene(slicer.mrmlScene)
    self.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView)
    # self.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalView)
    # self.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView)
    # self.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutTabbedSliceView)
    # self.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutDual3DView)
    # self.layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView)
    self.parent.layout().addWidget(self.layoutManager,2)

    if widgetClass:
      self.widget = widgetClass(self.sliceletPanel)
      self.widget.setup()
    self.parent.show()
Example #22
0
  def makeAddAPIDialog (self):

    self.apiNameLineEdit.clear()
    self.apiKeyLineEdit.clear()

    saveButton = qt.QPushButton("OK")
    cancelButton = qt.QPushButton("Cancel")

    currLayout = qt.QFormLayout()
    currLayout.addRow("API Name:", self.apiNameLineEdit)
    currLayout.addRow("API Key:", self.apiKeyLineEdit)

    buttonLayout = qt.QHBoxLayout()
    buttonLayout.addStretch(1)
    buttonLayout.addWidget(cancelButton)
    buttonLayout.addWidget(saveButton)

    masterForm = qt.QFormLayout()    
    masterForm.addRow(currLayout)
    masterForm.addRow(buttonLayout)

    addApiDialog = qt.QDialog(self.addAPIButton)
    addApiDialog.setWindowTitle("Add API")
    addApiDialog.setFixedWidth(300)
    addApiDialog.setLayout(masterForm)
    addApiDialog.setWindowModality(1)

    cancelButton.connect("clicked()", addApiDialog.hide)
    saveButton.connect("clicked()", self.saveApi)   
    
    return addApiDialog
Example #23
0
  def makeDeleteApiDialoge(self):
    
    okButton = qt.QPushButton("OK")
    cancelButton = qt.QPushButton("Cancel")

    messageLabel = qt.QTextEdit()
    messageLabel.setReadOnly(True)
    messageLabel.insertPlainText("Are you sure you want to delete the selected API?") 
    messageLabel.setFontWeight(100)    
    messageLabel.setFixedHeight(40)
    messageLabel.setFrameShape(0)

    currLayout = qt.QVBoxLayout()
    currLayout.addWidget(messageLabel)
    #currLayout.addStretch(1)
    
    buttonLayout = qt.QHBoxLayout()
    buttonLayout.addStretch(1)
    buttonLayout.addWidget(cancelButton)
    buttonLayout.addWidget(okButton)
    
    masterForm = qt.QFormLayout()    
    masterForm.addRow(currLayout)
    masterForm.addRow(buttonLayout)

    deleteApiDialog = qt.QDialog(self.apiTable)
    deleteApiDialog.setWindowTitle("Delete API")
    deleteApiDialog.setLayout(masterForm)
    deleteApiDialog.setWindowModality(1)

    cancelButton.connect("clicked()", deleteApiDialog.hide)
    okButton.connect("clicked()", self.deleteApi) 
    
    return deleteApiDialog
Example #24
0
    def addConfigurationsSelector(self):
        self.configurationsComboBox = qt.QComboBox()
        configurationsLabel = qt.QLabel("Select Configuration: ")
        hBox = qt.QHBoxLayout()
        hBox.addWidget(configurationsLabel)
        hBox.addWidget(self.configurationsComboBox)
        hBox.setStretch(1, 2)
        self.launcherFormLayout.addRow(hBox)

        # Populate configurationsComboBox with available configurations
        settings = slicer.app.userSettings()
        settings.beginGroup(self.moduleName + '/Configurations')
        configurations = settings.childGroups()
        for configuration in configurations:
            self.configurationsComboBox.addItem(configuration)
        settings.endGroup()

        # Set latest used configuration
        if settings.value(self.moduleName + '/MostRecentConfiguration'):
            self.selectedConfigurationName = settings.value(
                self.moduleName + '/MostRecentConfiguration')
            idx = self.configurationsComboBox.findText(
                settings.value(self.moduleName + '/MostRecentConfiguration'))
            self.configurationsComboBox.setCurrentIndex(idx)

        self.configurationsComboBox.connect(
            'currentIndexChanged(const QString &)',
            self.onConfigurationChanged)
Example #25
0
    def __init__(self, MODULE, title="Xnat Download", memDisplay="MB"):
        """ Init funnction.
        """
        super(XnatDownloadPopup, self).__init__(MODULE=MODULE, title=title)

        #-------------------
        # Params
        #-------------------
        self.memDisplay = memDisplay
        self.downloadFileSize = None

        #-------------------
        # Window size
        #-------------------
        self.window.setFixedWidth(500)

        #-------------------
        # Line text
        #-------------------
        self.textDisp = [
            '', '[Unknown amount] ' + self.memDisplay +
            ' out of [Unknown total] ' + self.memDisplay
        ]
        self.lines = [qt.QLabel('') for x in range(0, 2)]

        #-------------------
        # Prog bar
        #-------------------
        self.progBar = qt.QProgressBar(self.window)
        self.progBar.setFixedHeight(17)

        #-------------------
        # Cancel button
        #-------------------
        self.cancelButton = qt.QPushButton()
        self.cancelButton.setText("Cancel")
        self.cancelButton.connect('pressed()',
                                  self.MODULE.XnatIo.cancelDownload)
        self.cancelButton.setFixedWidth(60)

        #-------------------
        # Add widgets to layout
        #-------------------
        for l in self.lines:
            self.layout.addRow(l)
        self.layout.addRow(self.progBar)

        #-------------------
        # Cancel row
        #-------------------
        cancelRow = qt.QHBoxLayout()
        cancelRow.addStretch()
        cancelRow.addWidget(self.cancelButton)
        cancelRow.addSpacing(37)
        self.layout.addRow(cancelRow)

        #-------------------
        # Clear all
        #-------------------
        self.reset()
  def __init__(self, parent):
    vLayout = qt.QVBoxLayout(parent)
    hLayout = qt.QHBoxLayout()

    self.icon = qt.QLabel()
    self.icon.setPixmap(_dialogIcon(qt.QStyle.SP_MessageBoxQuestion))
    hLayout.addWidget(self.icon, 0)

    self.label = qt.QLabel()
    self.label.wordWrap = True
    hLayout.addWidget(self.label, 1)

    vLayout.addLayout(hLayout)

    self.moduleList = qt.QListWidget()
    self.moduleList.selectionMode = qt.QAbstractItemView.NoSelection
    vLayout.addWidget(self.moduleList)

    self.addToSearchPaths = qt.QCheckBox()
    vLayout.addWidget(self.addToSearchPaths)

    self.enableDeveloperMode = qt.QCheckBox()
    self.enableDeveloperMode.text = "Enable developer mode"
    self.enableDeveloperMode.toolTip = "Sets the 'Developer mode' application option to enabled. Enabling developer mode is recommended while developing scripted modules, as it makes the Reload and Testing section displayed in the module user interface."
    self.enableDeveloperMode.checked = True
    vLayout.addWidget(self.enableDeveloperMode)

    self.buttonBox = qt.QDialogButtonBox()
    self.buttonBox.setStandardButtons(qt.QDialogButtonBox.Yes |
                                      qt.QDialogButtonBox.No)
    vLayout.addWidget(self.buttonBox)
Example #27
0
 def _inputLayoutSection(self):
     inputCollapsibleButton = FFCollapsibleButton('Input volumes')
     self.layout.addWidget(inputCollapsibleButton)
     # Layout within the input collapsible button
     inputFormLayout = qt.QFormLayout(inputCollapsibleButton)
     ### Fixed Volume Selector ###
     # The fixed volume frame
     fixedVolumeFrame = qt.QFrame(inputCollapsibleButton)
     fixedVolumeFrame.setLayout(qt.QHBoxLayout())
     inputFormLayout.addWidget(fixedVolumeFrame)
     # The volume selector button label
     fixedVolumeLabel = qt.QLabel('Fixed Volume: ', fixedVolumeFrame)
     fixedVolumeFrame.layout().addWidget(fixedVolumeLabel)
     # The volume selector buttom
     self.fixedVolumeSelector = qMRMLNodeAddVolumeComboBox(
         objectName='fixedVolumeSelector', toolTip='Select a fixed volume')
     self.fixedVolumeSelector.connect('currentNodeChanged(vtkMRMLNode*)',
                                      self.setFixedVolumeNode)
     self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)',
                         self.setFixedSliceViews)
     self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)',
                         self.fixedVolumeSelector,
                         'setMRMLScene(vtkMRMLScene*)')
     fixedVolumeFrame.layout().addWidget(self.fixedVolumeSelector)
     ### The Moving Volume Selector ###
     # The moving volume frame
     movingVolumeFrame = qt.QFrame(inputCollapsibleButton)
     movingVolumeFrame.setLayout(qt.QHBoxLayout())
     inputFormLayout.addWidget(movingVolumeFrame)
     # The volume selector button label
     movingVolumeLabel = qt.QLabel('Moving Volume: ', movingVolumeFrame)
     movingVolumeFrame.layout().addWidget(movingVolumeLabel)
     # The volume selector buttom
     self.movingVolumeSelector = qMRMLNodeAddVolumeComboBox(
         objectName='movingVolumeSelector',
         toolTip='Select a moving volume')
     self.movingVolumeSelector.connect('currentNodeChanged(vtkMRMLNode*)',
                                       self.setMovingVolumeNode)
     self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)',
                         self.setMovingSliceViews)
     self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)',
                         self.movingVolumeSelector,
                         'setMRMLScene(vtkMRMLScene*)')
     movingVolumeFrame.layout().addWidget(self.movingVolumeSelector)
     # Moved from __init__()
     self.fixedVolumeSelector.setMRMLScene(slicer.mrmlScene)
     self.movingVolumeSelector.setMRMLScene(slicer.mrmlScene)
Example #28
0
  def setupAdvancedPanel(self):
    logging.debug('setupAdvancedPanel')

    self.advancedCollapsibleButton.setProperty('collapsedHeight', 20)
    self.advancedCollapsibleButton.text = "Settings"
    self.sliceletPanelLayout.addWidget(self.advancedCollapsibleButton)

    self.advancedLayout = qt.QFormLayout(self.advancedCollapsibleButton)
    self.advancedLayout.setContentsMargins(12, 4, 4, 4)
    self.advancedLayout.setSpacing(4)

    # Layout selection combo box
    self.viewSelectorComboBox = qt.QComboBox(self.advancedCollapsibleButton)
    self.setupViewerLayouts()
    self.advancedLayout.addRow("Layout: ", self.viewSelectorComboBox)

    self.registerCustomLayouts()

    self.selectView(self.VIEW_ULTRASOUND_3D)

    # OpenIGTLink connector node selection
    self.linkInputSelector = slicer.qMRMLNodeComboBox()
    self.linkInputSelector.nodeTypes = ("vtkMRMLIGTLConnectorNode", "")
    self.linkInputSelector.selectNodeUponCreation = True
    self.linkInputSelector.addEnabled = False
    self.linkInputSelector.removeEnabled = True
    self.linkInputSelector.noneEnabled = False
    self.linkInputSelector.showHidden = False
    self.linkInputSelector.showChildNodeTypes = False
    self.linkInputSelector.setMRMLScene( slicer.mrmlScene )
    self.linkInputSelector.setToolTip( "Select connector node" )
    self.advancedLayout.addRow("OpenIGTLink connector: ", self.linkInputSelector)

    self.showFullSlicerInterfaceButton = qt.QPushButton()
    self.showFullSlicerInterfaceButton.setText("Show 3D Slicer user interface")
    self.advancedLayout.addRow(self.showFullSlicerInterfaceButton)

    self.showGuideletFullscreenButton = qt.QPushButton()
    self.showGuideletFullscreenButton.setText("Show guidelet in full screen")
    self.advancedLayout.addRow(self.showGuideletFullscreenButton)

    self.saveSceneButton = qt.QPushButton()
    self.saveSceneButton.setText("Save slicelet scene")
    self.advancedLayout.addRow(self.saveSceneButton)

    self.saveDirectoryLineEdit = qt.QLineEdit()
    node = self.logic.getParameterNode()
    sceneSaveDirectory = node.GetParameter('SavedScenesDirectory')
    self.saveDirectoryLineEdit.setText(sceneSaveDirectory)
    saveLabel = qt.QLabel()
    saveLabel.setText("Save scene directory:")
    hbox = qt.QHBoxLayout()
    hbox.addWidget(saveLabel)
    hbox.addWidget(self.saveDirectoryLineEdit)
    self.advancedLayout.addRow(hbox)

    self.exitButton = qt.QPushButton()
    self.exitButton.setText("Exit")
    self.advancedLayout.addRow(self.exitButton)
Example #29
0
    def create(self):

        self.findEffects()

        self.mainFrame = qt.QFrame(self.parent)
        self.mainFrame.objectName = 'MainFrame'
        vbox = qt.QVBoxLayout()
        self.mainFrame.setLayout(vbox)
        self.parent.layout().addWidget(self.mainFrame)

        #
        # the buttons
        #
        self.rowFrames = []
        self.actions = {}
        self.buttons = {}
        self.icons = {}
        self.callbacks = {}

        # create all of the buttons
        # createButtonRow() ensures that only effects in self.effects are exposed,
        self.createButtonRow(
            ("DefaultTool", "EraseLabel", "PaintEffect", "DrawEffect",
             "WandEffect", "LevelTracingEffect", "RectangleEffect",
             "IdentifyIslandsEffect", "ChangeIslandEffect",
             "RemoveIslandsEffect", "SaveIslandEffect"))
        self.createButtonRow(
            ("ErodeEffect", "DilateEffect", "GrowCutEffect",
             "WatershedFromMarkerEffect", "ThresholdEffect",
             "ChangeLabelEffect", "MakeModelEffect", "FastMarchingEffect"))

        extensions = []
        for k in slicer.modules.editorExtensions:
            extensions.append(k)
        self.createButtonRow(extensions)

        self.createButtonRow(("PreviousCheckPoint", "NextCheckPoint"),
                             rowLabel="Undo/Redo: ")

        #
        # the labels
        #
        self.toolsActiveToolFrame = qt.QFrame(self.parent)
        self.toolsActiveToolFrame.setLayout(qt.QHBoxLayout())
        self.parent.layout().addWidget(self.toolsActiveToolFrame)
        self.toolsActiveTool = qt.QLabel(self.toolsActiveToolFrame)
        self.toolsActiveTool.setText('Active Tool:')
        self.toolsActiveTool.setStyleSheet(
            "background-color: rgb(232,230,235)")
        self.toolsActiveToolFrame.layout().addWidget(self.toolsActiveTool)
        self.toolsActiveToolName = qt.QLabel(self.toolsActiveToolFrame)
        self.toolsActiveToolName.setText('')
        self.toolsActiveToolName.setStyleSheet(
            "background-color: rgb(232,230,235)")
        self.toolsActiveToolFrame.layout().addWidget(self.toolsActiveToolName)

        vbox.addStretch(1)

        self.updateUndoRedoButtons()
Example #30
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