def setup(self): # # Editor Volumes # # only if showing volumes if self.showVolumesFrame: self.volumes = ctk.ctkCollapsibleButton(self.parent) self.volumes.setLayout(qt.QVBoxLayout()) self.volumes.setText("Create and Select Label Maps") self.layout.addWidget(self.volumes) else: self.volumes = None # create the helper box - note this isn't a Qt widget # but a helper class that creates Qt widgets in the given parent if self.showVolumesFrame: self.helper = EditorLib.HelperBox(self.volumes) else: self.helper = None # # Tool Frame # # (we already have self.parent for the parent widget, and self.layout for the layout) # create the frames for the EditColor, toolsOptionsFrame and EditBox # create collapsible button for entire "edit label maps" section self.editLabelMapsFrame = ctk.ctkCollapsibleButton(self.parent) self.editLabelMapsFrame.setLayout(qt.QVBoxLayout()) self.editLabelMapsFrame.setText("Edit Selected Label Map") self.layout.addWidget(self.editLabelMapsFrame) self.editLabelMapsFrame.collapsed = True # add a callback to collapse/open the frame based on the validity of the label volume self.helper.mergeValidCommand = self.updateLabelFrame # create frame holding both the effect options and edit box: self.effectsToolsFrame = qt.QFrame(self.editLabelMapsFrame) self.effectsToolsFrame.setLayout(qt.QHBoxLayout()) self.editLabelMapsFrame.layout().addStretch(1) self.editLabelMapsFrame.layout().addWidget(self.effectsToolsFrame) # create frame for effect options self.createEffectOptionsFrame() # create and add frame for EditBox self.createEditBox() # create and add EditColor directly to "edit label map" section self.toolsColor = EditorLib.EditColor(self.editLabelMapsFrame) # put the tool options below the color selector self.editLabelMapsFrame.layout().addWidget(self.effectOptionsFrame) # Add spacer to layout 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 = "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): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # Collapsible button testsCollapsibleButton = ctk.ctkCollapsibleButton() testsCollapsibleButton.text = "Tests" self.layout.addWidget(testsCollapsibleButton) # Layout within the collapsible button formLayout = qt.QFormLayout(testsCollapsibleButton) # test buttons tests = ( ("Part 1 : Ruler", self.onPart1Ruler),("Part 2: ChangeTracker", self.onPart2ChangeTracker),("Part 3 : PETCT", self.onPart3PETCT) ) for text,slot in tests: testButton = qt.QPushButton(text) testButton.toolTip = "Run the test." formLayout.addWidget(testButton) testButton.connect('clicked(bool)', slot) # A collapsible button to hide screen shot options screenShotsCollapsibleButton = ctk.ctkCollapsibleButton() screenShotsCollapsibleButton.text = "Screen shot options" self.layout.addWidget(screenShotsCollapsibleButton) # layout within the collapsible button screenShotsFormLayout = qt.QFormLayout(screenShotsCollapsibleButton) # # check box to trigger taking screen shots for later use in tutorials # self.enableScreenshotsFlagCheckBox = qt.QCheckBox() self.enableScreenshotsFlagCheckBox.checked = 0 self.enableScreenshotsFlagCheckBox.setToolTip("If checked, take screen shots for tutorials. Use Save Data to write them to disk.") screenShotsFormLayout.addRow("Enable Screenshots", self.enableScreenshotsFlagCheckBox) # # scale factor for screen shots # self.screenshotScaleFactorSliderWidget = ctk.ctkSliderWidget() self.screenshotScaleFactorSliderWidget.singleStep = 1.0 self.screenshotScaleFactorSliderWidget.minimum = 1.0 self.screenshotScaleFactorSliderWidget.maximum = 50.0 self.screenshotScaleFactorSliderWidget.value = 1.0 self.screenshotScaleFactorSliderWidget.setToolTip("Set scale factor for the screen shots.") screenShotsFormLayout.addRow("Screenshot scale factor", self.screenshotScaleFactorSliderWidget) # Add vertical spacer self.layout.addStretch(1)
def setup(self): # 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 = "DataProbe 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) settingsCollapsibleButton = ctk.ctkCollapsibleButton() settingsCollapsibleButton.text = "Slice View Annotations Settings" self.layout.addWidget(settingsCollapsibleButton) settingsVBoxLayout = qt.QVBoxLayout(settingsCollapsibleButton) dataProbeInstance = slicer.modules.DataProbeInstance if dataProbeInstance.infoWidget: sliceAnnotationsFrame = dataProbeInstance.infoWidget.sliceAnnotations.window settingsVBoxLayout.addWidget(sliceAnnotationsFrame) self.parent.layout().addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # # Parameters Area # controllerCollapsibleButton = ctk.ctkCollapsibleButton() controllerCollapsibleButton.text = "Controller" self.layout.addWidget(controllerCollapsibleButton) # Layout within the dummy collapsible button controllerFormLayout = qt.QFormLayout(controllerCollapsibleButton) # Start Button self.startButton = qt.QPushButton("Start") self.startButton.toolTip = "Start running the Leap" self.startButton.connect('clicked()',self.onStartButton) controllerFormLayout.addWidget(self.startButton) # Start Button self.stopButton = qt.QPushButton("Stop") self.stopButton.toolTip = "Stop running the Leap" self.stopButton.connect('clicked()',self.onStopButton) controllerFormLayout.addWidget(self.stopButton)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # 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) self.logic = LeapControllerLogic() controllerCollapsibleButton = ctk.ctkCollapsibleButton() controllerCollapsibleButton.text = 'Controller' self.layout.addWidget(controllerCollapsibleButton) controllerFormLayout = qt.QFormLayout(controllerCollapsibleButton) self.startButton = qt.QPushButton('Start') self.startButton.toolTip = 'Start running the Leap' self.startButton.connect('clicked()', self.onStartButton) controllerFormLayout.addWidget(self.startButton) self.stopButton = qt.QPushButton('Stop') self.stopButton.toolTip = 'Stop running the Leap' self.stopButton.connect('clicked()', self.onStopButton) controllerFormLayout.addWidget(self.stopButton) self.radioFree = qt.QRadioButton('Free Rotation') self.radioFree.connect('clicked()', self.onFreeRotate) self.radioFree.checked = True self.radioXY = qt.QRadioButton('Lock XY') self.radioXY.connect('clicked()', self.onLockXY) self.radioXZ = qt.QRadioButton('Lock XZ') self.radioXZ.connect('clicked()', self.onLockXZ) self.radioYZ = qt.QRadioButton('Lock YZ') self.radioYZ.connect('clicked()', self.onLockYZ) controllerFormLayout.addWidget(self.radioFree) controllerFormLayout.addWidget(self.radioXY) controllerFormLayout.addWidget(self.radioXZ) controllerFormLayout.addWidget(self.radioYZ)
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 setupDeveloperSection(self): if not self.developerMode: return def createHLayout(elements): rowLayout = qt.QHBoxLayout() for element in elements: rowLayout.addWidget(element) return rowLayout # # Reload and Test area # Used during development, but hidden when delivering # developer mode is turned off. self.reloadCollapsibleButton = ctk.ctkCollapsibleButton() self.reloadCollapsibleButton.text = "Reload && Test" self.layout.addWidget(self.reloadCollapsibleButton) reloadFormLayout = qt.QFormLayout(self.reloadCollapsibleButton) # reload button self.reloadButton = qt.QPushButton("Reload") self.reloadButton.toolTip = "Reload this module." self.reloadButton.name = "ScriptedLoadableModuleTemplate Reload" self.reloadButton.connect('clicked()', self.onReload) # reload and test button self.reloadAndTestButton = qt.QPushButton("Reload and Test") self.reloadAndTestButton.toolTip = "Reload this module and then run the self tests." self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # edit python source code self.editSourceButton = qt.QPushButton("Edit") self.editSourceButton.toolTip = "Edit the module's source code." self.editSourceButton.connect('clicked()', self.onEditSource) self.editModuleUiButton = None moduleUiFileName = self.resourcePath('UI/%s.ui' % self.moduleName) print(moduleUiFileName) import os.path if os.path.isfile(moduleUiFileName): # Module UI file exists self.editModuleUiButton = qt.QPushButton("Edit UI") self.editModuleUiButton.toolTip = "Edit the module's .ui file." self.editModuleUiButton.connect('clicked()', lambda filename=moduleUiFileName: slicer.util.startQtDesigner(moduleUiFileName)) # restart Slicer button # (use this during development, but remove it when delivering # your module to users) self.restartButton = qt.QPushButton("Restart Slicer") self.restartButton.toolTip = "Restart Slicer" self.restartButton.name = "ScriptedLoadableModuleTemplate Restart" self.restartButton.connect('clicked()', slicer.app.restart) if self.editModuleUiButton: # There are many buttons, distribute them in two rows reloadFormLayout.addRow(createHLayout([self.reloadButton, self.reloadAndTestButton, self.restartButton])) reloadFormLayout.addRow(createHLayout([self.editSourceButton, self.editModuleUiButton])) else: reloadFormLayout.addRow(createHLayout([self.reloadButton, self.reloadAndTestButton, self.editSourceButton, self.restartButton]))
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): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # 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 create(self,registationState): """Make the plugin-specific user interface""" super(AffinePlugin,self).create(registationState) self.linearMode = "Rigid" # # Linear Registration Pane - initially hidden # - interface options for linear registration # - TODO: move registration code into separate plugins # self.linearCollapsibleButton = ctk.ctkCollapsibleButton() self.linearCollapsibleButton.text = "Linear Registration" linearFormLayout = qt.QFormLayout() self.linearCollapsibleButton.setLayout(linearFormLayout) self.widgets.append(self.linearCollapsibleButton) buttonLayout = qt.QVBoxLayout() self.linearModeButtons = {} self.linearModes = ("Rigid", "Similarity", "Affine") for mode in self.linearModes: self.linearModeButtons[mode] = qt.QRadioButton() self.linearModeButtons[mode].text = mode self.linearModeButtons[mode].setToolTip( "Run the registration in %s mode." % mode ) buttonLayout.addWidget(self.linearModeButtons[mode]) self.widgets.append(self.linearModeButtons[mode]) self.linearModeButtons[mode].connect('clicked()', lambda m=mode : self.onLinearTransform(m)) self.linearModeButtons[self.linearMode].checked = True linearFormLayout.addRow("Registration Mode ", buttonLayout) self.parent.layout().addWidget(self.linearCollapsibleButton)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Widget sampleCollasibleBtn = ctk.ctkCollapsibleButton() sampleCollasibleBtn.text = "A Collapsible Button" self.layout.addWidget(sampleCollasibleBtn) # Layout sampleFormLayout = qt.QFormLayout(sampleCollasibleBtn) # Example Button helloWorldBtn = qt.QPushButton("Hello World!") helloWorldBtn.toolTip = 'Print "Hello World" in standard output' sampleFormLayout.addWidget(helloWorldBtn) helloWorldBtn.connect('clicked()', self.onHelloWorldBtnClicked) # Button for Texture Mapped Plane textureBtn = qt.QPushButton("Add Texture Mapped Plane") textureBtn.toolTip = "Add a texture mapped plane to the scene as a model" sampleFormLayout.addWidget(textureBtn) textureBtn.connect('clicked()', self.onTextureBtnClicked) # Vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.helloWorldBtn = helloWorldBtn self.textureBtn = textureBtn
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 setup(self): ScriptedLoadableModuleWidget.setup(self) # [TODO] # Si potrebbe avere un file di configurazione che contiene eventualmente un path alla colorlut # Se non e'vuoto allora lo prendo se no prendo questo di default self.lutPath = os.path.join(slicer.app.slicerHome, "share/FreeSurfer/FreeSurferColorLUT20120827.txt") print self.lutPath # [END TODO] self.zonedetectionCB = ctk.ctkCollapsibleButton() self.zonedetectionCB.text = "Brain Zone Detection" self.layout.addWidget(self.zonedetectionCB) self.zoneDetectionLayout = qt.QFormLayout(self.zonedetectionCB) ### Select Atlas self.atlasInputSelector = slicer.qMRMLNodeComboBox() self.atlasInputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "") self.atlasInputSelector.addAttribute("vtkMRMLScalarVolumeNode", "LabelMap", 0) self.atlasInputSelector.selectNodeUponCreation = True self.atlasInputSelector.addEnabled = False self.atlasInputSelector.removeEnabled = False self.atlasInputSelector.noneEnabled = True self.atlasInputSelector.showHidden = False self.atlasInputSelector.showChildNodeTypes = False self.atlasInputSelector.setMRMLScene(slicer.mrmlScene) self.atlasInputSelector.setToolTip("Pick the volumetric Atlas.") self.zoneDetectionLayout.addRow("Volumetric parcels: ", self.atlasInputSelector) self.dialog = qt.QFileDialog() self.dialog.setFileMode(qt.QFileDialog.AnyFile) self.dialog.setToolTip("Pick the input to the algorithm.") self.fidsSelectorZone = slicer.qMRMLNodeComboBox() self.fidsSelectorZone.nodeTypes = (("vtkMRMLMarkupsFiducialNode"), "") self.fidsSelectorZone.selectNodeUponCreation = False self.fidsSelectorZone.addEnabled = False self.fidsSelectorZone.removeEnabled = False self.fidsSelectorZone.noneEnabled = True self.fidsSelectorZone.setMRMLScene(slicer.mrmlScene) self.fidsSelectorZone.setToolTip("Select a fiducial list") self.zoneDetectionLayout.addRow("Fiducial : ", self.fidsSelectorZone) self.ROISize = qt.QLineEdit("7") self.ROISize.setToolTip("Define side length of cubic region centered in contact centroid") self.ROISize.setInputMask("D") # Run Zone Detection button self.zoneButton = qt.QPushButton("Apply") self.zoneButton.toolTip = "Run the algorithm." self.zoneButton.enabled = True self.zoneDetectionLayout.addRow("Cubic Region Side Length:", self.ROISize) self.zoneDetectionLayout.addRow(self.zoneButton) # connections self.zoneButton.connect("clicked(bool)", self.onZoneButton)
def setup(self): ScriptedLoadableModuleWidget.setup(self) self.testsCollapsibleButton = ctk.ctkCollapsibleButton() self.testsCollapsibleButton.setLayout(qt.QFormLayout()) self.testsCollapsibleButton.text = "Quantitative Reporting Tests" self.layout.addWidget(self.testsCollapsibleButton) self.generateButtons()
def create(self,registrationState): """Make the plugin-specific user interface""" super(LocalSimpleITKPlugin,self).create(registrationState) # To avoid the overhead of importing SimpleITK during application # startup, the import of SimpleITK is delayed until it is needed. global sitk import SimpleITK as sitk global sitkUtils import sitkUtils print("LocalSimpleITKPlugin.create") self.LocalSimpleITKMode = "Small" self.VerboseMode = "Quiet" # # Local Refinment Pane - initially hidden # - interface options for linear registration # localSimpleITKCollapsibleButton = ctk.ctkCollapsibleButton() localSimpleITKCollapsibleButton.text = "Local SimpleITK" localSimpleITKFormLayout = qt.QFormLayout() localSimpleITKCollapsibleButton.setLayout(localSimpleITKFormLayout) self.widgets.append(localSimpleITKCollapsibleButton) buttonGroup = qt.QButtonGroup() self.widgets.append(buttonGroup) buttonLayout = qt.QVBoxLayout() localSimpleITKModeButtons = {} self.LocalSimpleITKModes = ("Small", "Large") for mode in self.LocalSimpleITKModes: localSimpleITKModeButtons[mode] = qt.QRadioButton() localSimpleITKModeButtons[mode].text = mode localSimpleITKModeButtons[mode].setToolTip( "Run the refinement in a %s local region." % mode.lower() ) buttonLayout.addWidget(localSimpleITKModeButtons[mode]) buttonGroup.addButton(localSimpleITKModeButtons[mode]) self.widgets.append(localSimpleITKModeButtons[mode]) localSimpleITKModeButtons[mode].connect('clicked()', lambda m=mode : self.onLocalSimpleITKMode(m)) localSimpleITKModeButtons[self.LocalSimpleITKMode].checked = True localSimpleITKFormLayout.addRow("Local SimpleITK Mode ", buttonLayout) buttonGroup = qt.QButtonGroup() self.widgets.append(buttonGroup) buttonLayout = qt.QVBoxLayout() verboseModeButtons = {} self.VerboseModes = ("Quiet", "Verbose", "Full Verbose") for mode in self.VerboseModes: verboseModeButtons[mode] = qt.QRadioButton() verboseModeButtons[mode].text = mode verboseModeButtons[mode].setToolTip( "Run the refinement in %s mode." % mode.lower() ) buttonLayout.addWidget(verboseModeButtons[mode]) buttonGroup.addButton(verboseModeButtons[mode]) self.widgets.append(verboseModeButtons[mode]) verboseModeButtons[mode].connect('clicked()', lambda m=mode : self.onVerboseMode(m)) verboseModeButtons[self.VerboseMode].checked = True localSimpleITKFormLayout.addRow("Verbose Mode ", buttonLayout) self.parent.layout().addWidget(localSimpleITKCollapsibleButton)
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 = ["vtkMRMLVectorVolumeNode"] 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 histogram." ) parametersFormLayout.addRow("Input Volume: ", self.inputSelector) # # check box to trigger taking screen shots for later use in tutorials # self.enableScreenshotsFlagCheckBox = qt.QCheckBox() self.enableScreenshotsFlagCheckBox.checked = 0 self.enableScreenshotsFlagCheckBox.setToolTip("If checked, take screen shots for tutorials. Use Save Data to write them to disk.") parametersFormLayout.addRow("Enable Screenshots", self.enableScreenshotsFlagCheckBox) # # Apply Button # self.applyButton = qt.QPushButton("Apply") self.applyButton.toolTip = "Run the algorithm." self.applyButton.enabled = False parametersFormLayout.addRow(self.applyButton) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) # Add vertical spacer self.layout.addStretch(1) # Refresh Apply button state self.onSelect()
def createFeaturePanels(self): # Create GUI panels. self.transformsCollapsibleButton = ctk.ctkCollapsibleButton() self.setupMainPanel() featurePanelList = Guidelet.createFeaturePanels(self) #Due to this, Transforms collapsible button can't be collapsed... featurePanelList = [self.transformsCollapsibleButton] return featurePanelList
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 = ["vtkMRMLLabelMapVolumeNode"] 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 create(self,registrationState): """Make the plugin-specific user interface""" super(LocalBRAINSFitPlugin,self).create(registrationState) self.LocalBRAINSFitMode = "Small" self.VerboseMode = "Quiet" # # Local Refinment Pane - initially hidden # - interface options for linear registration # localBRAINSFitCollapsibleButton = ctk.ctkCollapsibleButton() localBRAINSFitCollapsibleButton.text = "Local BRAINSFit" localBRAINSFitFormLayout = qt.QFormLayout() localBRAINSFitCollapsibleButton.setLayout(localBRAINSFitFormLayout) self.widgets.append(localBRAINSFitCollapsibleButton) buttonGroup = qt.QButtonGroup() self.widgets.append(buttonGroup) buttonLayout = qt.QVBoxLayout() localBRAINSFitModeButtons = {} self.LocalBRAINSFitModes = ("Small", "Large") for mode in self.LocalBRAINSFitModes: localBRAINSFitModeButtons[mode] = qt.QRadioButton() localBRAINSFitModeButtons[mode].text = mode localBRAINSFitModeButtons[mode].setToolTip( "Run the refinement in a %s local region." % mode.lower() ) buttonLayout.addWidget(localBRAINSFitModeButtons[mode]) buttonGroup.addButton(localBRAINSFitModeButtons[mode]) self.widgets.append(localBRAINSFitModeButtons[mode]) localBRAINSFitModeButtons[mode].connect('clicked()', lambda m=mode : self.onLocalBRAINSFitMode(m)) localBRAINSFitModeButtons[self.LocalBRAINSFitMode].checked = True localBRAINSFitFormLayout.addRow("Local BRAINSFit Mode ", buttonLayout) buttonGroup = qt.QButtonGroup() self.widgets.append(buttonGroup) buttonLayout = qt.QVBoxLayout() verboseModeButtons = {} self.VerboseModes = ("Quiet", "Verbose") for mode in self.VerboseModes: verboseModeButtons[mode] = qt.QRadioButton() verboseModeButtons[mode].text = mode verboseModeButtons[mode].setToolTip( "Run the refinement in %s mode." % mode.lower() ) buttonLayout.addWidget(verboseModeButtons[mode]) buttonGroup.addButton(verboseModeButtons[mode]) self.widgets.append(verboseModeButtons[mode]) verboseModeButtons[mode].connect('clicked()', lambda m=mode : self.onVerboseMode(m)) verboseModeButtons[self.VerboseMode].checked = True localBRAINSFitFormLayout.addRow("Verbose Mode ", buttonLayout) self.parent.layout().addWidget(localBRAINSFitCollapsibleButton)
def setupImportLabelmap(self): self.importLabelMapCollapsibleButton = ctk.ctkCollapsibleButton() self.importLabelMapCollapsibleButton.collapsed = True self.importLabelMapCollapsibleButton.enabled = False self.importLabelMapCollapsibleButton.text = "Import from labelmap" self.importLabelMapCollapsibleLayout = qt.QGridLayout(self.importLabelMapCollapsibleButton) self.labelMapImportWidget = ImportLabelMapIntoSegmentationWidget() self.labelMapImportWidget.addEventObserver(self.labelMapImportWidget.FailedEvent, self.onImportFailed) self.labelMapImportWidget.addEventObserver(self.labelMapImportWidget.SuccessEvent, self.onLabelMapImportSuccessful) self.labelMapImportWidget.segmentationNodeSelectorVisible = False self.importLabelMapCollapsibleLayout.addWidget(self.labelMapImportWidget) self.mainModuleWidgetLayout.addWidget(self.importLabelMapCollapsibleButton)
def setupImportSegmentation(self): self.importSegmentationCollapsibleButton = ctk.ctkCollapsibleButton() self.importSegmentationCollapsibleButton.collapsed = True self.importSegmentationCollapsibleButton.enabled = False self.importSegmentationCollapsibleButton.text = "Import from segmentation" self.importSegmentsCollapsibleLayout = qt.QGridLayout(self.importSegmentationCollapsibleButton) self.segmentImportWidget = CopySegmentBetweenSegmentationsWidget() self.segmentImportWidget.addEventObserver(self.segmentImportWidget.FailedEvent, self.onImportFailed) self.segmentImportWidget.addEventObserver(self.segmentImportWidget.SuccessEvent, self.onImportFinished) self.segmentImportWidget.segmentationNodeSelectorEnabled = False self.importSegmentsCollapsibleLayout.addWidget(self.segmentImportWidget) self.mainModuleWidgetLayout.addWidget(self.importSegmentationCollapsibleButton)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... settingsCollapsibleButton = ctk.ctkCollapsibleButton() settingsCollapsibleButton.text = "Slice View Annotations Settings" self.layout.addWidget(settingsCollapsibleButton) settingsVBoxLayout = qt.QVBoxLayout(settingsCollapsibleButton) dataProbeInstance = slicer.modules.DataProbeInstance if dataProbeInstance.infoWidget: sliceAnnotationsFrame = dataProbeInstance.infoWidget.sliceAnnotations.window settingsVBoxLayout.addWidget(sliceAnnotationsFrame) self.parent.layout().addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # Collapsible button sitesCollapsibleButton = ctk.ctkCollapsibleButton() sitesCollapsibleButton.text = "Sample Sites" self.layout.addWidget(sitesCollapsibleButton) # Layout within the collapsible button sitesFormLayout = qt.QFormLayout(sitesCollapsibleButton) # site buttons buttons = [] self.sites = [ { "label": "Web Console", "url": "http://localhost:1337" }, { "label": "Crowds Cure Cancer", "url": "http://cancer.crowds-cure.org" }, { "label": "Slicer Home Page", "url": "http://slicer.org" }, { "label": "MorphoSource", "url": "https://www.morphosource.org" }, { "label": "Slicer SampleData", "url": "https://www.slicer.org/wiki/SampleData" }, { "label": "SlicerMorph", "url": "https://slicermorph.github.io" }, ] for site in self.sites: button = qt.QPushButton(site["label"]) button.toolTip = "Open %s" % site["url"] sitesFormLayout.addWidget(button) onClick = lambda click, site=site: self.onSiteButtonClicked(site) button.connect('clicked(bool)', onClick) buttons.append(button) button = qt.QPushButton("Close All") button.toolTip = "Close all the web views" button.connect('clicked(bool)', self.onCloseAll) self.layout.addWidget(button) # 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 = "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 setup(self): # Collapsible button self.avgvolumesCollapsibleButton = ctk.ctkCollapsibleButton() self.avgvolumesCollapsibleButton.text = "Average Scalar Volumes" self.layout.addWidget(self.avgvolumesCollapsibleButton) # Layout within the averaging collapsible button self.avgvolumesFormLayout = qt.QFormLayout(self.avgvolumesCollapsibleButton) # # the volume selector # self.inputFrame = qt.QFrame(self.avgvolumesCollapsibleButton) self.inputFrame.setLayout(qt.QHBoxLayout()) self.avgvolumesFormLayout.addWidget(self.inputFrame) self.inputSelector = qt.QLabel("Select input nodes: ", self.inputFrame) self.inputFrame.layout().addWidget(self.inputSelector) self.inputSelector = slicer.qMRMLCheckableNodeComboBox(self.inputFrame) self.inputSelector.nodeTypes = ( ("vtkMRMLScalarVolumeNode"), "" ) self.inputSelector.addEnabled = True self.inputSelector.removeEnabled = True self.inputSelector.setMRMLScene( slicer.mrmlScene ) self.inputFrame.layout().addWidget(self.inputSelector) self.outputFrame = qt.QFrame(self.avgvolumesCollapsibleButton) self.outputFrame.setLayout(qt.QHBoxLayout()) self.avgvolumesFormLayout.addWidget(self.outputFrame) self.outputSelector = qt.QLabel("Select output reference 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) # Ok button okButton = qt.QPushButton("Ok") okButton.toolTip = "Average selected volumes" self.avgvolumesFormLayout.addWidget(okButton) okButton.connect('clicked(bool)', self.onApply) # Add vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.okButton = okButton
def setup(self): super(SliceTrackerDisplacementChartPlugin, self).setup() self.collapsibleButton = ctk.ctkCollapsibleButton() self.collapsibleButton.text = "Plotting" self.collapsibleButton.collapsed = 0 self.collapsibleButton.setLayout(qt.QGridLayout()) self.resetAndInitializeData() self.showLegendCheckBox = qt.QCheckBox('Show legend') self.showLegendCheckBox.setChecked(1) self.collapsibleButton.layout().addWidget(self.showLegendCheckBox, 0, 0) self.layout().addWidget(self.collapsibleButton)
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) # # check box to trigger taking screen shots for later use in tutorials # self.enableScreenshotsFlagCheckBox = qt.QCheckBox() self.enableScreenshotsFlagCheckBox.checked = 1 self.enableScreenshotsFlagCheckBox.setToolTip("If checked, take screen shots for tutorials. Use Save Data to write them to disk.") parametersFormLayout.addRow("Enable Screenshots", self.enableScreenshotsFlagCheckBox) # # scale factor for screen shots # self.screenshotScaleFactorSliderWidget = ctk.ctkSliderWidget() self.screenshotScaleFactorSliderWidget.singleStep = 1.0 self.screenshotScaleFactorSliderWidget.minimum = 1.0 self.screenshotScaleFactorSliderWidget.maximum = 50.0 self.screenshotScaleFactorSliderWidget.value = 1.0 self.screenshotScaleFactorSliderWidget.setToolTip("Set scale factor for the screen shots.") parametersFormLayout.addRow("Screenshot scale factor", self.screenshotScaleFactorSliderWidget) # # 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): self.setupIcons() iconSize = qt.QSize(36, 36) self.createNewCaseButton = self.createButton( "", icon=self.newIcon, iconSize=iconSize, toolTip="Start a new case") self.openCaseButton = self.createButton("", icon=self.openIcon, iconSize=iconSize, toolTip="Open case") self.closeCaseButton = self.createButton( "", icon=self.closeIcon, iconSize=iconSize, toolTip="Close case with resume support", enabled=False) self.setupCaseWatchBox() self.casesRootDirectoryButton = self.createDirectoryButton( text="Choose cases root location", caption="Choose cases root location", directory=self.getSetting('CasesRootLocation', self.MODULE_NAME)) self.caseRootDir = self.getSetting('CasesRootLocation', self.MODULE_NAME) self.caseDirectoryInformationArea = ctk.ctkCollapsibleButton() self.caseDirectoryInformationArea.collapsed = True self.caseDirectoryInformationArea.text = "Directory Settings" self.directoryConfigurationLayout = qt.QGridLayout( self.caseDirectoryInformationArea) self.directoryConfigurationLayout.addWidget( qt.QLabel("Cases Root Directory"), 1, 0, 1, 1) self.directoryConfigurationLayout.addWidget( self.casesRootDirectoryButton, 1, 1, 1, 1) self.directoryConfigurationLayout.addWidget(self.caseWatchBox, 2, 0, 1, qt.QSizePolicy.ExpandFlag) self.caseGroupBox = qt.QGroupBox("Case") self.caseGroupBoxLayout = qt.QFormLayout(self.caseGroupBox) self.caseGroupBoxLayout.addWidget( self.createHLayout([ self.createNewCaseButton, self.openCaseButton, self.closeCaseButton ])) self.caseGroupBoxLayout.addWidget(self.caseDirectoryInformationArea) self.layout().addWidget(self.caseGroupBox) super(ProstateAblationCaseManagerPlugin, self).setup()
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) # # Select landmark file to import # self.inputFileSelector = ctk.ctkPathLineEdit() self.inputFileSelector.setToolTip( "Select surface image that will be imported as a segment for editing" ) parametersFormLayout.addRow("Select surface file to edit:", self.inputFileSelector) # # check box to trigger taking screen shots for later use in tutorials # self.enableScreenshotsFlagCheckBox = qt.QCheckBox() self.enableScreenshotsFlagCheckBox.checked = 0 self.enableScreenshotsFlagCheckBox.setToolTip("If checked, take screen shots for tutorials. Use Save Data to write them to disk.") parametersFormLayout.addRow("Enable Screenshots", self.enableScreenshotsFlagCheckBox) # # Apply Button # self.applyButton = qt.QPushButton("Apply") self.applyButton.toolTip = "Run the conversion." self.applyButton.enabled = False parametersFormLayout.addRow(self.applyButton) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) self.inputFileSelector.connect('validInputChanged(bool)', self.onSelectInput) # Add vertical spacer self.layout.addStretch(1) # Refresh Apply button state self.onSelectInput()
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # # Parameters Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Input Parameters" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # # Input URL # self.InputURLText = qt.QLineEdit() self.InputURLText.setToolTip("Copy and paste the URL in this box") parametersFormLayout.addRow("URL: ", self.InputURLText) # # File Names # self.FileNameText = qt.QLineEdit() self.FileNameText.setToolTip("Enter the file name") parametersFormLayout.addRow("File name: ", self.FileNameText) # # Node Names # self.NodeNameText = qt.QLineEdit() self.NodeNameText.setToolTip("Enter the node names") parametersFormLayout.addRow("Node name: ", self.NodeNameText) # # Import button # self.ImportButton = qt.QPushButton("Import data") self.ImportButton.toolTip = "Import data from URL" self.ImportButton.enabled = False parametersFormLayout.addRow(self.ImportButton) # Connections self.InputURLText.connect('textChanged(const QString &)', self.onEnterURL) self.ImportButton.connect('clicked(bool)', self.onImport)
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): # Instantiate and connect widgets ... # reload button # (use this during development, but remove it when delivering # your module to users) self.reloadButton = qt.QPushButton("Reload") self.reloadButton.toolTip = "Reload this module." self.reloadButton.name = "sceneImport2428 Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # test button # (use this during development, but remove it when delivering # your module to users) self.testButton = qt.QPushButton("Test") self.testButton.toolTip = "Run the self tests." self.layout.addWidget(self.testButton) self.testButton.connect('clicked()', self.onTest) # reload and test button # (use this during development, but remove it when delivering # your module to users) self.reloadAndTestButton = qt.QPushButton("Reload and Test") self.reloadAndTestButton.toolTip = "Reload this module and then run the self tests." self.layout.addWidget(self.reloadAndTestButton) self.reloadAndTestButton.connect('clicked()', self.onReloadAndTest) # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "A collapsible button" self.layout.addWidget(dummyCollapsibleButton) # Layout within the dummy collapsible button dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) # HelloWorld button helloWorldButton = qt.QPushButton("Hello world") helloWorldButton.toolTip = "Print 'Hello world' in standard ouput." dummyFormLayout.addWidget(helloWorldButton) helloWorldButton.connect('clicked(bool)', self.onHelloWorldButtonClicked) # Add vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.helloWorldButton = helloWorldButton
def setup(self): super(SliceTrackerTrainingPlugin, self).setup() self.collapsibleTrainingArea = ctk.ctkCollapsibleButton() self.collapsibleTrainingArea.collapsed = True self.collapsibleTrainingArea.text = "Training Incoming Data Simulation" self.simulatePreopPhaseButton = self.createButton( "Simulate preop reception", enabled=False) self.simulateIntraopPhaseButton = self.createButton( "Simulate intraop reception", enabled=False) self.trainingsAreaLayout = qt.QGridLayout(self.collapsibleTrainingArea) self.trainingsAreaLayout.addWidget( self.createHLayout([ self.simulatePreopPhaseButton, self.simulateIntraopPhaseButton ])) self.layout().addWidget(self.collapsibleTrainingArea)
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) # # number of fiducials to add # self.numToAddSliderWidget = ctk.ctkSliderWidget() self.numToAddSliderWidget.singleStep = 1.0 self.numToAddSliderWidget.minimum = 0.0 self.numToAddSliderWidget.maximum = 1000.0 self.numToAddSliderWidget.value = 100.0 self.numToAddSliderWidget.toolTip = "Set the number of fiducials to add." parametersFormLayout.addRow("Number of Fiducials to Add", self.numToAddSliderWidget) # # check box to trigger fewer modify events, adding all the new points # is wrapped inside of a StartModify/EndModify block # self.fewerModifyFlagCheckBox = qt.QCheckBox() self.fewerModifyFlagCheckBox.checked = 0 self.fewerModifyFlagCheckBox.toolTip = 'If checked, wrap adding points inside of a StartModify - EndModify block' parametersFormLayout.addRow("Fewer Modify Events", self.fewerModifyFlagCheckBox) # 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 setupRegistrationResultsPlugin(self): self.regResultsCollapsibleButton = ctk.ctkCollapsibleButton() self.regResultsCollapsibleButton.collapsed = True self.regResultsCollapsibleButton.text = "Registration Evaluation" self.regResultsCollapsibleButton.hide() self.regResultsCollapsibleLayout = qt.QGridLayout( self.regResultsCollapsibleButton) self.regResultsPlugin = SliceTrackerRegistrationResultsPlugin() self.regResultsPlugin.addEventObserver( self.regResultsPlugin.NoRegistrationResultsAvailable, self.onNoRegistrationResultsAvailable) self.regResultsPlugin.resultSelectorVisible = False self.regResultsPlugin.titleVisible = False self.regResultsPlugin.visualEffectsTitle = "" self.regResultsPlugin.registrationTypeButtonsVisible = False self.addPlugin(self.regResultsPlugin) self.regResultsCollapsibleLayout.addWidget(self.regResultsPlugin)
def setup(self): """This is called one time when the module GUI is initialized """ ScriptedLoadableModuleWidget.setup(self) # Just create a container for the widget mainAreaCollapsibleButton = ctk.ctkCollapsibleButton() mainAreaCollapsibleButton.text = "Main parameters" self.layout.addWidget(mainAreaCollapsibleButton) self.mainAreaLayout = qt.QVBoxLayout(mainAreaCollapsibleButton) # self.viewer = MIPViewerWidget(mainAreaCollapsibleButton) self.viewer = MIPViewerWidget(mainAreaCollapsibleButton, MIPViewerWidget.CONTEXT_UNKNOWN) self.viewer.setup() # self.viewer.activateEnhacedVisualization(True) self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) self.runButton = qt.QPushButton("Run") self.runButton.toolTip = "Run the algorithm." self.runButton.enabled = True parametersFormLayout.addRow(self.runButton) self.runButton.connect('clicked(bool)', self.onApplyButton) self.layout.addStretch(1)
def setup(self): showPlusServerWidget = True if _platform == "linux" or _platform == "linux2" or _platform == "darwin": #linux or linux or OS X message = "Attention: You are running Slicer on Linux or OS X. Do you have PlusServer installed on the current OS?" result = QMessageBox.question(slicer.util.mainWindow(), 'ProstateTRUSNav', message, QMessageBox.Yes | QMessageBox.No) showPlusServerWidget = result == QMessageBox.Yes if _platform == "win32" or showPlusServerWidget: # Windows... plusServerCollapsibleButton = ctkCollapsibleButton() plusServerCollapsibleButton.text = "PlusServer" self.layout.addWidget(plusServerCollapsibleButton) self.configurationFileChooserButton = QPushButton( self.configurationFile) self.configurationFileChooserButton.connect( 'clicked()', self.onConfigFileSelected) self.runPlusServerButton = QPushButton("Run PlusServer") self.runPlusServerButton.setCheckable(True) self.runPlusServerButton.connect('clicked()', self.onRunPlusServerButtonClicked) self.serverFormLayout = QFormLayout(plusServerCollapsibleButton) self.serverExecutableChooserButton = QPushButton( self.serverExecutable) self.serverExecutableChooserButton.connect( 'clicked()', self.onServerExecutableSelected) hbox = QHBoxLayout() hbox.addWidget(self.serverExecutableChooserButton) self.serverFormLayout.addRow(hbox) hbox = QHBoxLayout() hbox.addWidget(self.configurationFileChooserButton) hbox.addWidget(self.runPlusServerButton) self.serverFormLayout.addRow(hbox) GuideletWidget.setup(self) # do specific setup here if _platform == "win32" or showPlusServerWidget: self.launchGuideletButton.setEnabled(False) self.checkExecutableAndArgument()
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # Collapsible button testsCollapsibleButton = ctk.ctkCollapsibleButton() testsCollapsibleButton.text = "SegmentEditorPETTumorSegmentationEffect Tests" self.layout.addWidget(testsCollapsibleButton) # Layout within the collapsible button collapsibleButtonLayout = qt.QFormLayout(testsCollapsibleButton) self.loadTestDataButton = qt.QPushButton("Download and load test data") self.loadTestDataButton.connect('clicked(bool)', self.onLoadTestData) collapsibleButtonLayout.addWidget(self.loadTestDataButton) # 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) # # input directory selector # with It(ctk.ctkPathLineEdit()) as w: self.inputDirectorySelector = w # make a directory-only, save dialog w.filters = ctk.ctkPathLineEdit.Dirs | ctk.ctkPathLineEdit.Writable parametersFormLayout.addRow("Input Directory: ", w) # # Apply Button # with It(qt.QPushButton("Apply")) as w: self.applyButton = w w.toolTip = "Run the algorithm." w.enabled = False parametersFormLayout.addRow(w) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) self.inputDirectorySelector.connect( 'currentPathChanged(const QString&)', self.reset) # Add vertical spacer self.layout.addStretch(1) # Refresh Apply button state self.onSelect()
def _addInputVolumeSection(self): inputVolumeCollapsibleButton = ctk.ctkCollapsibleButton() inputVolumeCollapsibleButton.text = 'Select Input Volume and Segmentation' self.layout.addWidget(inputVolumeCollapsibleButton) # Layout within the dummy collapsible button inputVolumeFormLayout = qt.QFormLayout(inputVolumeCollapsibleButton) # # input volume selector # self.inputVolumeSelector = slicer.qMRMLNodeComboBox() self.inputVolumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.inputVolumeSelector.selectNodeUponCreation = True self.inputVolumeSelector.addEnabled = False self.inputVolumeSelector.removeEnabled = False self.inputVolumeSelector.noneEnabled = False self.inputVolumeSelector.showHidden = False self.inputVolumeSelector.showChildNodeTypes = False self.inputVolumeSelector.setMRMLScene(slicer.mrmlScene) self.inputVolumeSelector.setToolTip( 'Pick the input image for the feature calculation.') inputVolumeFormLayout.addRow('Input Image Volume: ', self.inputVolumeSelector) # # input mask volume selector # self.inputMaskSelector = slicer.qMRMLNodeComboBox() self.inputMaskSelector.nodeTypes = [ 'vtkMRMLLabelMapVolumeNode', 'vtkMRMLSegmentationNode' ] self.inputMaskSelector.selectNodeUponCreation = True self.inputMaskSelector.addEnabled = False self.inputMaskSelector.removeEnabled = False self.inputMaskSelector.noneEnabled = True self.inputMaskSelector.showHidden = False self.inputMaskSelector.showChildNodeTypes = False self.inputMaskSelector.setMRMLScene(slicer.mrmlScene) self.inputMaskSelector.setToolTip( 'Pick the regions for feature calculation - defined by a segmentation or labelmap volume node.' ) inputVolumeFormLayout.addRow('Input regions: ', self.inputMaskSelector)
def create(self,registationState): """Make the plugin-specific user interface""" super(AffineAndThinPlatePlugin,self).create(registationState) # # Thin Plate Spline Registration Pane # self.thinPlateCollapsibleButton = ctk.ctkCollapsibleButton() self.thinPlateCollapsibleButton.text = "Affine And Thin Plate Spline Registration" affineAndThinPlateFormLayout = qt.QFormLayout() self.thinPlateCollapsibleButton.setLayout(affineAndThinPlateFormLayout) self.widgets.append(self.thinPlateCollapsibleButton) self.linearMode = "Rigid" self.registrationModeBox = qt.QGroupBox("Registration Mode") self.registrationModeBox.setLayout(qt.QFormLayout()) buttonLayout = qt.QVBoxLayout() self.linearModeButtons = {} self.linearModes = ("Rigid", "Similarity", "Affine") for mode in self.linearModes: self.linearModeButtons[mode] = qt.QRadioButton() self.linearModeButtons[mode].text = mode self.linearModeButtons[mode].setToolTip( "Run the registration in %s mode." % mode ) self.linearModeButtons[mode].connect('clicked()', lambda m=mode : self.onLinearTransform(m)) self.registrationModeBox.layout().addWidget(self.linearModeButtons[mode]) self.linearModeButtons[self.linearMode].checked = True affineAndThinPlateFormLayout.addWidget(self.registrationModeBox) self.hotUpdateButton = qt.QCheckBox("Hot Update") affineAndThinPlateFormLayout.addWidget(self.hotUpdateButton) self.widgets.append(self.hotUpdateButton) self.exportGridButton = qt.QPushButton("Export to Grid Transform") self.exportGridButton.toolTip = "To save this transform or use it in other Slicer modules you can export the current Thin Plate transform to a Grid Transform." affineAndThinPlateFormLayout.addWidget(self.exportGridButton) self.exportGridButton.connect("clicked()",self.onExportGrid) self.widgets.append(self.exportGridButton) self.parent.layout().addWidget(self.thinPlateCollapsibleButton)
def setup(self): ScriptedLoadableModuleWidget.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 testButton = qt.QPushButton("Reproduce issue 2590") testButton.toolTip = "Run the test." formLayout.addWidget(testButton) testButton.connect('clicked(bool)', self.onPart3ChangeTracker) # Add vertical spacer self.layout.addStretch(1)
def _setupSubWidget(self): if self._schema.get("collapsible") is True: self._subWidget = ctk.ctkCollapsibleButton() if self._schema.get("collapsed"): self._subWidget.collapsed = self._schema.get("collapsed") self._subWidget.contentsCollapsed.connect(self.onCollapsed) else: self._subWidget = qt.QGroupBox(self._title) self.title = self._schema.get("title") if self._schema.get( "title") else self._title self._subWidget.setLayout(qt.QFormLayout()) self.layout().addWidget(self._subWidget) if self._addRestoreDefaultsButton: self._restoreDefaultsButton = UICreationHelpers.createButton( "Restore defaults") self.layout().addWidget(self._restoreDefaultsButton) self._restoreDefaultsButton.clicked.connect( self.restoreJSONDefaults)
def setup(self): #ScriptedLoadableModuleWidget.setup(self) self._mainGUIGroupBox = qt.QGroupBox() self._collapsibleDirectoryConfigurationArea = ctk.ctkCollapsibleButton() self.mainGUIGroupBoxLayout = qt.QGridLayout() self._mainGUIGroupBox.setLayout(self.mainGUIGroupBoxLayout) self.createNewCaseButton = self.createButton("New case") self.openCaseButton = self.createButton("Open case") self.closeCaseButton = self.createButton("Close case", toolTip="Close case without completing it", enabled=False) self.completeCaseButton = self.createButton('Case completed', enabled=True) self.mainGUIGroupBoxLayout.addWidget(self.createNewCaseButton, 1, 0) self.mainGUIGroupBoxLayout.addWidget(self.openCaseButton, 1, 1) self.mainGUIGroupBoxLayout.addWidget(self.completeCaseButton, 1, 2) self.createPatientWatchBox() #self.createIntraopWatchBox() self.createCaseInformationArea() self.setupConnections() self.layout.addWidget(self._mainGUIGroupBox)
def setup(self): # Instantiate and connect widgets ... # # Parameters Area # ScriptedLoadableModuleWidget.setup(self) parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) self.inputSelector = slicer.qMRMLNodeComboBox() self.inputSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.inputSelector.addEnabled = True # Se habilita la posibildad al usuario de crear un nuevo nodo con este widget self.inputSelector.removeEnabled = False # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.inputSelector.setMRMLScene(slicer.mrmlScene) parametersFormLayout.addRow("Node:", self.inputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.inputSelector, 'setMRMLScene(vtkMRMLScene*)') self.typeComboBox = ctk.ctkComboBox() ## self.typeComboBox.caption='Tipo de registro' self.typeComboBox.addItem('Rigid') self.typeComboBox.addItem('BSpline') self.typeComboBox.addItem('Affine') self.typeComboBox.addItem('Rigid-BSpline') self.typeComboBox.addItem('Rigid-Affine') parametersFormLayout.addRow('Tipo de registro:', self.typeComboBox) ##Boton Registro self.buttonRegister = qt.QPushButton("Registrar") self.buttonRegister.toolTip = "Run the algorithm." self.buttonRegister.enabled = True parametersFormLayout.addRow(self.buttonRegister) self.buttonRegister.connect('clicked(bool)', self.registrarButton)
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) self.inputDirectory=ctk.ctkPathLineEdit() self.inputDirectory.filters=ctk.ctkPathLineEdit.Dirs self.inputDirectory.setToolTip( "Select input directory" ) parametersFormLayout.addRow("Input folder:", self.inputDirectory) self.outputDirectory=ctk.ctkPathLineEdit() self.outputDirectory.filters=ctk.ctkPathLineEdit.Dirs self.outputDirectory.setToolTip( "Select output directory") parametersFormLayout.addRow("Output folder: ", self.outputDirectory) # # Apply Button # self.applyButton = qt.QPushButton("Apply") self.applyButton.toolTip = "Convert." self.applyButton.enabled = False parametersFormLayout.addRow(self.applyButton) # connections self.inputDirectory.connect('validInputChanged(bool)', self.onSelect) self.outputDirectory.connect('validInputChanged(bool)', self.onSelect) self.applyButton.connect('clicked(bool)', self.onApplyButton) # Add vertical spacer self.layout.addStretch(1)
def setup(self): """ Called when the user opens the module the first time and the widget is initialized. """ ScriptedLoadableModuleWidget.setup(self) parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Markups" self.layout.addWidget(parametersCollapsibleButton) self.parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) self.fiducialsSelector = slicer.qMRMLNodeComboBox() self.fiducialsSelector.nodeTypes = ["vtkMRMLMarkupsFiducialNode"] self.fiducialsSelector.setMRMLScene(slicer.mrmlScene) self.fiducialsSelector.setToolTip("Select fiducials to edit") self.parametersFormLayout.addRow("Fiducials: ", self.fiducialsSelector) self.curveSelector = slicer.qMRMLNodeComboBox() self.curveSelector.nodeTypes = ["vtkMRMLMarkupsClosedCurveNode"] self.curveSelector.setMRMLScene(slicer.mrmlScene) self.curveSelector.setToolTip( "Select curve that defines the edit region") self.parametersFormLayout.addRow("Curve: ", self.curveSelector) self.viewSelector = slicer.qMRMLNodeComboBox() self.viewSelector.nodeTypes = ["vtkMRMLViewNode"] self.viewSelector.setMRMLScene(slicer.mrmlScene) self.viewSelector.setToolTip( "Select view that defines the edit region") self.parametersFormLayout.addRow("View: ", self.viewSelector) self.editButton = qt.QPushButton("Edit") #self.editButton.enabled = False self.parametersFormLayout.addRow("", self.editButton) # Add vertical spacer self.layout.addStretch(1) self.logic = MarkupEditorLogic() self.editButton.connect("clicked()", self.onEditMarkups)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # This module is often used in developer mode, therefore # collapse reload & test section by default. if hasattr(self, "reloadCollapsibleButton"): self.reloadCollapsibleButton.collapsed = True self.logic = SelfTestsLogic(slicer.selfTests) globals()['selfTests'] = 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): ScriptedLoadableModuleWidget.setup(self) self._mainGUIGroupBox = qt.QGroupBox() self._collapsibleDirectoryConfigurationArea = ctk.ctkCollapsibleButton() self.mainGUIGroupBoxLayout = qt.QGridLayout() self._mainGUIGroupBox.setLayout(self.mainGUIGroupBoxLayout) self.createNewCaseButton = self.createButton("New case") self.openCaseButton = self.createButton("Open case") self.mainGUIGroupBoxLayout.addWidget(self.createNewCaseButton, 1, 0) self.mainGUIGroupBoxLayout.addWidget(self.openCaseButton, 1, 1) self.casesRootDirectoryButton = self.createDirectoryButton(text="Choose cases root location", caption="Choose cases root location", directory=self.getSetting('CasesRootLocation')) self.rootDirectoryLabel = qt.QLabel('') if self.getSetting('CasesRootLocation'): self.rootDirectoryLabel = qt.QLabel(self.getSetting('CasesRootLocation')) self.createPatientWatchBox() self.setupConnections() self.layout.addWidget(self._mainGUIGroupBox) slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.StartImportEvent, self.StartCaseImportCallback) slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.EndImportEvent, self.LoadCaseCompletedCallback)
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 = "Slicer4Minute 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 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 output." 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): 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) # # a text input field for the input of patient's path. get path with self.displayText # self.textInputBox = qt.QLineEdit() parametersFormLayout.addRow("Patient Path", self.textInputBox) # # Apply Button # self.applyButton = qt.QPushButton("Apply") self.applyButton.toolTip = "Run the algorithm." self.applyButton.enabled = False 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 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.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("Input Volume: ", self.inputSelector) # connections self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) # Add vertical spacer self.layout.addStretch(1) # Refresh Table view state self.onSelect(self.inputSelector.currentNode())
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) ########################## add by zyl # HelloWorld button helloWorldButton = qt.QPushButton("Hello World!") helloWorldButton.toolTip = "Print 'Hello World' in standard output." parametersFormLayout.addWidget(helloWorldButton) helloWorldButton.connect('clicked(bool)', self.onHelloWorldButtonClicked) # Add vertical spacer self.layout.addStretch(1) # Set local var as instance attribute self.helloWorldButton = helloWorldButton ############ add a button for test #Tree Test treeButton = qt.QPushButton("Show the Tree") treeButton.toolTip = "Print 'this is a tree button.'" parametersFormLayout.addWidget(treeButton) treeButton.connect('clicked(bool)', self.onTreeButtonClicked) #treeButton.connect('clicked(bool)', self.onHelloWorldButtonClicked) self.layout.addStretch(1) self.treeButton = treeButton
def addNodesButton(self): self.nodesButton = ctk.ctkCollapsibleButton() self.nodesButton.text = 'Volumes' self.layout.addWidget(self.nodesButton) nodesLayout = qt.QFormLayout(self.nodesButton) self.inputSelector = slicer.qMRMLNodeComboBox() self.inputSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.inputSelector.addEnabled = False self.inputSelector.removeEnabled = True self.inputSelector.noneEnabled = False self.inputSelector.setMRMLScene(slicer.mrmlScene) self.inputSelector.currentNodeChanged.connect( self.onVolumeSelectorModified) nodesLayout.addRow('Input volume: ', self.inputSelector) self.inputLabelSelector = slicer.qMRMLNodeComboBox() self.inputLabelSelector.nodeTypes = [ 'vtkMRMLLabelMapVolumeNode', 'vtkMRMLSegmentationNode' ] self.inputLabelSelector.addEnabled = False self.inputLabelSelector.removeEnabled = True self.inputLabelSelector.noneEnabled = False self.inputLabelSelector.setMRMLScene(slicer.mrmlScene) self.inputLabelSelector.currentNodeChanged.connect( self.onVolumeSelectorModified) nodesLayout.addRow('Parcellation: ', self.inputLabelSelector) self.outputSelector = slicer.qMRMLNodeComboBox() self.outputSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.outputSelector.addEnabled = False self.outputSelector.removeEnabled = True self.outputSelector.noneEnabled = True self.outputSelector.setMRMLScene(slicer.mrmlScene) self.outputSelector.noneDisplay = 'Create new volume' self.outputSelector.currentNodeChanged.connect( self.onVolumeSelectorModified) nodesLayout.addRow('Output volume: ', self.outputSelector)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # 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 output." 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