def setup(self): # The Link Section ##### Collapsible Layout self.connect_collapsible_button = ctk.ctkCollapsibleButton() self.connect_collapsible_button.text = 'Connect' self.layout.addWidget(self.connect_collapsible_button) self.connect_form_layout = qt.QGridLayout(self.connect_collapsible_button) self.connect_form_layout.setColumnStretch(0,1) self.connect_form_layout.setColumnStretch(1,1) ########## Collapsible Layout Widgets self.port_field = qt.QLineEdit() self.port_field.setText('18944') self.port_label = qt.QLabel('Port: ') self.port_label.alignment = 'AlignRight' self.connect_server_button = qt.QPushButton("Connect as Server") self.connect_server_button.connect('clicked(bool)', self.addServerConnection) self.connect_server_button.toolTip = "Add a networked computer to communicate with." self.connect_client_button = qt.QPushButton("Connect as Client") self.connect_client_button.connect('clicked(bool)', self.addClientConnection) self.connect_client_button.toolTip = "Add a networked computer to communicate with." self.connect_form_layout.addWidget(self.port_label,0,0) self.connect_form_layout.addWidget(self.port_field,0,1) self.connect_form_layout.addWidget(self.connect_server_button,1,0) self.connect_form_layout.addWidget(self.connect_client_button,1,1) # The Share Volume Section ##### Collapsible Layout self.share_collapsible_button = ctk.ctkCollapsibleButton() self.share_collapsible_button.text = 'Send Volume' self.layout.addWidget(self.share_collapsible_button) self.share_form_layout = qt.QGridLayout(self.share_collapsible_button) self.connect_form_layout.setColumnStretch(0,1) self.connect_form_layout.setColumnStretch(1,1) self.share_collapsible_button.setEnabled(0) self.share_collapsible_button.collapsed = 1; #####The 'Share' Form ########## 'Share' Button self.share_button = qt.QPushButton("Send Volume") self.share_button.toolTip = "Send the Volume" self.share_form_layout.addWidget(self.share_button,0,1) self.share_button.connect('clicked(bool)', self.sendVolume) ##########get the latest volumes self.generateVolumesDropdown() self.volume_dropdown.toolTip = "Select a Volume to Send" self.share_form_layout.addWidget(self.volume_dropdown,0,0) ##########Add event trigger to mrmlScene (when new volume gets added) self.addCheck = slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.NodeAddedEvent,self.updateNodeList) self.removeCheck = slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.NodeRemovedEvent,self.updateNodeList) # The Status Indicator self.status_button = qt.QPushButton("Status: Not Connected") self.status_button.setStyleSheet("border-radius:5px;border:2px solid black;color:black;background-color:red;height:40px;width:10px;font-size:16px;margin-left:10%;margin-right:10%") self.layout.addWidget(self.status_button) self.receiveCheck = self.connection_node.AddObserver('ReceiveEvent', self.updateStatus) # Add vertical spacer self.layout.addStretch(1)
def setup(self): # Instantiate and connect widgets ... # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "SlicerChronicle Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # # check box to turn on series watching # self.stepWatchCheckBox = qt.QCheckBox() self.stepWatchCheckBox.checked = 0 self.stepWatchCheckBox.setToolTip("When enabled, slicer will watch the chronicle db for new series load commands and will download and open the corresponding data.") parametersFormLayout.addRow("Watch for Steps to Process", self.stepWatchCheckBox) # connections self.stepWatchCheckBox.connect('toggled(bool)', self.toggleStepWatch) # Add vertical spacer self.layout.addStretch(1) # make a copy of the logic, which connects us to the database # TODO: we should have an option to pick the server, port, database name, and filter # and then match up this with an action to perform self.logic = SlicerChronicleLogic()
def createUserInterface( self ): ''' ''' self.skip = 0 self.__layout = self.__parent.createUserInterface() self.__basicFrame = ctk.ctkCollapsibleButton() self.__basicFrame.text = "Basic settings" self.__basicFrame.collapsed = 0 basicFrameLayout = qt.QFormLayout(self.__basicFrame) self.__layout.addRow(self.__basicFrame) self.__advancedFrame = ctk.ctkCollapsibleButton() self.__advancedFrame.text = "Advanced settings" self.__advancedFrame.collapsed = 1 advFrameLayout = qt.QFormLayout(self.__advancedFrame) self.__layout.addRow(self.__advancedFrame) threshLabel = qt.QLabel('1/ Make the holes visible:') self.__threshRange = slicer.qMRMLRangeWidget() self.__threshRange.decimals = 0 self.__threshRange.singleStep = 1 self.__useThresholdsCheck = qt.QCheckBox() self.__useThresholdsCheck.setEnabled(0) threshCheckLabel = qt.QLabel('Use thresholds for segmentation') roiLabel = qt.QLabel( 'Select segmentation:' ) self.__roiLabelSelector = slicer.qMRMLNodeComboBox() self.__roiLabelSelector.nodeTypes = ( 'vtkMRMLScalarVolumeNode', '' ) self.__roiLabelSelector.addAttribute('vtkMRMLScalarVolumeNode','LabelMap','1') self.__roiLabelSelector.toolTip = "Choose the ROI segmentation" self.__roiLabelSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__roiLabelSelector.addEnabled = 0 self.__roiLabelSelector.setMRMLScene(slicer.mrmlScene) self.__applyButton = qt.QPushButton('2/ Make a 3D Model') self.__applyButton.connect('clicked()', self.applyModelMaker) basicFrameLayout.addRow(threshLabel, self.__threshRange) basicFrameLayout.addRow(self.__applyButton) advFrameLayout.addRow(threshCheckLabel, self.__useThresholdsCheck) advFrameLayout.addRow( roiLabel, self.__roiLabelSelector ) self.__threshRange.connect('valuesChanged(double,double)', self.onThresholdChanged) self.__useThresholdsCheck.connect('stateChanged(int)', self.onThresholdsCheckChanged) self.__secondReg = qt.QPushButton('3/ ICP Registration') self.__secondReg.connect('clicked()', self.ICPRegistration) self.__secondReg.setEnabled(0) self.__layout.addRow(self.__secondReg) self.fiducialButton = qt.QPushButton('Manual Registration') self.fiducialButton.checkable = True self.__layout.addRow(self.fiducialButton) self.fiducialButton.connect('toggled(bool)', self.onRunButtonToggled)
def setup(self): # Instantiate and connect widgets ... # Collapsible button cButton = ctk.ctkCollapsibleButton() cButton.text = "GENERAL" self.layout.addWidget(cButton) dButton = ctk.ctkCollapsibleButton() dButton.text = "SIMULAR X-RAYS" self.layout.addWidget(dButton) eButton = ctk.ctkCollapsibleButton() eButton.text = "ANALISIS CEFALOMETRICO" self.layout.addWidget(eButton) # Layout within the sample collapsible button sampleFormLayout = qt.QFormLayout(cButton) hButton = qt.QPushButton('CARGAR DICOM') hButton.toolTip = "CARGAR IMAGENES DICOM" sampleFormLayout.addWidget(hButton) hButton.connect('clicked(bool)', self.onHButtonClicked) b=qt.QPushButton('INFO') b.toolTip = "Informacion acerca del volumen que sera renderizado" sampleFormLayout.addWidget(b) b.connect('clicked(bool)',self.boton) hec=qt.QPushButton('REINICIAR MODULO') hec.toolTip = "Volver a cargar este modulo" sampleFormLayout.addWidget(hec) hec.connect('clicked()',self.hec) # Layout within the sample collapsible button sampleFormLayout = qt.QFormLayout(dButton) mip=qt.QPushButton('MIP PROJECTION') mip.toolTip = "Algoritmo de proyeccion MIP" sampleFormLayout.addWidget(mip) mip.connect('clicked(bool)',self.mip) rsum=qt.QPushButton('RAY-SUM PROJECTION') rsum.toolTip = "Algoritmo de proyeccion Ray Sum" sampleFormLayout.addWidget(rsum) rsum.connect('clicked(bool)',self.rsum) # Add vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.hButton = hButton self.b = b self.hec = hec self.mip=mip
def setup(self): # Instantiate and connect widgets ... #PARCHEE" w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout # INPUT MENU self.inputFrame = ctk.ctkCollapsibleButton() self.inputFrame.text = "Input" self.inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.inputFrame) self.layout.addWidget(self.inputFrame) #Descubriendo que seria esto# self.__mvNode = None #Entrada multivolume label = qt.QLabel('Input multivolume') self.mvSelector = slicer.qMRMLNodeComboBox() self.mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.mvSelector.setMRMLScene(slicer.mrmlScene) self.mvSelector.addEnabled = 0 self.mvSelector.noneEnabled = 1 inputFrameLayout.addRow(label, self.mvSelector) #Entrada frame a mostrar label = qt.QLabel('Frame a mostrar') self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 inputFrameLayout.addRow(label, self.__veInitial) ###PARTE HELLO WORLD## BUTTON DE ACTIVACION # Collapsible button sampleCollapsibleButton = ctk.ctkCollapsibleButton() sampleCollapsibleButton.text = "A collapsible button" self.layout.addWidget(sampleCollapsibleButton) # Layout within the sample collapsible button sampleFormLayout = qt.QFormLayout(sampleCollapsibleButton) helloWorldButton = qt.QPushButton("Hello World") helloWorldButton.toolTip="Print 'Hello World' in standard output." sampleFormLayout.addWidget(helloWorldButton) helloWorldButton.connect('clicked(bool)',self.onHelloWorldButtonClicked) # Set local var as instance attribute self.helloWorldButton = helloWorldButton
def setup(self): # Instantiate and connect widgets ... # Reload and Test area if self.developerMode: # section reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # reload button self.reloadButton = qt.QPushButton("Reload") self.reloadButton.toolTip = "Reload this module." self.reloadButton.name = "PyDevRemoteDebug Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # Settings Area self.settingsCollapsibleButton = ctk.ctkCollapsibleButton() self.settingsCollapsibleButton.text = "Settings" self.settingsCollapsibleButton.collapsed = True self.layout.addWidget(self.settingsCollapsibleButton) settingsFormLayout = qt.QFormLayout(self.settingsCollapsibleButton) # pydevd.py path selector pydevdDir=self.getPydevdDir() self.pydevdDirSelector = ctk.ctkPathLineEdit() self.pydevdDirSelector.setCurrentPath(pydevdDir) self.pydevdDirSelector.filters=self.pydevdDirSelector.Dirs self.pydevdDirSelector.setMaximumWidth(300) self.pydevdDirSelector.setToolTip("Set the path to pydevd.py. It is in the eclipse folder within plugins/...pydev.../pysrc.") settingsFormLayout.addRow("Path to pydevd.py: ", self.pydevdDirSelector) if not self.isValidPydevdDir(pydevdDir): self.settingsCollapsibleButton.collapsed = False # Connection Area connectionCollapsibleButton = ctk.ctkCollapsibleButton() connectionCollapsibleButton.text = "Connection" connectionCollapsibleButton.collapsed = False self.layout.addWidget(connectionCollapsibleButton) connectionFormLayout = qt.QFormLayout(connectionCollapsibleButton) # Connect Button self.connectButton = qt.QPushButton("Connect") self.connectButton.toolTip = "Connect to PyDev remote debugger" self.connectButton.setAutoFillBackground(True) self.connectButton.setStyleSheet("background-color: rgb(150, 255, 150); color: rgb(0, 0, 0)"); connectionFormLayout.addRow(self.connectButton) # Connections self.connectButton.connect('clicked(bool)', self.onConnect) # Add vertical spacer self.layout.addStretch(1)
def createUserInterface( self ): self.skip = 0 self.__layout = self.__parent.createUserInterface() baselineScanLabel = qt.QLabel( 'CT or MR 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 #Load Template Button self.loadTemplateButton = qt.QPushButton('Load template') self.__layout.addRow(self.loadTemplateButton) self.loadTemplateButton.connect('clicked()', self.loadTemplate) #Load Scan Button self.__fileFrame = ctk.ctkCollapsibleButton() self.__fileFrame.text = "File Input" self.__fileFrame.collapsed = 1 fileFrame = qt.QFormLayout(self.__fileFrame) self.__layout.addRow(self.__fileFrame) loadDataButton = qt.QPushButton('Load Scan') loadDataButton.connect('clicked()', self.loadData) fileFrame.addRow(loadDataButton) fileFrame.addRow( baselineScanLabel, self.__baselineVolumeSelector ) # DICOM ToolBox self.__DICOMFrame = ctk.ctkCollapsibleButton() self.__DICOMFrame.text = "DICOM Input" self.__DICOMFrame.collapsed = 1 dicomFrame = qt.QFormLayout(self.__DICOMFrame) self.__layout.addRow(self.__DICOMFrame) voiGroupBox = qt.QGroupBox() voiGroupBox.setTitle( 'DICOM' ) dicomFrame.addRow( voiGroupBox ) voiGroupBoxLayout = qt.QFormLayout( voiGroupBox ) self.__roiWidget = ctk.ctkDICOMAppWidget() voiGroupBoxLayout.addRow( self.__roiWidget ) self.updateWidgetFromParameters(self.parameterNode())
def setup( self ): # settings settingsButton = ctk.ctkCollapsibleButton() settingsButton.text = "Settings" settingsButton.collapsed = False self.parent.layout().addWidget( settingsButton ) settingsLayout = qt.QFormLayout( settingsButton ) self.__dirButton = ctk.ctkDirectoryButton() settingsLayout.addRow( "Output directory:", self.__dirButton ) self.__viewCheckbox = qt.QCheckBox() self.__viewCheckbox.setChecked( True ) settingsLayout.addRow( "View after export:", self.__viewCheckbox ) # advanced advancedButton = ctk.ctkCollapsibleButton() advancedButton.text = "Advanced" advancedButton.collapsed = True self.parent.layout().addWidget( advancedButton ) advancedLayout = qt.QFormLayout( advancedButton ) self.__copyCheckbox = qt.QCheckBox() self.__copyCheckbox.setChecked( True ) advancedLayout.addRow( "Copy models to output directory:", self.__copyCheckbox ) self.__captionCombobox = qt.QComboBox() self.__captionCombobox.addItems( ['None', 'Model name', 'Hierarchy name'] ) self.__captionCombobox.currentIndex = 1 # Model name by default advancedLayout.addRow( "Set captions from:", self.__captionCombobox ) self.__serverCheckbox = qt.QCheckBox() self.__serverCheckbox.setChecked( useWebserver ) if not useWebserver: self.__serverCheckbox.setEnabled( False ) advancedLayout.addRow( "Run internal web server:", self.__serverCheckbox ) # Apply button self.__exportButton = qt.QPushButton( "Export to WebGL" ) self.__exportButton.toolTip = "Export to WebGL using XTK." self.__exportButton.enabled = True self.parent.layout().addWidget( self.__exportButton ) # Add vertical spacer self.parent.layout().addStretch( 1 ) # connections self.__exportButton.connect( 'clicked()', self.onExport )
def setup(self): # Instantiate and connect widgets ... # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "VolumeRenderingSceneClose Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # # 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)
def setup(self): # Instantiate and connect widgets ... # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "SlicerLeapModule Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # # Check box to enable creating output transforms automatically. # The function is useful for testing and initial creation of the transforms but not recommended when the # transforms are already in the scene. # self.enableAutoCreateTransformsCheckBox = qt.QCheckBox() self.enableAutoCreateTransformsCheckBox.checked = 0 self.enableAutoCreateTransformsCheckBox.setToolTip("If checked, then transforms are created automatically (not recommended when transforms exist in the scene already).") parametersFormLayout.addRow("Auto-create transforms", self.enableAutoCreateTransformsCheckBox) self.enableAutoCreateTransformsCheckBox.connect('stateChanged(int)', self.setEnableAutoCreateTransforms) # Add vertical spacer self.layout.addStretch(1)
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 = "ScriptedLoadableExtensionTemplate Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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
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 sampleFormLayout = qt.QFormLayout(sampleCollapsibleButton) # HelloWorld button # (Insert Section A text here) # (be sure to match indentation of the rest of this # code) helloWorldButton=qt.QPushButton("Hello world") helloWorldButton.toolTip="Print 'Hello world' in standard ouput." sampleFormLayout.addWidget(helloWorldButton) helloWorldButton.connect('clicked(bool)',self.onHelloWorldButtonClicked) # Add vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.helloWorldButton = helloWorldButton
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)
def setupSegmentation(self): self.segmentationCB = ctk.ctkCollapsibleButton() self.segmentationCB.text = "Step 4 : Segmentation" self.layout.addWidget(self.segmentationCB) # Layout within the dummy collapsible button segmentationCBLayout = qt.QFormLayout(self.segmentationCB) # input volume selector self.volumeCT = slicer.qMRMLNodeComboBox() self.volumeCT.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" ) self.volumeCT.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", 0 ) self.volumeCT.selectNodeUponCreation = True self.volumeCT.addEnabled = False self.volumeCT.removeEnabled = False self.volumeCT.noneEnabled = True self.volumeCT.showHidden = False self.volumeCT.showChildNodeTypes = False self.volumeCT.setMRMLScene( slicer.mrmlScene ) self.volumeCT.setToolTip( "Pick the input to the algorithm." ) segmentationCBLayout.addRow("Input Volume: ", self.volumeCT) # # Centered self.isFiducialCentered = qt.QRadioButton() self.segmentationButton = qt.QPushButton("Apply") self.segmentationButton.toolTip = "Run the algorithm." self.segmentationButton.enabled = True segmentationCBLayout.addRow(self.segmentationButton) # connections self.segmentationButton.connect('clicked(bool)', self.onSegmentationButton)
def setupDeveloperSection(self): if not self.developerMode: return # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "ScriptedLoadableModuleTemplate Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest)
def setup(self): # Instantiate and connect widgets ... import numpy # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" reloadCollapsibleButton.collapsed = True self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "PlaneFitting Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest)
def setup(self): """This is called one time when the module GUI is initialized """ ScriptedLoadableModuleWidget.setup(self) # Create objects that can be used anywhere in the module. Example: in most cases there should be just one # object of the logic class self.logic = CIP_BlankLogic() # Create all the widgets. Main Area mainAreaCollapsibleButton = ctk.ctkCollapsibleButton() mainAreaCollapsibleButton.text = "Main parameters" self.layout.addWidget(mainAreaCollapsibleButton) # Layout within the dummy collapsible button. See http://doc.qt.io/qt-4.8/layout.html for more info about layouts self.mainAreaLayout = qt.QFormLayout(mainAreaCollapsibleButton) # Example button with some common properties self.exampleButton = ctk.ctkPushButton() self.exampleButton.text = "Push me!" self.exampleButton.toolTip = "This is the button tooltip" self.exampleButton.setIcon(qt.QIcon("{0}/Reload.png".format(SlicerUtil.CIP_ICON_DIR))) self.exampleButton.setIconSize(qt.QSize(20,20)) self.exampleButton.setStyleSheet("font-weight:bold; font-size:12px" ) self.exampleButton.setFixedWidth(200) self.mainAreaLayout.addWidget(self.exampleButton) # Connections self.exampleButton.connect('clicked()', self.onApplyButton)
def setupSetup(self): #### Creazione del bottone collapsible self.setupCB = ctk.ctkCollapsibleButton() self.setupCB.text = "Step 1 : Configurations" #### Menu di set up aggiunto alla form globale self.layout.addWidget(self.setupCB) #### Creo un layout per questa paste self.setupFormLayout = qt.QFormLayout(self.setupCB) #### Bottone self.deetoB = qt.QToolButton() self.deetoB.setText("...") self.deetoB.toolTip = "Change deeto executable" self.deetoB.enabled = True self.deetoB.connect('clicked(bool)', self.onDeetoButton) #### Execution Line deetoPath = os.path.dirname(slicer.modules.DEETOInstance.parent.path) deetoExec = '../bin/deeto' self.deetoE = qt.QLineEdit(deetoExec) self.deetoE.setDisabled(True) self.deetoE.setMaximumWidth(100) self.deetoE.setFixedWidth(400) self.dialog = qt.QFileDialog() self.dialog.setFileMode(qt.QFileDialog.AnyFile) self.dialog.setToolTip( "Pick the input to the algorithm." ) #### deeto button layout self.deetoExecLayout = qt.QHBoxLayout() self.deetoExecLayout.addWidget(self.deetoE) self.deetoExecLayout.addWidget(self.deetoB) #### Aggiungo il bottone al layout self.setupFormLayout.addRow("DEETO executable: ", self.deetoExecLayout)
def setupFileExporter(self): self.fileExporterCB = ctk.ctkCollapsibleButton() self.fileExporterCB.text = "Step 6 : Export Fiducials" self.layout.addWidget(self.fileExporterCB) fileExporterLayout= qt.QFormLayout(self.fileExporterCB) self.fidsSelectorSplit = slicer.qMRMLNodeComboBox() self.fidsSelectorSplit.nodeTypes = ( ("vtkMRMLMarkupsFiducialNode"), "" ) self.fidsSelectorSplit.selectNodeUponCreation = False self.fidsSelectorSplit.addEnabled = False self.fidsSelectorSplit.removeEnabled = False self.fidsSelectorSplit.noneEnabled = True self.fidsSelectorSplit.setMRMLScene( slicer.mrmlScene ) self.fidsSelectorSplit.setToolTip("Select a fiducial list") fileExporterLayout.addRow("Fiducial : ", self.fidsSelectorSplit) splitButton = qt.QPushButton("Split") splitButton.setFixedWidth(60) splitButton.toolTip = " Separate fiducials in different files " splitButton.enabled = True fileExporterLayout.addRow(" Split? ",splitButton) # connections splitButton.connect('clicked(bool)',self.onSplitButtonClick) # Add vertical spacer self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Patient Information" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # Patient Number Box PatientNumberMethodFrame = qt.QFrame(self.parent) parametersFormLayout.addWidget(PatientNumberMethodFrame) PatientNumberMethodFormLayout = qt.QFormLayout(PatientNumberMethodFrame) PatientNumberIterationsFrame, self.PatientNumberIterationsSpinBox = numericInputFrame(self.parent,"Patient Number:","Tooltip",56,110,1,0) PatientNumberMethodFormLayout.addWidget(PatientNumberIterationsFrame) # 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) # Refresh Apply button state self.onSelect()
def __createGUI__(self): """Add the GUI components""" self.autoupdateCollapsibleButton = ctk.ctkCollapsibleButton() self.autoupdateCollapsibleButton.text = "Auto update" self.autoupdateCollapsibleButton.collapsed = True self.layout.addWidget(self.autoupdateCollapsibleButton) #self.mainLayout = qt.QHBoxLayout(self.autoupdateCollapsibleButton) self.mainLayout = qt.QFormLayout(self.autoupdateCollapsibleButton) self.checkAutoUpdate = qt.QCheckBox() self.checkAutoUpdate.checked = self.autoUpdate self.checkAutoUpdate.text = "Auto update CIP at startup" self.checkForceUpdate = qt.QCheckBox() self.checkForceUpdate.checked = False self.checkForceUpdate.text = "Force update" self.mainLayout.addRow(self.checkAutoUpdate, self.checkForceUpdate) self.btnUpdate = ctk.ctkPushButton() self.btnUpdate.text = "Update CIP now" self.mainLayout.addWidget(self.btnUpdate) self.btnUpdate.connect('clicked()', self.onbtnUpdateClicked) self.checkAutoUpdate.connect('stateChanged(int)', self.onCheckAutoUpdateClicked)
def setup(self): # Instantiate and connect widgets ... # Comment these out when not debugging # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "PythonMetricsCalculator Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest)
def setup(self): if slicer.app.commandOptions().noMainWindow: # don't build the widget if there's no place to put it return self.volumes = ctk.ctkCollapsibleButton() #self.volumes.setLayout(qt.QVBoxLayout()) self.volumes.setText("Quality control volume") self.framelayout.addWidget(self.volumes) volumeLayout=qt.QFormLayout(self.volumes) self.masterSelector = slicer.qMRMLNodeComboBox() self.masterSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] #self.masterSelector.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", 0 ) self.masterSelector.selectNodeUponCreation = False self.masterSelector.addEnabled = False self.masterSelector.removeEnabled = False self.masterSelector.noneEnabled = True self.masterSelector.showHidden = False self.masterSelector.showChildNodeTypes = False self.masterSelector.setMRMLScene( slicer.mrmlScene ) self.masterSelector.setToolTip( "Pick the master structural volume to performing quality controls" ) volumeLayout.addRow("Input Volume: ", self.masterSelector) # node selected self.masterSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.select)
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)
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 parametersCollapsibleLayout = qt.QVBoxLayout(parametersCollapsibleButton) self.table = qt.QTableWidget() self.table.setRowCount(1) self.table.setColumnCount(3) parametersCollapsibleLayout.addWidget(self.table) item = qt.QTableWidgetItem('Test'); self.table.setItem(0,0,item); self.items.append(item) # # input volume selector # # Add vertical spacer self.layout.addStretch(1)
def setupPlottingFrame(self, parent=None): self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupPlottingFrame(self, parent=plotFrameLayout)
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)
def createFeaturePanels(self): self.ultrasoundCollapsibleButton, self.ultrasoundLayout = self.ultrasound.setupPanel(self.sliceletPanelLayout) self.advancedCollapsibleButton = ctk.ctkCollapsibleButton() featurePanelList = [self.ultrasoundCollapsibleButton, self.advancedCollapsibleButton] return featurePanelList
def setup(self): # # test list # self.testList = ctk.ctkCollapsibleButton(self.parent) self.testList.setLayout(qt.QVBoxLayout()) self.testList.setText("Self Tests") self.layout.addWidget(self.testList) self.testList.collapsed = False self.runAll = qt.QPushButton("Run All") self.testList.layout().addWidget(self.runAll) self.runAll.connect('clicked()', self.onRunAll) self.testButtons = {} self.testMapper = qt.QSignalMapper() self.testMapper.connect('mapped(const QString&)', self.onRun) testKeys = slicer.selfTests.keys() testKeys.sort() for test in testKeys: self.testButtons[test] = qt.QPushButton(test) self.testButtons[test].setToolTip(slicer.selfTests[test].__doc__) self.testList.layout().addWidget(self.testButtons[test]) self.testMapper.setMapping(self.testButtons[test],test) self.testButtons[test].connect('clicked()', self.testMapper, 'map()') # Add spacer to layout self.layout.addStretch(1)
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 sampleFormLayout = qt.QFormLayout(sampleCollapsibleButton) self.layout.addStretch(1) labelSeleccionCargarGuardar = qt.QLabel("Desea cargar o guardar? ") #Se crea label para seleccion de tornillo a manipular sampleFormLayout.addWidget(labelSeleccionCargarGuardar) #Se añade label self.comboBoxSeleccionCargarGuardar = qt.QComboBox() #Se crea comboBox para seleccionar tornillo self.comboBoxSeleccionCargarGuardar.addItem("Cargar Scene") #Se añade opciones self.comboBoxSeleccionCargarGuardar.addItem("Guardar Scene") sampleFormLayout.addWidget(self.comboBoxSeleccionCargarGuardar) labelNombreScene = qt.QLabel("Nombre: ") #Se crea label para seleccion de tornillo a manipular sampleFormLayout.addWidget(labelNombreScene) self.nombreSceceTextEdit = qt.QLineEdit() self.nombreSceceTextEdit.textChanged.connect(self.textchanged1) sampleFormLayout.addWidget(self.nombreSceceTextEdit) self.cargarGuardarButton = qt.QPushButton("Cargar/Guardar Scene") #Se crea boton pulsable, con texto "Apply" sampleFormLayout.addWidget(self.cargarGuardarButton) #Se añade el boton al layout del boton colapsable self.cargarGuardarButton.connect('clicked(bool)',self.onApply3)
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)
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)
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 = "SlicerHands Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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) # Parameters button parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) # Layout within the parameters collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # start hand driver button startDriver = qt.QPushButton("Start Hand Driver") startDriver.toolTip = "Run the threegear hand driver" parametersFormLayout.addWidget(startDriver) startDriver.connect('clicked()', self.startDriver) # connect to the driver self.connectToHandsButton = qt.QPushButton("Connect to Hand Driver") self.connectToHandsButton.toolTip = "Connect to the threegear hand driver" parametersFormLayout.addWidget(self.connectToHandsButton) self.connectToHandsButton.connect('clicked()', self.connectToHands) # connect to the driver self.disconnectFromHandsButton = qt.QPushButton( "Disconnect from Hand Driver") self.disconnectFromHandsButton.toolTip = "Disconnect from the threegear hand driver" self.disconnectFromHandsButton.enabled = False parametersFormLayout.addWidget(self.disconnectFromHandsButton) self.disconnectFromHandsButton.connect('clicked()', self.disconnectFromHands) # update camera transform (temp) self.updateCameraButton = qt.QPushButton("UpdateCameraTransform") parametersFormLayout.addWidget(self.updateCameraButton) self.updateCameraButton.connect('clicked()', self.logic.updateCamera) # Add vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.startDriver = startDriver
def createFeaturePanels(self): featurePanelList = Guidelet.createFeaturePanels(self) # Create GUI panels. self.calibrationCollapsibleButton = ctk.ctkCollapsibleButton() self.addTumorContouringToUltrasoundPanel() self.navigationCollapsibleButton = ctk.ctkCollapsibleButton() self.setupCalibrationPanel() self.setupNavigationPanel() featurePanelList[len(featurePanelList):] = [ self.calibrationCollapsibleButton, self.navigationCollapsibleButton ] return featurePanelList
def createUserInterface(self): ''' ''' # self.buttonBoxHints = self.ButtonBoxHidden self.__layout = self.__parent.createUserInterface() self.__basicFrame = ctk.ctkCollapsibleButton() self.__basicFrame.text = "Basic settings" self.__basicFrame.collapsed = 0 basicFrameLayout = qt.QFormLayout(self.__basicFrame) self.__layout.addRow(self.__basicFrame) self.__advancedFrame = ctk.ctkCollapsibleButton() self.__advancedFrame.text = "Advanced settings" self.__advancedFrame.collapsed = 1 advFrameLayout = qt.QFormLayout(self.__advancedFrame) self.__layout.addRow(self.__advancedFrame) threshLabel = qt.QLabel('Choose threshold:') self.__threshRange = slicer.qMRMLRangeWidget() self.__threshRange.decimals = 0 self.__threshRange.singleStep = 1 self.__useThresholdsCheck = qt.QCheckBox() self.__useThresholdsCheck.setEnabled(0) threshCheckLabel = qt.QLabel('Use thresholds for segmentation') roiLabel = qt.QLabel('Select segmentation:') self.__roiLabelSelector = slicer.qMRMLNodeComboBox() self.__roiLabelSelector.nodeTypes = ('vtkMRMLScalarVolumeNode', '') self.__roiLabelSelector.addAttribute('vtkMRMLScalarVolumeNode', 'LabelMap', '1') self.__roiLabelSelector.toolTip = "Choose the ROI segmentation" self.__roiLabelSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__roiLabelSelector.addEnabled = 0 self.__roiLabelSelector.setMRMLScene(slicer.mrmlScene) basicFrameLayout.addRow(threshLabel, self.__threshRange) advFrameLayout.addRow(threshCheckLabel, self.__useThresholdsCheck) advFrameLayout.addRow(roiLabel, self.__roiLabelSelector) self.__threshRange.connect('valuesChanged(double,double)', self.onThresholdChanged) self.__useThresholdsCheck.connect('stateChanged(int)', self.onThresholdsCheckChanged)
def setupPlottingFrame(self, parent=None): self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupPlottingFrame( self, parent=plotFrameLayout)
def setup(self): ScriptedLoadableModuleWidget.setup(self) self.timeout = 3000 self.extensionFileDialog = None self.moduleFileDialog = None icon = self.parent.style().standardIcon(qt.QStyle.SP_ArrowForward) iconSize = qt.QSize(22, 22) def createToolButton(text): tb = qt.QToolButton() tb.text = text tb.icon = icon font = tb.font font.setBold(True) font.setPixelSize(14) tb.font = font tb.iconSize = iconSize tb.toolButtonStyle = qt.Qt.ToolButtonTextBesideIcon tb.autoRaise = True return tb # Instantiate and connect widgets ... # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Developer tools for extensions" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # Select extension to install self.extensionSelector = createToolButton("Install extension archive") self.extensionSelector.setToolTip("Select extension archive that\ has been locally created or manually downloaded") parametersFormLayout.addRow(self.extensionSelector) # Select script module to load self.moduleSelector = createToolButton("Load module") self.moduleSelector.setToolTip("Select a module you want to load in Slicer") parametersFormLayout.addRow(self.moduleSelector) # connections self.extensionSelector.connect('clicked(bool)', self.onExtensionSelect) self.moduleSelector.connect('clicked(bool)', self.onModuleSelect) # Add vertical spacer self.layout.addStretch(1) # Create logic self.logic = DeveloperToolsForExtensionsLogic()
def createFeaturePanels(self): # Create GUI panels. featurePanelList = Guidelet.createFeaturePanels(self) self.navigationCollapsibleButton = ctk.ctkCollapsibleButton() featurePanelList[len(featurePanelList):] = [ self.navigationCollapsibleButton ] return featurePanelList
def setupProjectionSection(self): projectionCollapsibleButton = ctk.ctkCollapsibleButton() projectionCollapsibleButton.text = "Projection" self.layout.addWidget(projectionCollapsibleButton) projectionLayout = qt.QVBoxLayout(projectionCollapsibleButton) projectionCollapsibleButton.collapsed = False self.openWindowButton = qt.QPushButton("OpenWindow") self.openWindowButton.toolTip = "Run the algorithm." self.openWindowButton.enabled = True projectionLayout.addWidget(self.openWindowButton)
def createClp(self, text, parentLayout, boxLayout): '''Create a collapsible button''' clpBtn = ctk.ctkCollapsibleButton() clpBtn.text = text parentLayout.addWidget(clpBtn) formLayout = qt.QFormLayout(clpBtn) formFrame = qt.QFrame(clpBtn) formFrame.setLayout(boxLayout) formLayout.addWidget(formFrame) return clpBtn, formLayout, formFrame
def createFeaturePanels(self): self.ultrasoundCollapsibleButton, self.ultrasoundLayout, self.procedureLayout = self.ultrasound.setupPanel( self.sliceletPanelLayout) self.advancedCollapsibleButton = ctk.ctkCollapsibleButton() featurePanelList = [ self.ultrasoundCollapsibleButton, self.advancedCollapsibleButton ] return featurePanelList
def setupDefinitionsSection(self): self.definitionsCollapsibleButton = ctk.ctkCollapsibleButton() self.definitionsCollapsibleButton.objectName = "Definitions" self.definitionsCollapsibleButton.text = "Definitions" self.definitionsCollapsibleButton.collapsed = False self.layout.addWidget(self.definitionsCollapsibleButton) definitionsFormLayout = qt.QGridLayout( self.definitionsCollapsibleButton) self.definitionsWidget = slicer.qSlicerWebWidget() definitionsFormLayout.addWidget(self.definitionsWidget)
def setup(self): ScriptedLoadableModuleWidget.setup(self) self.logic = ExtensionStatsLogic() self.logic.setStatusCallback(self.setStatusText) self.queryInProgress = False # Instantiate and connect widgets ... # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) self.extensionNameEdit = qt.QLineEdit() self.extensionNameEdit.setText('') parametersFormLayout.addRow("Extension name: ", self.extensionNameEdit) self.midasQueryUrlEdit = qt.QLineEdit() self.midasQueryUrlEdit.setText( 'http://slicer.kitware.com/midas3/api/json') parametersFormLayout.addRow("MIDAS json query URL: ", self.midasQueryUrlEdit) self.applyButton = qt.QPushButton("Get download statistics") self.applyButton.toolTip = "Get download statistics" parametersFormLayout.addRow(self.applyButton) self.statusText = qt.QLabel() parametersFormLayout.addRow("Status:", self.statusText) # Stats table self.statsTable = qt.QTableWidget() self.statsTable.setSelectionBehavior(qt.QAbstractItemView.SelectRows) parametersFormLayout.addRow("Statistics:", self.statsTable) self.statsTableHeader = ['Revision', 'Downloads'] policy = qt.QSizePolicy() policy.setVerticalStretch(1) policy.setHorizontalPolicy(qt.QSizePolicy.Expanding) policy.setVerticalPolicy(qt.QSizePolicy.Expanding) self.statsTable.setSizePolicy(policy) # Copy to clipboard button self.copyToClipboardButton = qt.QPushButton("Copy table to clipboard") parametersFormLayout.addRow('', self.copyToClipboardButton) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) self.copyToClipboardButton.connect('clicked()', self.copyTableToClipboard)
def setup(self): # Instantiate and connect widgets ... # # Reload and Test area # reloadCollapsibleButton = ctk.ctkCollapsibleButton() reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton) # 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 = "TCIABrowser Reload" reloadFormLayout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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." reloadFormLayout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # # Step 1: selection of the data directory # self.collectionSelector = qt.QComboBox() self.layout.addWidget(self.collectionSelector) self.collectionSelector.connect('currentIndexChanged(QString)', self.collectionSelected) self.studyTable = ItemTable(self.parent, headerName='Study Name') self.layout.addWidget(self.studyTable.widget) self.studyTable.widget.connect('cellClicked(int,int)', self.onStudyCellClicked) self.seriesTable = ItemTable(self.parent, headerName="Series Name") self.layout.addWidget(self.seriesTable.widget) self.loadButton = qt.QPushButton('Load series') self.layout.addWidget(self.loadButton) self.loadButton.connect('clicked()', self.onLoadButtonClicked) # Add vertical spacer self.layout.addStretch(1) # set up temporary directory self.tempDir = slicer.app.temporaryPath + '/TCIABrowser-tmp' print('Temporary directory location: ' + self.tempDir) qt.QDir().mkpath(self.tempDir)
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) # # input volume selector # self.inputSelector = slicer.qMRMLNodeComboBox() self.inputSelector.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" ) self.inputSelector.addAttribute( "vtkMRMLScalarVolumeNode", "LabelMap", 0 ) self.inputSelector.selectNodeUponCreation = True self.inputSelector.addEnabled = False self.inputSelector.removeEnabled = False self.inputSelector.noneEnabled = False self.inputSelector.showHidden = False self.inputSelector.showChildNodeTypes = False self.inputSelector.setMRMLScene( slicer.mrmlScene ) self.inputSelector.setToolTip( "Pick the input to the algorithm." ) parametersFormLayout.addRow("T2 Volume: ", self.inputSelector) # # Start Prostate Segmentation Button # self.applyButton = qt.QPushButton("Start Prostate Segmentation") self.applyButton.enabled = True parametersFormLayout.addRow(self.applyButton) # # Apply Segmentation # self.applyButton2 = qt.QPushButton("Apply Segmentation") self.applyButton2.toolTip = "Run the algorithm." self.applyButton2.enabled = True parametersFormLayout.addRow(self.applyButton2) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) self.applyButton2.connect('clicked(bool)', self.onApplyButton2) self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) # Add vertical spacer self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... #Display Region. Obtained from Subject Hierarchy displayCollapsibleButton = ctk.ctkCollapsibleButton() displayCollapsibleButton.text = "Display" self.layout.addWidget(displayCollapsibleButton) # Layout within the display collapsible button displayFormLayout = qt.QHBoxLayout() displayCollapsibleButton.setLayout(displayFormLayout) self.subjectHierarchyTreeView = slicer.qMRMLSubjectHierarchyTreeView() self.subjectHierarchyTreeView.setMRMLScene(slicer.app.mrmlScene()) self.subjectHierarchyTreeView.setColumnHidden( self.subjectHierarchyTreeView.sceneModel().idColumn, True) displayFormLayout.addWidget(self.subjectHierarchyTreeView) self.subjectHierarchyTreeView.connect( "currentNodeChanged(vtkMRMLNode*)", self.onSubjectHierarchyNodeSelect) #Properties Region self.displayPropertiesCollapsibleButton = ctk.ctkCollapsibleButton() self.displayPropertiesCollapsibleButton.text = "Display Properties" self.layout.addWidget(self.displayPropertiesCollapsibleButton) self.displayPropertiesCollapsibleButton.enabled = False # Layout within the display-properties collapsible button displayPropertiesFormLayout = qt.QHBoxLayout() self.displayPropertiesCollapsibleButton.setLayout( displayPropertiesFormLayout) # Volume display properties self.volumeDisplayWidget = slicer.qSlicerVolumeDisplayWidget() displayPropertiesFormLayout.addWidget(self.volumeDisplayWidget) self.volumeDisplayWidget.hide() #Spacial Objects display properties self.spacialObjectsWidget = slicer.qSlicerSpatialObjectsModuleWidget() displayPropertiesFormLayout.addWidget(self.spacialObjectsWidget) self.spacialObjectsWidget.hide()
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)
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 makeParametersButton(self): self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = 'Parameters' self.layout.addWidget(self.parametersCollapsibleButton) self.parametersLayout = qt.QVBoxLayout( self.parametersCollapsibleButton) self.parametersTabWidget = qt.QTabWidget() self.parametersLayout.addWidget(self.parametersTabWidget) self.makeTransformationTypeWidgets() self.makePyramidWidgets() self.makeThresholdsWidgets()
def createFeaturePanels(self): # Create GUI panels. self.calibrationCollapsibleButton = ctk.ctkCollapsibleButton() self.patientSetupPanel() featurePanelList = Guidelet.createFeaturePanels(self) featurePanelList[len(featurePanelList):] = [ self.calibrationCollapsibleButton ] return featurePanelList
def setupMainSection(self): self.mainCollapsibleButton = ctk.ctkCollapsibleButton() self.mainCollapsibleButton.text = "Main" self.layout.addWidget(self.mainCollapsibleButton) mainFormFrame = qt.QFrame() mainFormLayout = qt.QFormLayout(mainFormFrame) self.showTemplateCheckBox = qt.QCheckBox() self.showTemplateCheckBox.checked = 0 self.showTemplateCheckBox.setToolTip("Show 3D model of the template") mainFormLayout.addRow("Show Template:", self.showTemplateCheckBox) self.showTrajectoriesCheckBox = qt.QCheckBox() self.showTrajectoriesCheckBox.checked = 0 self.showTrajectoriesCheckBox.setToolTip("Show 3D model of the fiducial") mainFormLayout.addRow("Show Trajectories:", self.showTrajectoriesCheckBox) self.transformSelector = self.createComboBox(nodeTypes=["vtkMRMLLinearTransformNode", ""], noneEnabled=False, selectNodeUponCreation=True, showChildNodeTypes=False) mainFormLayout.addRow("Input Transform: ", self.transformSelector) self.inputVolumeSelector = self.createComboBox(nodeTypes=["vtkMRMLScalarVolumeNode", ""], noneEnabled=False, selectNodeUponCreation=True, showChildNodeTypes=False) mainFormLayout.addRow("Input Volume: ", self.inputVolumeSelector) self.targetFiducialsSelector = self.createComboBox(nodeTypes=["vtkMRMLMarkupsFiducialNode", ""], noneEnabled=False, selectNodeUponCreation=True, showChildNodeTypes=False, addEnabled=True, removeEnabled=True, showHidden=False, toolTip="Select Markups for targets") mainFormLayout.addRow("Targets: ", self.targetFiducialsSelector) self.targetFiducialsNode = None # # Target List Table # self.table = qt.QTableWidget(1, 4) self.table.setSelectionBehavior(qt.QAbstractItemView.SelectRows) self.table.setSelectionMode(qt.QAbstractItemView.SingleSelection) # self.table.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self.headers = ["Name", "Hole", "Depth (mm)", "Position (RAS)"] self.table.setHorizontalHeaderLabels(self.headers) self.table.horizontalHeader().setStretchLastSection(True) mainLayout = qt.QVBoxLayout(self.mainCollapsibleButton) mainLayout.addWidget(mainFormFrame) mainLayout.addWidget(self.table)
def setup(self): print ("setup") # Collapsible button self.sampleCollapsibleButton = ctk.ctkCollapsibleButton() self.sampleCollapsibleButton.text = "A collapsible button" self.layout.addWidget(self.sampleCollapsibleButton) self.sampleFormLayout = qt.QFormLayout(self.sampleCollapsibleButton) self.btnBeginPlacingLandmarks = qt.QPushButton("Begin Placing") self.btnBeginPlacingLandmarks.toolTip = "Placing Anatomical Landmarks" self.sampleFormLayout.addWidget(self.btnBeginPlacingLandmarks) self.btnBeginPlacingLandmarks.connect('clicked(bool)', self.beginPlacing) self.layout.addStretch(1) markup = slicer.modules.markups.logic() markup.AddNewFiducialNode() self.table = qt.QTableWidget() self.table.setRowCount(1) self.table.setColumnCount(5) self.table.horizontalHeader().setResizeMode(qt.QHeaderView.Stretch) self.table.setSizePolicy (qt.QSizePolicy.MinimumExpanding, qt.QSizePolicy.Preferred) self.table.setMinimumWidth(400) self.table.setMinimumHeight(215) self.table.setMaximumHeight(215) horizontalHeaders = ["Landmark", "Fiducial ID", "x", "y", "z"] self.table.setHorizontalHeaderLabels(horizontalHeaders) self.table.itemSelectionChanged.connect(self.onTableCellClicked) self.sampleFormLayout.addWidget(self.table) self.deleteFid = qt.QPushButton("Delete Selected Fiducial") self.deleteFid.connect('clicked(bool)', self.deleteFiducial) #self.sampleFormLayout.addWidget(self.deleteFid) fiducialNode = slicer.mrmlScene.GetNodeByID('vtkMRMLMarkupsFiducialNode1') self.fidObserve = fiducialNode.AddObserver(vtk.vtkCommand.ModifiedEvent, self.placeFiducialAsLandmark) self.btnComputeSplines = qt.QPushButton("Compute Splines") self.btnComputeSplines.toolTip = "" self.sampleFormLayout.addWidget(self.btnComputeSplines) self.btnComputeSplines.connect('clicked(bool)', self.computeSplines) self.btnExportSplines = qt.QPushButton("Export Splines") self.btnExportSplines.toolTip = "" self.sampleFormLayout.addWidget(self.btnExportSplines) self.btnExportSplines.connect('clicked(bool)', self.exportSplines) self.initializeTable()
def setup(self): # Point Distance controlCollapseButton = ctk.ctkCollapsibleButton() controlCollapseButton.text = "Control" self.layout.addWidget(controlCollapseButton) controlLayout = qt.QFormLayout(controlCollapseButton) self.nodeSelector = slicer.qMRMLNodeComboBox() self.nodeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.nodeSelector.selectNodeUponCreation = False self.nodeSelector.noneEnabled = False self.nodeSelector.addEnabled = False self.nodeSelector.showHidden = False self.nodeSelector.setMRMLScene(slicer.mrmlScene) self.nodeSelector.setToolTip("Pick Continuous Label Map") controlLayout.addRow("LabelMap Node:", self.nodeSelector) self.newNodeSelector = slicer.qMRMLNodeComboBox() self.newNodeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.newNodeSelector.selectNodeUponCreation = True self.newNodeSelector.noneEnabled = False self.newNodeSelector.addEnabled = True self.newNodeSelector.showHidden = False self.newNodeSelector.setMRMLScene(slicer.mrmlScene) self.newNodeSelector.setToolTip("Pick Node for Binned Label Map") controlLayout.addRow("New Node:", self.newNodeSelector) self.lowLabelSpinBox = qt.QSpinBox() self.lowLabelSpinBox.setSingleStep(1) self.lowLabelSpinBox.setValue(1) controlLayout.addRow("Label under threshold value:", self.lowLabelSpinBox) self.thresholdSpinBox = qt.QDoubleSpinBox() self.thresholdSpinBox.setMaximum(1.0) self.thresholdSpinBox.setMinimum(-1.0) self.thresholdSpinBox.setDecimals(5) self.thresholdSpinBox.setSingleStep(0.0001) self.thresholdSpinBox.setValue(0.7) controlLayout.addRow("Threshold value:", self.thresholdSpinBox) self.highLabelSpinBox = qt.QSpinBox() self.highLabelSpinBox.setSingleStep(1) self.highLabelSpinBox.setValue(0) controlLayout.addRow("Label over threshold value:", self.highLabelSpinBox) self.applyButton = qt.QPushButton("Apply") controlLayout.addRow(self.applyButton) self.applyButton.connect('clicked(bool)', self.onApply)
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 = "JRC2013Vis Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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) # start/stop DICOM peer self.startStopDicomPeerButton = qt.QPushButton("Start/Stop DICOM peer") self.startStopDicomPeerButton.setCheckable(True) self.layout.addWidget(self.startStopDicomPeerButton) self.startStopDicomPeerButton.connect('toggled(bool)', self.onStartStopDicomPeer) # 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: DICOM", self.onPart1DICOM), ("Part 2: Head", self.onPart2Head), ("Part 3: Liver", self.onPart3Liver), ("Part 4: Lung", self.onPart4Lung), ) 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)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Patient Information" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) patientNumberMethodFrame = qt.QFrame(self.parent) parametersFormLayout.addRow(patientNumberMethodFrame) patientNumberMethodFormLayout = qt.QFormLayout(patientNumberMethodFrame) dataFrame = qt.QFrame(self.parent) dataFrameLayout = qt.QHBoxLayout() dataFrame.setLayout(dataFrameLayout) dataLabel = qt.QLabel('Data Directory:', dataFrame) dataLabel.setToolTip('Data directory containing "Patient##"') dataFrameLayout.addWidget(dataLabel) self.DataDirectoryButton = ctk.ctkDirectoryButton(self.parent) dataFrameLayout.addWidget(self.DataDirectoryButton) patientNumberMethodFormLayout.addRow(dataFrame) patientNumberIterationsFrame, self.PatientNumberIterationsSpinBox = \ numericInputFrame(self.parent, "Patient Number:" , "Tooltip", 59, 110, 1, 0) patientNumberMethodFormLayout.addRow(patientNumberIterationsFrame) # 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) # Refresh Apply button state self.onSelect()
def create(self, registationState): """Make the plugin-specific user interface""" super(LocalBRAINSFitPlugin, self).create(registationState) self.LocalBRAINSFitMode = "Small" self.VerboseMode = "Quiet" # # Local Refinment Pane - initially hidden # - interface options for linear registration # self.LocalBRAINSFitCollapsibleButton = ctk.ctkCollapsibleButton() self.LocalBRAINSFitCollapsibleButton.text = "Local BRAINSFit" LocalBRAINSFitFormLayout = qt.QFormLayout() self.LocalBRAINSFitCollapsibleButton.setLayout( LocalBRAINSFitFormLayout) self.widgets.append(self.LocalBRAINSFitCollapsibleButton) buttonLayout = qt.QVBoxLayout() self.LocalBRAINSFitModeButtons = {} self.LocalBRAINSFitModes = ("Small", "Large") for mode in self.LocalBRAINSFitModes: self.LocalBRAINSFitModeButtons[mode] = qt.QRadioButton() self.LocalBRAINSFitModeButtons[mode].text = mode self.LocalBRAINSFitModeButtons[mode].setToolTip( "Run the refinement in a %s local region." % mode.lower()) buttonLayout.addWidget(self.LocalBRAINSFitModeButtons[mode]) self.widgets.append(self.LocalBRAINSFitModeButtons[mode]) self.LocalBRAINSFitModeButtons[mode].connect( 'clicked()', lambda m=mode: self.onLocalBRAINSFitMode(m)) self.LocalBRAINSFitModeButtons[self.LocalBRAINSFitMode].checked = True LocalBRAINSFitFormLayout.addRow("Local BRAINSFit Mode ", buttonLayout) buttonLayout = qt.QVBoxLayout() self.VerboseModeButtons = {} self.VerboseModes = ("Quiet", "Verbose") for mode in self.VerboseModes: self.VerboseModeButtons[mode] = qt.QRadioButton() self.VerboseModeButtons[mode].text = mode self.VerboseModeButtons[mode].setToolTip( "Run the refinement in %s mode." % mode.lower()) buttonLayout.addWidget(self.VerboseModeButtons[mode]) self.widgets.append(self.VerboseModeButtons[mode]) self.VerboseModeButtons[mode].connect( 'clicked()', lambda m=mode: self.onVerboseMode(m)) self.VerboseModeButtons[self.VerboseMode].checked = True LocalBRAINSFitFormLayout.addRow("Verbose Mode ", buttonLayout) self.parent.layout().addWidget(self.LocalBRAINSFitCollapsibleButton)
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)
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) # # Configuration Selection # self.configPathEdit = ctk.ctkPathLineEdit() self.configPathEdit.toolTip = "A json file in the format described in the help tab above." parametersFormLayout.addRow('Config File', self.configPathEdit) self.targetDirectoryButton = ctk.ctkDirectoryButton() self.targetDirectoryButton.directory = slicer.app.temporaryPath self.targetDirectoryButton.toolTip = "Where you want the customized Slicer application to be created. By default it is the current Slicer temporary directory." parametersFormLayout.addRow('Target Directory', self.targetDirectoryButton) # # Apply Button # self.applyButton = qt.QPushButton("Generate") self.applyButton.toolTip = "Generate the Custom Slicer." parametersFormLayout.addRow(self.applyButton) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) # Possible use for error messages self.message = qt.QErrorMessage() self.message.setWindowTitle("CustomSlicerGenerator") # Add vertical spacer self.layout.addStretch(1) self.logic = CustomSlicerGeneratorLogic() # QPushButton used for signal connection between widget and logic self.myQObject = qt.QPushButton() self.myQObject.connect('clicked(bool)', self.doneGenerating)
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 = "AtlasTests Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # 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 atlasTests = ctk.ctkCollapsibleButton() atlasTests.text = "Atlas Tests" self.layout.addWidget(atlasTests) # Layout within the dummy collapsible button dummyFormLayout = qt.QFormLayout(atlasTests) # run Abdominal Test self.abdominalAtlas = qt.QPushButton("Run Abdominal Test") self.abdominalAtlas.toolTip = "Downloads abdominal atlas and loads it." dummyFormLayout.addWidget(self.abdominalAtlas) self.abdominalAtlas.connect('clicked(bool)', self.onAbdominalAtlas) # run brain Test self.brainAtlas = qt.QPushButton("Run Brain Test") self.brainAtlas.toolTip = "Downloads brain atlas and loads it." dummyFormLayout.addWidget(self.brainAtlas) self.brainAtlas.connect('clicked(bool)', self.onBrainAtlas) # run knee Test self.kneeAtlas = qt.QPushButton("Run Knee Test") self.kneeAtlas.toolTip = "Downloads knee atlas and loads it." dummyFormLayout.addWidget(self.kneeAtlas) self.kneeAtlas.connect('clicked(bool)', self.onKneeAtlas) # Add vertical spacer self.layout.addStretch(1)
def makeInputsButton(self): self.inputsCollapsibleButton = ctk.ctkCollapsibleButton() self.inputsCollapsibleButton.text = 'Inputs' self.layout.addWidget(self.inputsCollapsibleButton) self.inputsLayout = qt.QFormLayout(self.inputsCollapsibleButton) # Reference self.referenceSelector = slicer.qMRMLNodeComboBox() self.referenceSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.referenceSelector.selectNodeUponCreation = False self.referenceSelector.addEnabled = False self.referenceSelector.removeEnabled = True self.referenceSelector.noneEnabled = False self.referenceSelector.showHidden = False self.referenceSelector.showChildNodeTypes = True self.referenceSelector.setMRMLScene(slicer.mrmlScene) self.referenceSelector.currentNodeChanged.connect(self.onInputModified) self.inputsLayout.addRow("Reference: ", self.referenceSelector) # Floating self.floatingSelector = slicer.qMRMLNodeComboBox() self.floatingSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.floatingSelector.selectNodeUponCreation = False self.floatingSelector.addEnabled = False self.floatingSelector.removeEnabled = True self.floatingSelector.noneEnabled = False self.floatingSelector.showHidden = True self.floatingSelector.showChildNodeTypes = True self.floatingSelector.setMRMLScene(slicer.mrmlScene) self.floatingSelector.currentNodeChanged.connect(self.onInputModified) self.inputsLayout.addRow("Floating: ", self.floatingSelector) # Initial transform self.initialTransformSelector = slicer.qMRMLNodeComboBox() self.initialTransformSelector.nodeTypes = ["vtkMRMLTransformNode"] self.initialTransformSelector.selectNodeUponCreation = True self.initialTransformSelector.addEnabled = False self.initialTransformSelector.removeEnabled = True self.initialTransformSelector.noneEnabled = True self.initialTransformSelector.showHidden = False self.initialTransformSelector.showChildNodeTypes = True self.initialTransformSelector.setMRMLScene(slicer.mrmlScene) self.initialTransformSelector.baseName = 'Initial transform' self.initialTransformSelector.currentNodeChanged.connect( self.onInputModified) self.inputsLayout.addRow("Initial transform: ", self.initialTransformSelector)