def setup(self): # Instantiate and connect widgets ... # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "IO" self.layout.addWidget(dummyCollapsibleButton) # Layout within the dummy collapsible button dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) # Input label node label = qt.QLabel('Input label: ') self.segmentationSelector = slicer.qMRMLNodeComboBox() self.segmentationSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.segmentationSelector.setMRMLScene(slicer.mrmlScene) self.segmentationSelector.addEnabled = 0 self.segmentationSelector.noneEnabled = 1 self.segmentationSelector.removeEnabled = 0 self.segmentationSelector.showHidden = 0 self.segmentationSelector.showChildNodeTypes = 0 self.segmentationSelector.selectNodeUponCreation = 1 self.segmentationSelector.addAttribute('vtkMRMLScalarVolumeNode','LabelMap',1) self.segmentationSelector.connect('currentNodeChanged(vtkMRMLNode*)',self.onInputChanged) dummyFormLayout.addRow(label, self.segmentationSelector) # Input volume node label = qt.QLabel('Input volume: ') self.volumeSelector = slicer.qMRMLNodeComboBox() self.volumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.volumeSelector.setMRMLScene(slicer.mrmlScene) self.volumeSelector.addEnabled = 0 self.volumeSelector.noneEnabled = 1 self.volumeSelector.removeEnabled = 0 self.volumeSelector.showHidden = 0 self.volumeSelector.showChildNodeTypes = 0 self.volumeSelector.selectNodeUponCreation = 0 self.volumeSelector.addAttribute('vtkMRMLScalarVolumeNode','DICOM.instanceUIDs') self.volumeSelector.connect('currentNodeChanged(vtkMRMLNode*)',self.onInputChanged) dummyFormLayout.addRow(label, self.volumeSelector) # Buttons to save/load report using AIM XML serialization label = qt.QLabel('Export folder') self.__exportFolderPicker = ctk.ctkDirectoryButton() self.__exportFolderPicker.connect('directoryChanged(const QString&)', self.onOutputDirChanged) self.exportButton = qt.QPushButton('Export') dummyFormLayout.addRow(label, self.__exportFolderPicker) dummyFormLayout.addRow(self.exportButton) self.exportButton.connect('clicked()', self.onLabelExport) self.exportButton.enabled = 1 # Input hint self.__helpLabel = qt.QLabel('Select a label associated with a DICOM volume') dummyFormLayout.addRow(self.__helpLabel) # Add vertical spacer self.layout.addStretch(1) self.outputDir = self.__exportFolderPicker.directory
def setupsubmissionUI(self): self.dataDirButton = ctk.ctkDirectoryButton() self.submissionGroupBoxLayout.addWidget(qt.QLabel("Data directory:") ) self.submissionGroupBoxLayout.addWidget(self.dataDirButton) self.SaveButton = qt.QPushButton("Save") self.submissionGroupBoxLayout.addWidget(self.SaveButton) self.SaveButton.connect('clicked()', self.onSaveButtonClicked) self.WebSaveButton = qt.QPushButton("Submit to web") self.submissionGroupBoxLayout.addWidget(self.WebSaveButton) self.WebSaveButton.connect('clicked()', self.onWebSaveButtonClicked)
def setup(self): self.developerMode = True ScriptedLoadableModuleWidget.setup(self) parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) self.inputDirButton = ctk.ctkDirectoryButton() parametersFormLayout.addRow("Input directory:",self.inputDirButton) self.outputDirButton = ctk.ctkDirectoryButton() parametersFormLayout.addRow("Output directory:",self.outputDirButton) applyButton = qt.QPushButton('Run') parametersFormLayout.addRow(applyButton) applyButton.connect('clicked()',self.onRunClicked)
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): 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 setup(self): ScriptedLoadableModuleWidget.setup(self) print "-------Mesh Statistic Widget Setup-------" self.moduleName = 'MeshStatistics' scriptedModulesPath = eval('slicer.modules.%s.path' % self.moduleName.lower()) scriptedModulesPath = os.path.dirname(scriptedModulesPath) libPath = os.path.join(scriptedModulesPath) sys.path.insert(0, libPath) # import the external library that contain the functions comon to all DCBIA modules import ShapeQuantifierCore reload(ShapeQuantifierCore) # ------------------------------------------------------------------------------------- self.ShapeQuantifierCore = ShapeQuantifierCore.ShapeQuantifierCore(interface = self) self.logic = MeshStatisticsLogic(self, ShapeQuantifierCore) self.modelList = list() self.fieldList = list() self.ROIList = list() self.ROIDict = dict() # Key = Name of ROI # Value = Dictionary of Fields (key = Name of Field # Value = dictionary of shapes # key = name of shapes # value = Statistics store() # ---------------------------------------------------------------- # # ---------------- Definition of the UI interface ---------------- # # ---------------------------------------------------------------- # # ------------ Loading of the .ui file ---------- # loader = qt.QUiLoader() path = os.path.join(scriptedModulesPath, 'Resources', 'UI', '%s.ui' %self.moduleName) qfile = qt.QFile(path) qfile.open(qt.QFile.ReadOnly) widget = loader.load(qfile, self.parent) self.layout = self.parent.layout() self.widget = widget self.layout.addWidget(widget) # ------------------------------------------------------------------------------------ # SHAPES INPUT # ------------------------------------------------------------------------------------ self.inputComboBox = self.ShapeQuantifierCore.get("inputComboBox") self.inputComboBox.setMRMLScene(slicer.mrmlScene) self.inputComboBox.connect('checkedNodesChanged()', self.onInputComboBoxCheckedNodesChanged) # ------------------------------------------------------------------------------------ # ROI TABLE # ------------------------------------------------------------------------------------ self.ROIComboBox = self.ShapeQuantifierCore.get("ROIComboBox") self.ROICheckBox = self.ShapeQuantifierCore.get("ROICheckBox") self.ROICheckBox.connect('stateChanged(int)', self.onROICheckBoxStateChanged) # ------------------------------------------------------------------------------------ # FIELD TABLE # ------------------------------------------------------------------------------------ self.tableField = self.ShapeQuantifierCore.get("tableField") self.tableField.setColumnCount(2) self.tableField.setMinimumHeight(250) self.tableField.setHorizontalHeaderLabels([' ', ' Field Name ']) self.tableField.setColumnWidth(0, 20) self.tableField.setColumnWidth(1, 260) self.tableField.setSizePolicy(qt.QSizePolicy().Expanding, qt.QSizePolicy().Expanding) # ------------------------------------------------------------------------------------ # RUN # ------------------------------------------------------------------------------------ self.runButton = self.ShapeQuantifierCore.get("runButton") self.runButton.connect('clicked()', self.onRunButton) # ------------------------------------------------------------------------------------ # Statistics Table - Export # ------------------------------------------------------------------------------------ self.mainLayout = self.ShapeQuantifierCore.get("mainLayout") self.tabROI = qt.QTabWidget() self.tabROI.setTabPosition(0) self.tabROI.adjustSize() # ---------------------------- Directory - Export Button ----------------------------- self.directoryExport = ctk.ctkDirectoryButton() self.exportCheckBox = qt.QCheckBox('Separate Files') self.exportCheckBox.setChecked(True) self.exportButton = qt.QPushButton(' Export ') self.exportButton.enabled = True self.exportPointValueCheckBox = qt.QCheckBox('Export Value on Each Point') self.exportLayout = qt.QVBoxLayout() self.directoryAndExportLayout = qt.QHBoxLayout() self.directoryAndExportLayout.addWidget(self.directoryExport) self.directoryAndExportLayout.addWidget(self.exportCheckBox) self.directoryAndExportLayout.addWidget(self.exportPointValueCheckBox) self.exportButtonsLayout = qt.QHBoxLayout() self.exportButtonsLayout.addWidget(self.exportButton) self.exportLayout.addLayout(self.directoryAndExportLayout) self.exportLayout.addLayout(self.exportButtonsLayout) self.layout.addStretch(1) self.logic.updateInterface(self.tableField, self.ROIComboBox, self.ROIList, self.modelList, self.mainLayout) # ------------------------------------------------------------------------------------ # OBSERVERS # ------------------------------------------------------------------------------------ slicer.mrmlScene.AddObserver(slicer.mrmlScene.EndCloseEvent, self.onCloseScene)
def setup(self): ScriptedLoadableModuleWidget.setup(self) print "-------Mesh Statistic Widget Setup-------" self.moduleName = 'MeshStatistics' scriptedModulesPath = eval('slicer.modules.%s.path' % self.moduleName.lower()) scriptedModulesPath = os.path.dirname(scriptedModulesPath) libPath = os.path.join(scriptedModulesPath) sys.path.insert(0, libPath) # import the external library that contain the functions comon to all DCBIA modules import ShapeQuantifierCore reload(ShapeQuantifierCore) # ------------------------------------------------------------------------------------- self.ShapeQuantifierCore = ShapeQuantifierCore.ShapeQuantifierCore( interface=self) self.logic = MeshStatisticsLogic(self, ShapeQuantifierCore) self.modelList = list() self.fieldList = list() self.ROIList = list() self.ROIDict = dict() # Key = Name of ROI # Value = Dictionary of Fields (key = Name of Field # Value = dictionary of shapes # key = name of shapes # value = Statistics store() # ---------------------------------------------------------------- # # ---------------- Definition of the UI interface ---------------- # # ---------------------------------------------------------------- # # ------------ Loading of the .ui file ---------- # loader = qt.QUiLoader() path = os.path.join(scriptedModulesPath, 'Resources', 'UI', '%s.ui' % self.moduleName) qfile = qt.QFile(path) qfile.open(qt.QFile.ReadOnly) widget = loader.load(qfile, self.parent) self.layout = self.parent.layout() self.widget = widget self.layout.addWidget(widget) # ------------------------------------------------------------------------------------ # SHAPES INPUT # ------------------------------------------------------------------------------------ self.inputComboBox = self.ShapeQuantifierCore.get("inputComboBox") self.inputComboBox.setMRMLScene(slicer.mrmlScene) self.inputComboBox.connect('checkedNodesChanged()', self.onInputComboBoxCheckedNodesChanged) # ------------------------------------------------------------------------------------ # ROI TABLE # ------------------------------------------------------------------------------------ self.ROIComboBox = self.ShapeQuantifierCore.get("ROIComboBox") self.ROICheckBox = self.ShapeQuantifierCore.get("ROICheckBox") self.ROICheckBox.connect('stateChanged(int)', self.onROICheckBoxStateChanged) # ------------------------------------------------------------------------------------ # FIELD TABLE # ------------------------------------------------------------------------------------ self.tableField = self.ShapeQuantifierCore.get("tableField") self.tableField.setColumnCount(2) self.tableField.setMinimumHeight(250) self.tableField.setHorizontalHeaderLabels([' ', ' Field Name ']) self.tableField.setColumnWidth(0, 20) self.tableField.setColumnWidth(1, 260) self.tableField.setSizePolicy(qt.QSizePolicy().Expanding, qt.QSizePolicy().Expanding) # ------------------------------------------------------------------------------------ # RUN # ------------------------------------------------------------------------------------ self.runButton = self.ShapeQuantifierCore.get("runButton") self.runButton.connect('clicked()', self.onRunButton) # ------------------------------------------------------------------------------------ # Statistics Table - Export # ------------------------------------------------------------------------------------ self.mainLayout = self.ShapeQuantifierCore.get("mainLayout") self.tabROI = qt.QTabWidget() self.tabROI.setTabPosition(0) self.tabROI.adjustSize() # ---------------------------- Directory - Export Button ----------------------------- self.directoryExport = ctk.ctkDirectoryButton() self.exportCheckBox = qt.QCheckBox('Separate Files') self.exportCheckBox.setChecked(True) self.exportButton = qt.QPushButton(' Export ') self.exportButton.enabled = True self.exportPointValueCheckBox = qt.QCheckBox( 'Export Value on Each Point') self.exportLayout = qt.QVBoxLayout() self.directoryAndExportLayout = qt.QHBoxLayout() self.directoryAndExportLayout.addWidget(self.directoryExport) self.directoryAndExportLayout.addWidget(self.exportCheckBox) self.directoryAndExportLayout.addWidget(self.exportPointValueCheckBox) self.exportButtonsLayout = qt.QHBoxLayout() self.exportButtonsLayout.addWidget(self.exportButton) self.exportLayout.addLayout(self.directoryAndExportLayout) self.exportLayout.addLayout(self.exportButtonsLayout) self.layout.addStretch(1) self.logic.updateInterface(self.tableField, self.ROIComboBox, self.ROIList, self.modelList, self.mainLayout) # ------------------------------------------------------------------------------------ # OBSERVERS # ------------------------------------------------------------------------------------ slicer.mrmlScene.AddObserver(slicer.mrmlScene.EndCloseEvent, self.onCloseScene)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... if not NUMPY_AVAILABLE: label = qt.QLabel('The module is not available due to missing Numpy package.') self.layout.addWidget(label) label = qt.QLabel('You can seek help by contacting 3D Slicer user list: [email protected]') self.layout.addWidget(label) # Add vertical spacer self.layout.addStretch(1) return # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Basic settings" self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) # add input directory selector label = qt.QLabel('Input directory:') self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input directory' dummyFormLayout.addRow(label, self.__fDialog) label = qt.QLabel('Output node:') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onMRMLSceneChanged) self.__mvSelector.addEnabled = 1 dummyFormLayout.addRow(label, self.__mvSelector) # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Advanced settings" dummyCollapsibleButton.collapsed = 1 self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) self.__advancedFrame = dummyCollapsibleButton label = qt.QLabel('Frame identifying DICOM tag (if known):') self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = 'NA' dummyFormLayout.addRow(label, self.__dicomTag) label = qt.QLabel('Frame identifying units:') self.__veLabel = qt.QLineEdit() self.__veLabel.text = 'na' dummyFormLayout.addRow(label, self.__veLabel) label = qt.QLabel('Initial value:') self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 dummyFormLayout.addRow(label, self.__veInitial) label = qt.QLabel('Step:') self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 dummyFormLayout.addRow(label, self.__veStep) label = qt.QLabel('EchoTime:') self.__te = qt.QDoubleSpinBox() self.__te.value = 1 dummyFormLayout.addRow(label, self.__te) label = qt.QLabel('RepetitionTime:') self.__tr = qt.QDoubleSpinBox() self.__tr.value = 1 dummyFormLayout.addRow(label, self.__tr) label = qt.QLabel('FlipAngle:') self.__fa = qt.QDoubleSpinBox() self.__fa.value = 1 dummyFormLayout.addRow(label, self.__fa) importButton = qt.QPushButton("Import") importButton.toolTip = "Import the contents of the directory as a MultiVolume" self.layout.addWidget(importButton) importButton.connect('clicked(bool)', self.onImportButtonClicked) self.__status = qt.QLabel('Status: Idle') self.layout.addWidget(self.__status) # Add vertical spacer self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) print("-------Mesh Statistic Widget Setup-------") # ------------------------------------------------------------------------------------- self.modelList = list() self.fieldList = list() self.ROIList = list() self.ROIDict = dict() # Key = Name of ROI # Value = Dictionary of Fields (key = Name of Field # Value = dictionary of shapes # key = name of shapes # value = Statistics store() self.logic = MeshStatisticsLogic(self) # ---------------------------------------------------------------- # # ---------------- Definition of the UI interface ---------------- # # ---------------------------------------------------------------- # # ------------ Loading of the .ui file ---------- # modulePath = os.path.dirname(slicer.util.modulePath(self.moduleName)) path = os.path.join(modulePath, 'Resources', 'UI', '%s.ui' % self.moduleName) self.layout = self.parent.layout() self.widget = slicer.util.loadUI(path) self.layout.addWidget(self.widget) # ------------------------------------------------------------------------------------ # SHAPES INPUT # ------------------------------------------------------------------------------------ self.inputComboBox = self.logic.get("inputComboBox") self.inputComboBox.setMRMLScene(slicer.mrmlScene) self.inputComboBox.connect('checkedNodesChanged()', self.onInputComboBoxCheckedNodesChanged) # ------------------------------------------------------------------------------------ # ROI TABLE # ------------------------------------------------------------------------------------ self.ROIComboBox = self.logic.get("ROIComboBox") self.ROICheckBox = self.logic.get("ROICheckBox") self.ROICheckBox.connect('stateChanged(int)', self.onROICheckBoxStateChanged) # ------------------------------------------------------------------------------------ # FIELD TABLE # ------------------------------------------------------------------------------------ self.tableField = self.logic.get("tableField") self.tableField.setColumnCount(2) self.tableField.setMinimumHeight(250) self.tableField.setHorizontalHeaderLabels([' ', ' Field Name ']) self.tableField.setColumnWidth(0, 20) self.tableField.setColumnWidth(1, 260) self.tableField.setSizePolicy(qt.QSizePolicy().Expanding, qt.QSizePolicy().Expanding) # ------------------------------------------------------------------------------------ # RUN # ------------------------------------------------------------------------------------ self.runButton = self.logic.get("runButton") self.runButton.connect('clicked()', self.onRunButton) # ------------------------------------------------------------------------------------ # Statistics Table - Export # ------------------------------------------------------------------------------------ self.mainLayout = self.logic.get("mainLayout") self.tabROI = qt.QTabWidget() self.tabROI.setTabPosition(0) self.tabROI.adjustSize() # ---------------------------- Directory - Export Button ----------------------------- self.directoryExport = ctk.ctkDirectoryButton() self.exportCheckBox = qt.QCheckBox('Separate Files') self.exportCheckBox.setChecked(True) self.exportButton = qt.QPushButton(' Export ') self.exportButton.enabled = True self.exportPointValueCheckBox = qt.QCheckBox('Export Value on Each Point') self.exportLayout = qt.QVBoxLayout() self.directoryAndExportLayout = qt.QHBoxLayout() self.directoryAndExportLayout.addWidget(self.directoryExport) self.directoryAndExportLayout.addWidget(self.exportCheckBox) self.directoryAndExportLayout.addWidget(self.exportPointValueCheckBox) self.exportButtonsLayout = qt.QHBoxLayout() self.exportButtonsLayout.addWidget(self.exportButton) self.exportLayout.addLayout(self.directoryAndExportLayout) self.exportLayout.addLayout(self.exportButtonsLayout) self.layout.addStretch(1) self.logic.updateInterface(self.tableField, self.ROIComboBox, self.ROIList, self.modelList, self.mainLayout) # ------------------------------------------------------------------------------------ # OBSERVERS # ------------------------------------------------------------------------------------ slicer.mrmlScene.AddObserver(slicer.mrmlScene.EndCloseEvent, self.onCloseScene)
def setup(self): """Init the widget """ self.modulePath = SlicerUtil.getModuleFolder("CIP_GetImage") self.resourcesPath = os.path.join(self.modulePath, "CIP_GetImage_Resources") self.StudyId = "" self.logic = CIP_GetImageLogic(self.modulePath) # Widget to load cases faster self.loadSaveDatabuttonsWidget = CIPUI.LoadSaveDataWidget( parentWidget=self.parent) self.loadSaveDatabuttonsWidget.setup(moduleName="CIP_GetImage") # # Obligatory parameters area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Image data" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # Study radio buttons label = qt.QLabel() label.text = "Select the study:" parametersFormLayout.addRow(label) self.rbgStudy = qt.QButtonGroup() for key in self.studyIds: rbStudyid = qt.QRadioButton(key) self.rbgStudy.addButton(rbStudyid) parametersFormLayout.addWidget(rbStudyid) self.txtOtherStudy = qt.QLineEdit() self.txtOtherStudy.hide() parametersFormLayout.addWidget(self.txtOtherStudy) # Case id self.txtCaseId = qt.QLineEdit() parametersFormLayout.addRow("Case ID ", self.txtCaseId) # Image types label = qt.QLabel() label.text = "Select the images that you want to load:" parametersFormLayout.addRow(label) self.cbsImageTypes = [] for key in self.imageTypes: check = qt.QCheckBox() check.checked = True check.setText(key) parametersFormLayout.addWidget(check) self.cbsImageTypes.append(check) # Label maps label = qt.QLabel() label.text = "Select the label maps that you want to load:" parametersFormLayout.addRow(label) # Labelmap types checkboxes self.cbsLabelMapTypes = [] for key in self.labelMapTypes: check = qt.QCheckBox() check.setText(key) check.checked = self.labelMapTypes[key][0] parametersFormLayout.addWidget(check) self.cbsLabelMapTypes.append(check) # Load image Button self.downloadButton = qt.QPushButton("Download") self.downloadButton.toolTip = "Load the image" #self.downloadButton.enabled = False self.downloadButton.setStyleSheet( "background-color: green; font-weight:bold; color:white") parametersFormLayout.addRow(self.downloadButton) self.downloadButton.connect('clicked (bool)', self.onDownloadButton) # Information message self.lblDownloading = qt.QLabel() self.lblDownloading.text = "Downloading images. Please wait..." self.lblDownloading.hide() parametersFormLayout.addRow(self.lblDownloading) # # Optional Parameters # optionalParametersCollapsibleButton = ctk.ctkCollapsibleButton() optionalParametersCollapsibleButton.text = "Optional parameters" self.layout.addWidget(optionalParametersCollapsibleButton) optionalParametersFormLayout = qt.QFormLayout( optionalParametersCollapsibleButton) # Local storage (Slicer temporary path) self.localStoragePath = "{0}/CIP".format(slicer.app.temporaryPath) if not os.path.exists(self.localStoragePath): os.makedirs(self.localStoragePath) # Make sure that everybody has write permissions (sometimes there are problems because of umask) os.chmod(self.localStoragePath, 0o777) self.storagePathButton = ctk.ctkDirectoryButton() self.storagePathButton.directory = self.localStoragePath optionalParametersFormLayout.addRow("Local directory: ", self.storagePathButton) # Connection type (SSH, "normal") label = qt.QLabel() label.text = "Connection type:" optionalParametersFormLayout.addRow(label) self.rbgConnectionType = qt.QButtonGroup() self.rbSSH = qt.QRadioButton("SSH (secure connection)") self.rbSSH.setChecked(True) self.rbgConnectionType.addButton(self.rbSSH) optionalParametersFormLayout.addWidget(self.rbSSH) self.rbCP = qt.QRadioButton("Common") self.rbgConnectionType.addButton(self.rbCP) optionalParametersFormLayout.addWidget(self.rbCP) # SSH Server login self.txtServer = qt.QLineEdit() s = SlicerUtil.settingGetOrSetDefault( "CIP_GetImage", "server", "This is your ssh user and server. Example: [email protected]") self.txtServer.text = s # This is your ssh user and server. Example: [email protected]" optionalParametersFormLayout.addRow("Server:", self.txtServer) # Server root path self.txtServerpath = qt.QLineEdit() s = SlicerUtil.settingGetOrSetDefault( "CIP_GetImage", "serverRootPath", "This is your root path to search for files. Ex: /Cases/Processed") self.txtServerpath.text = s # This is your root path to search for files. Ex: /Cases/Processed optionalParametersFormLayout.addRow("Server root path:", self.txtServerpath) # SSH Private key self.txtPrivateKeySSH = qt.QLineEdit() s = SlicerUtil.settingGetOrSetDefault("CIP_GetImage", "sshKey", "") self.txtPrivateKeySSH.text = s # this is the full path to your ssh key if you need it. Be aware of Unix/Windows comaptibility (hint: use os.path.join) # Please notice that you won't need a SSH key if your computer already has one locally installed" optionalParametersFormLayout.addRow( "SSH private key (leave blank for computer's default): ", self.txtPrivateKeySSH) # Cache mode self.cbCacheMode = qt.QCheckBox("Cache mode activated") self.cbCacheMode.setChecked(True) # Cache mode is activated by default optionalParametersFormLayout.addRow("", self.cbCacheMode) # Clean cache Button self.cleanCacheButton = qt.QPushButton("Clean cache") self.cleanCacheButton.toolTip = "Remove all the local cached files" optionalParametersFormLayout.addRow(self.cleanCacheButton) optionalParametersCollapsibleButton.collapsed = True if SlicerUtil.IsDevelopment: # reload button self.reloadButton = qt.QPushButton("Reload (just development)") self.reloadButton.toolTip = "Reload this module (for development purposes)." self.reloadButton.name = "Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # Add vertical spacer self.layout.addStretch(1) # Connections self.rbgStudy.connect("buttonClicked (QAbstractButton*)", self.onRbStudyClicked) self.txtOtherStudy.connect("textEdited (QString)", self.onTxtOtherStudyEdited) self.rbgConnectionType.connect("buttonClicked (QAbstractButton*)", self.onRbgConnectionType) self.storagePathButton.connect("directorySelected(QString)", self.onTmpDirChanged) self.cleanCacheButton.connect('clicked (bool)', self.onCleanCacheButtonClicked)
def setup(self): ScriptedLoadableModuleWidget.setup(self) ### Parameters Area parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # fixed image (mrml input) self.fixedMRMLSelector = slicer.qMRMLNodeComboBox() self.fixedMRMLSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.fixedMRMLSelector.selectNodeUponCreation = True self.fixedMRMLSelector.addEnabled = False self.fixedMRMLSelector.removeEnabled = False self.fixedMRMLSelector.noneEnabled = False self.fixedMRMLSelector.showHidden = False self.fixedMRMLSelector.showChildNodeTypes = False self.fixedMRMLSelector.setMRMLScene( slicer.mrmlScene ) self.fixedMRMLSelector.setToolTip ("Choose either an image within the MRML scene, or a directory containing a DICOM image") parametersFormLayout.addRow("Fixed image: ", self.fixedMRMLSelector) # fixed image (directory input) self.fixedInputDirectory = ctk.ctkDirectoryButton() self.fixedInputDirectory.directory = qt.QDir.homePath() parametersFormLayout.addRow("", self.fixedInputDirectory) # moving image (mrml input) self.movingMRMLSelector = slicer.qMRMLNodeComboBox() self.movingMRMLSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.movingMRMLSelector.selectNodeUponCreation = True self.movingMRMLSelector.addEnabled = False self.movingMRMLSelector.removeEnabled = False self.movingMRMLSelector.noneEnabled = False self.movingMRMLSelector.showHidden = False self.movingMRMLSelector.showChildNodeTypes = False self.movingMRMLSelector.setMRMLScene( slicer.mrmlScene ) self.fixedMRMLSelector.setToolTip ("Choose either an image within the MRML scene, or a directory containing a DICOM image") parametersFormLayout.addRow("Moving image: ", self.movingMRMLSelector) # moving image (directory input) self.movingInputDirectory = ctk.ctkDirectoryButton() self.movingInputDirectory.directory = qt.QDir.homePath() parametersFormLayout.addRow("", self.movingInputDirectory) # transform (mrml input) self.xformMRMLSelector = slicer.qMRMLNodeComboBox() self.xformMRMLSelector.nodeTypes = ["vtkMRMLLinearTransformNode"] self.xformMRMLSelector.selectNodeUponCreation = True self.xformMRMLSelector.addEnabled = False self.xformMRMLSelector.removeEnabled = False self.xformMRMLSelector.noneEnabled = False self.xformMRMLSelector.showHidden = False self.xformMRMLSelector.showChildNodeTypes = False self.xformMRMLSelector.setMRMLScene( slicer.mrmlScene ) #self.xformMRMLSelector.setToolTip( "Pick the input to the algorithm." ) parametersFormLayout.addRow("Transform: ", self.xformMRMLSelector) # output directory selector self.outputDirectory = ctk.ctkDirectoryButton() self.outputDirectory.directory = qt.QDir.homePath() parametersFormLayout.addRow("Output Directory: ", self.outputDirectory) # 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) # 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 = False if (self.fixedMRMLSelector.currentNode() and self.movingMRMLSelector.currentNode() and self.xformMRMLSelector.currentNode()): self.applyButton.enabled = True parametersFormLayout.addRow(self.applyButton) # connections self.applyButton.connect('clicked(bool)', self.onApplyButton) self.fixedMRMLSelector.connect( "currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.movingMRMLSelector.connect( "currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.xformMRMLSelector.connect( "currentNodeChanged(vtkMRMLNode*)", self.onSelect) # Add vertical spacer self.layout.addStretch(1)
def setup(self): print "-------Mesh Statistic Widget Setup-------" ScriptedLoadableModuleWidget.setup(self) # ------------------------------------------------------------------------------------- self.modelList = list() self.fieldList = list() self.ROIList = list() self.ROIDict = dict() # Key = Name of ROI # Value = Dictionary of Fields (key = Name of Field # Value = dictionary of shapes # key = name of shapes # value = Statistics store() self.logic = MeshStatisticsLogic(self) # ---------------------------------------------------------------- # # ---------------- Definition of the UI interface ---------------- # # ---------------------------------------------------------------- # # ------------ Loading of the .ui file ---------- # loader = qt.QUiLoader() moduleName = "MeshStatistics" scriptedModulesPath = eval("slicer.modules.%s.path" % moduleName.lower()) scriptedModulesPath = os.path.dirname(scriptedModulesPath) path = os.path.join(scriptedModulesPath, "Resources", "UI", "%s.ui" % moduleName) qfile = qt.QFile(path) qfile.open(qt.QFile.ReadOnly) widget = loader.load(qfile, self.parent) self.layout = self.parent.layout() self.widget = widget self.layout.addWidget(widget) # ------------------------------------------------------------------------------------ # SHAPES INPUT # ------------------------------------------------------------------------------------ self.inputComboBox = self.logic.get("inputComboBox") self.inputComboBox.setMRMLScene(slicer.mrmlScene) self.inputComboBox.connect("checkedNodesChanged()", self.onInputComboBoxCheckedNodesChanged) # ------------------------------------------------------------------------------------ # ROI TABLE # ------------------------------------------------------------------------------------ self.ROIComboBox = self.logic.get("ROIComboBox") self.ROICheckBox = self.logic.get("ROICheckBox") self.ROICheckBox.connect("stateChanged(int)", self.onROICheckBoxStateChanged) # ------------------------------------------------------------------------------------ # FIELD TABLE # ------------------------------------------------------------------------------------ self.tableField = self.logic.get("tableField") self.tableField.setColumnCount(2) self.tableField.setMinimumHeight(250) self.tableField.setHorizontalHeaderLabels([" ", " Field Name "]) self.tableField.setColumnWidth(0, 20) self.tableField.setColumnWidth(1, 260) self.tableField.setSizePolicy(qt.QSizePolicy().Expanding, qt.QSizePolicy().Expanding) # ------------------------------------------------------------------------------------ # RUN # ------------------------------------------------------------------------------------ self.runButton = self.logic.get("runButton") self.runButton.connect("clicked()", self.onRunButton) # ------------------------------------------------------------------------------------ # Statistics Table - Export # ------------------------------------------------------------------------------------ self.mainLayout = self.logic.get("mainLayout") self.tabROI = qt.QTabWidget() self.tabROI.setTabPosition(0) self.tabROI.adjustSize() # ---------------------------- Directory - Export Button ----------------------------- self.directoryExport = ctk.ctkDirectoryButton() self.exportCheckBox = qt.QCheckBox("Separate Files") self.exportCheckBox.setChecked(True) self.exportButton = qt.QPushButton(" Export ") self.exportButton.enabled = True self.exportPointValueCheckBox = qt.QCheckBox("Export Value on Each Point") self.exportLayout = qt.QVBoxLayout() self.directoryAndExportLayout = qt.QHBoxLayout() self.directoryAndExportLayout.addWidget(self.directoryExport) self.directoryAndExportLayout.addWidget(self.exportCheckBox) self.directoryAndExportLayout.addWidget(self.exportPointValueCheckBox) self.exportButtonsLayout = qt.QHBoxLayout() self.exportButtonsLayout.addWidget(self.exportButton) self.exportLayout.addLayout(self.directoryAndExportLayout) self.exportLayout.addLayout(self.exportButtonsLayout) self.layout.addStretch(1) self.logic.updateInterface(self.tableField, self.ROIComboBox, self.ROIList, self.modelList, self.mainLayout) # ------------------------------------------------------------------------------------ # OBSERVERS # ------------------------------------------------------------------------------------ def onCloseScene(obj, event): # initialize Parameters globals()["MeshStatistics"] = slicer.util.reloadScriptedModule("MeshStatistics") slicer.mrmlScene.AddObserver(slicer.mrmlScene.EndCloseEvent, onCloseScene)
def setup( self ): # # Input frame # self.__inputFrame = ctk.ctkCollapsibleButton() self.__inputFrame.text = "Input" self.__inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.__inputFrame) self.layout.addWidget(self.__inputFrame) # Active report node label = qt.QLabel('Report: ') self.reportSelector = slicer.qMRMLNodeComboBox() self.reportSelector.nodeTypes = ['vtkMRMLReportingReportNode'] self.reportSelector.setMRMLScene(slicer.mrmlScene) self.reportSelector.addEnabled = True self.reportSelector.removeEnabled = True inputFrameLayout.addRow(label, self.reportSelector) self.reportSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onReportNodeChanged) # Volume being annotated (only one is allowed for the report) label = qt.QLabel('NOTE: Only volumes loaded from DICOM can be annotated!') inputFrameLayout.addRow(label) label = qt.QLabel('Annotated volume: ') self.volumeSelector = slicer.qMRMLNodeComboBox() self.volumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] # only allow volumes with the attribute DICOM.instanceUIDs self.volumeSelector.addAttribute('vtkMRMLScalarVolumeNode','DICOM.instanceUIDs') self.volumeSelector.setMRMLScene(slicer.mrmlScene) self.volumeSelector.addEnabled = False inputFrameLayout.addRow(label, self.volumeSelector) self.volumeSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onAnnotatedVolumeNodeChanged) # # Annotation frame -- vocabulary-based description of what is # being annotated/marked up in this report # self.__annotationsFrame = ctk.ctkCollapsibleButton() self.__annotationsFrame.text = "Annotation" self.__annotationsFrame.collapsed = 0 annotationsFrameLayout = qt.QFormLayout(self.__annotationsFrame) self.layout.addWidget(self.__annotationsFrame) self.__defaultColorNode = self.__logic.GetDefaultColorNode() self.__toolsColor = EditColor(self.__annotationsFrame,colorNode=self.__defaultColorNode) # # Markup frame -- summary of all the markup elements contained in the # report # self.__markupFrame = ctk.ctkCollapsibleButton() self.__markupFrame.text = "Markup" self.__markupFrame.collapsed = 0 markupFrameLayout = qt.QFormLayout(self.__markupFrame) self.layout.addWidget(self.__markupFrame) self.__markupSliceText = qt.QLabel() markupFrameLayout.addRow(self.__markupSliceText) self.__markupTreeView = ReportingMarkupWidget(self.layout) markupFrameLayout.addRow(self.__markupTreeView.widget) # Editor frame self.__editorFrame = ctk.ctkCollapsibleButton() self.__editorFrame.text = 'Segmentation' self.__editorFrame.collapsed = 0 editorFrameLayout = qt.QFormLayout(self.__editorFrame) label = qt.QLabel('Segmentation volume: ') self.segmentationSelector = slicer.qMRMLNodeComboBox() self.segmentationSelector.nodeTypes = ['vtkMRMLLabelMapVolumeNode'] self.segmentationSelector.setMRMLScene(slicer.mrmlScene) self.segmentationSelector.addEnabled = 1 self.segmentationSelector.noneEnabled = 1 self.segmentationSelector.removeEnabled = 0 self.segmentationSelector.showHidden = 0 self.segmentationSelector.showChildNodeTypes = 0 self.segmentationSelector.selectNodeUponCreation = 1 editorFrameLayout.addRow(label, self.segmentationSelector) editorWidgetParent = slicer.qMRMLWidget() editorWidgetParent.setLayout(qt.QVBoxLayout()) editorWidgetParent.setMRMLScene(slicer.mrmlScene) self.__editorWidget = EditorWidget(parent=editorWidgetParent,showVolumesFrame=False) self.__editorWidget.setup() self.__editorWidget.toolsColor.frame.setVisible(False) editorFrameLayout.addRow(editorWidgetParent) markupFrameLayout.addRow(self.__editorFrame) self.segmentationSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onSegmentationNodeChanged) # IO frame self.__ioFrame = ctk.ctkCollapsibleButton() self.__ioFrame.text = 'Import/Export' self.__ioFrame.collapsed = 1 ioFrameLayout = qt.QGridLayout(self.__ioFrame) self.layout.addWidget(self.__ioFrame) # Buttons to save/load report using AIM XML serialization label = qt.QLabel('Export folder') self.__exportFolderPicker = ctk.ctkDirectoryButton() exportButton = qt.QPushButton('Export') exportButton.connect('clicked()', self.onReportExport) ioFrameLayout.addWidget(label,0,0) ioFrameLayout.addWidget(self.__exportFolderPicker,0,1) ioFrameLayout.addWidget(exportButton,0,2) label = qt.QLabel('AIM file to import') self.__aimFilePicker = qt.QPushButton('N/A') self.__aimFilePicker.connect('clicked()',self.onSelectAIMFile) button = qt.QPushButton('Import') button.connect('clicked()', self.onReportImport) ioFrameLayout.addWidget(label,1,0) ioFrameLayout.addWidget(self.__aimFilePicker,1,1) ioFrameLayout.addWidget(button,1,2) self.importAIMFile = None self.reportSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.updateWidgets) self.volumeSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.updateWidgets) self.updateWidgets() self.layout.addStretch(1) self.__editorParameterNode = self.editUtil.getParameterNode() self.__editorParameterNode.AddObserver(vtk.vtkCommand.ModifiedEvent, self.onEditorParameterNodeChanged)
def setup( self ): # # Input frame # self.__inputFrame = ctk.ctkCollapsibleButton() self.__inputFrame.text = "Input" self.__inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.__inputFrame) self.layout.addWidget(self.__inputFrame) # Active report node label = qt.QLabel('Report: ') self.__reportSelector = slicer.qMRMLNodeComboBox() self.__reportSelector.nodeTypes = ['vtkMRMLReportingReportNode'] self.__reportSelector.setMRMLScene(slicer.mrmlScene) self.__reportSelector.addEnabled = 1 self.__reportSelector.removeEnabled = 0 inputFrameLayout.addRow(label, self.__reportSelector) self.__reportSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onMRMLSceneChanged) self.__reportSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onReportNodeChanged) # Volume being annotated (only one is allowed for the report) label = qt.QLabel('NOTE: Only volumes loaded from DICOM can be annotated!') inputFrameLayout.addRow(label) label = qt.QLabel('Annotated volume: ') self.__volumeSelector = slicer.qMRMLNodeComboBox() self.__volumeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] # only allow volumes with the attribute DICOM.instanceUIDs self.__volumeSelector.addAttribute('vtkMRMLScalarVolumeNode','DICOM.instanceUIDs') self.__volumeSelector.setMRMLScene(slicer.mrmlScene) self.__volumeSelector.addEnabled = False inputFrameLayout.addRow(label, self.__volumeSelector) self.__volumeSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onAnnotatedVolumeNodeChanged) self.__volumeSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onMRMLSceneChanged) # # Annotation frame -- vocabulary-based description of what is # being annotated/marked up in this report # self.__annotationsFrame = ctk.ctkCollapsibleButton() self.__annotationsFrame.text = "Annotation" self.__annotationsFrame.collapsed = 0 annotationsFrameLayout = qt.QFormLayout(self.__annotationsFrame) self.layout.addWidget(self.__annotationsFrame) self.__defaultColorNode = self.__logic.GetDefaultColorNode() self.__toolsColor = EditColor(self.__annotationsFrame,colorNode=self.__defaultColorNode) # # Markup frame -- summary of all the markup elements contained in the # report # self.__markupFrame = ctk.ctkCollapsibleButton() self.__markupFrame.text = "Markup" self.__markupFrame.collapsed = 0 markupFrameLayout = qt.QFormLayout(self.__markupFrame) self.layout.addWidget(self.__markupFrame) # Add a flag to switch between different tree view models self.__useNewTreeView = 1 # Add the tree widget if self.__useNewTreeView == 1: self.__markupTreeView = slicer.modulewidget.qMRMLReportingTreeView() self.__markupTreeView.sceneModelType = "DisplayableHierarchy" else: self.__markupTreeView = slicer.qMRMLTreeView() self.__markupTreeView.sceneModelType = "Displayable" self.__markupTreeView.setMRMLScene(self.__logic.GetMRMLScene()) self.__markupSliceText = qt.QLabel() markupFrameLayout.addRow(self.__markupSliceText) markupFrameLayout.addRow(self.__markupTreeView) # Editor frame self.__editorFrame = ctk.ctkCollapsibleButton() self.__editorFrame.text = 'Segmentation' self.__editorFrame.collapsed = 0 editorFrameLayout = qt.QFormLayout(self.__editorFrame) label = qt.QLabel('Segmentation volume: ') self.__segmentationSelector = slicer.qMRMLNodeComboBox() self.__segmentationSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__segmentationSelector.setMRMLScene(slicer.mrmlScene) self.__segmentationSelector.addEnabled = 1 self.__segmentationSelector.noneEnabled = 1 self.__segmentationSelector.removeEnabled = 0 self.__segmentationSelector.showHidden = 0 self.__segmentationSelector.showChildNodeTypes = 0 self.__segmentationSelector.selectNodeUponCreation = 1 self.__segmentationSelector.addAttribute('vtkMRMLScalarVolumeNode','LabelMap',1) editorFrameLayout.addRow(label, self.__segmentationSelector) editorWidgetParent = slicer.qMRMLWidget() editorWidgetParent.setLayout(qt.QVBoxLayout()) editorWidgetParent.setMRMLScene(slicer.mrmlScene) self.__editorWidget = EditorWidget(parent=editorWidgetParent,showVolumesFrame=False) self.__editorWidget.setup() self.__editorWidget.toolsColor.frame.setVisible(False) editorFrameLayout.addRow(editorWidgetParent) markupFrameLayout.addRow(self.__editorFrame) self.__segmentationSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onSegmentationNodeChanged) self.__segmentationSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onMRMLSceneChanged) # IO frame self.__ioFrame = ctk.ctkCollapsibleButton() self.__ioFrame.text = 'Import/Export' self.__ioFrame.collapsed = 1 ioFrameLayout = qt.QGridLayout(self.__ioFrame) self.layout.addWidget(self.__ioFrame) # Buttons to save/load report using AIM XML serialization label = qt.QLabel('Export folder') self.__exportFolderPicker = ctk.ctkDirectoryButton() exportButton = qt.QPushButton('Export') exportButton.connect('clicked()', self.onReportExport) ioFrameLayout.addWidget(label,0,0) ioFrameLayout.addWidget(self.__exportFolderPicker,0,1) ioFrameLayout.addWidget(exportButton,0,2) label = qt.QLabel('AIM file to import') self.__aimFilePicker = qt.QPushButton('N/A') self.__aimFilePicker.connect('clicked()',self.onSelectAIMFile) button = qt.QPushButton('Import') button.connect('clicked()', self.onReportImport) ioFrameLayout.addWidget(label,1,0) ioFrameLayout.addWidget(self.__aimFilePicker,1,1) ioFrameLayout.addWidget(button,1,2) self.__importAIMFile = None self.__reportSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.updateWidgets) self.__volumeSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.updateWidgets) self.updateWidgets() self.layout.addStretch(1) self.__editorParameterNode = self.editUtil.getParameterNode() self.__editorParameterNode.AddObserver(vtk.vtkCommand.ModifiedEvent, self.onEditorParameterNodeChanged)
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_ParenchymaSubtypeTrainingLogic() self.currentVolumeLoaded = None self.blockNodeEvents = False ########## # Main area self.mainAreaCollapsibleButton = ctk.ctkCollapsibleButton() self.mainAreaCollapsibleButton.text = "Main area" self.layout.addWidget(self.mainAreaCollapsibleButton, SlicerUtil.ALIGNMENT_VERTICAL_TOP) self.mainLayout = qt.QGridLayout(self.mainAreaCollapsibleButton) # Node selector volumeLabel = qt.QLabel("Active volume: ") volumeLabel.setStyleSheet("margin-left:5px") self.mainLayout.addWidget(volumeLabel, 0, 0) self.volumeSelector = slicer.qMRMLNodeComboBox() self.volumeSelector.nodeTypes = ("vtkMRMLScalarVolumeNode", "") self.volumeSelector.selectNodeUponCreation = True self.volumeSelector.autoFillBackground = True self.volumeSelector.addEnabled = False self.volumeSelector.noneEnabled = False self.volumeSelector.removeEnabled = False self.volumeSelector.showHidden = False self.volumeSelector.showChildNodeTypes = False self.volumeSelector.setMRMLScene(slicer.mrmlScene) self.volumeSelector.setFixedWidth(250) self.volumeSelector.setStyleSheet("margin: 15px 0") #self.volumeSelector.selectNodeUponCreation = False self.mainLayout.addWidget(self.volumeSelector, 0, 1, 1, 3) labelsStyle = "font-weight: bold; margin: 0 0 5px 5px;" # Types Radio Buttons typesLabel = qt.QLabel("Select the type") typesLabel.setStyleSheet(labelsStyle) typesLabel.setFixedHeight(15) self.mainLayout.addWidget(typesLabel, 1, 0) self.typesFrame = qt.QFrame() self.typesLayout = qt.QVBoxLayout(self.typesFrame) self.mainLayout.addWidget(self.typesFrame, 2, 0, SlicerUtil.ALIGNMENT_VERTICAL_TOP) self.typesRadioButtonGroup = qt.QButtonGroup() for key in self.logic.params.mainTypes.iterkeys(): rbitem = qt.QRadioButton(self.logic.params.getMainTypeLabel(key)) self.typesRadioButtonGroup.addButton(rbitem, key) self.typesLayout.addWidget(rbitem) self.typesRadioButtonGroup.buttons()[0].setChecked(True) # Subtypes Radio buttons subtypesLabel = qt.QLabel("Select the subtype") subtypesLabel.setStyleSheet(labelsStyle) subtypesLabel.setFixedHeight(15) self.mainLayout.addWidget(subtypesLabel, 1, 1) self.subtypesRadioButtonGroup = qt.QButtonGroup() self.subtypesFrame = qt.QFrame() self.subtypesFrame.setMinimumHeight(275) self.subtypesLayout = qt.QVBoxLayout(self.subtypesFrame) self.subtypesLayout.setAlignment(SlicerUtil.ALIGNMENT_VERTICAL_TOP) self.subtypesLayout.setStretch(0, 0) self.mainLayout.addWidget(self.subtypesFrame, 2, 1, SlicerUtil.ALIGNMENT_VERTICAL_TOP) # Put the frame in the top # The content will be loaded dynamically every time the main type is modified # Artifact radio buttons self.artifactsLabel = qt.QLabel("Artifact") self.artifactsLabel.setStyleSheet(labelsStyle) self.artifactsLabel.setFixedHeight(15) self.mainLayout.addWidget(self.artifactsLabel, 1, 2) #self.mainLayout.addWidget(qt.QLabel("Select the artifact"), 1, 1) self.artifactsRadioButtonGroup = qt.QButtonGroup() self.artifactsFrame = qt.QFrame() self.artifactsLayout = qt.QVBoxLayout(self.artifactsFrame) self.mainLayout.addWidget(self.artifactsFrame, 2, 2, SlicerUtil.ALIGNMENT_VERTICAL_TOP) self.artifactsRadioButtonGroup = qt.QButtonGroup() for artifactId in self.logic.params.artifacts.iterkeys(): rbitem = qt.QRadioButton(self.logic.params.getArtifactLabel(artifactId)) self.artifactsRadioButtonGroup.addButton(rbitem, artifactId) self.artifactsLayout.addWidget(rbitem) self.artifactsRadioButtonGroup.buttons()[0].setChecked(True) # Load caselist button self.loadButton = ctk.ctkPushButton() self.loadButton.text = "Load fiducials file" self.loadButton.setIcon(qt.QIcon("{0}/open_file.png".format(SlicerUtil.CIP_ICON_DIR))) self.loadButton.setIconSize(qt.QSize(20, 20)) self.loadButton.setFixedWidth(135) self.mainLayout.addWidget(self.loadButton, 3, 0) # Remove fiducial button self.removeLastFiducialButton = ctk.ctkPushButton() self.removeLastFiducialButton.text = "Remove last fiducial" self.removeLastFiducialButton.toolTip = "Remove the last fiducial added" self.removeLastFiducialButton.setIcon(qt.QIcon("{0}/delete.png".format(SlicerUtil.CIP_ICON_DIR))) self.removeLastFiducialButton.setIconSize(qt.QSize(20, 20)) self.removeLastFiducialButton.setFixedWidth(200) self.mainLayout.addWidget(self.removeLastFiducialButton, 3, 1) # Save results button self.saveResultsButton = ctk.ctkPushButton() self.saveResultsButton.setText("Save markups") self.saveResultsButton.toolTip = "Save the markups in the specified directory" self.saveResultsButton.setIcon(qt.QIcon("{0}/Save.png".format(SlicerUtil.CIP_ICON_DIR))) self.saveResultsButton.setIconSize(qt.QSize(20,20)) self.mainLayout.addWidget(self.saveResultsButton, 4, 0) # Save results directory button defaultPath = os.path.join(SlicerUtil.getSettingsDataFolder(self.moduleName), "Results") # Assign a default path for the results path = SlicerUtil.settingGetOrSetDefault(self.moduleName, "SaveResultsDirectory", defaultPath) self.saveResultsDirectoryButton = ctk.ctkDirectoryButton() self.saveResultsDirectoryButton.directory = path self.saveResultsDirectoryButton.setMaximumWidth(375) self.mainLayout.addWidget(self.saveResultsDirectoryButton, 4, 1, 1, 2) ##### # Case navigator if SlicerUtil.isSlicerACILLoaded(): caseNavigatorAreaCollapsibleButton = ctk.ctkCollapsibleButton() caseNavigatorAreaCollapsibleButton.text = "Case navigator" self.layout.addWidget(caseNavigatorAreaCollapsibleButton, 0x0020) # caseNavigatorLayout = qt.QVBoxLayout(caseNavigatorAreaCollapsibleButton) # Add a case list navigator from ACIL.ui import CaseNavigatorWidget self.caseNavigatorWidget = CaseNavigatorWidget(self.moduleName, caseNavigatorAreaCollapsibleButton) self.caseNavigatorWidget.setup() # Listen for the event of loading volume #self.caseNavigatorWidget.addObservable(self.caseNavigatorWidget.EVENT_VOLUME_LOADED, self.onNewVolumeLoaded) self.layout.addStretch() self.updateState() # Connections self.typesRadioButtonGroup.connect("buttonClicked (QAbstractButton*)", self.__onTypesRadioButtonClicked__) self.subtypesRadioButtonGroup.connect("buttonClicked (QAbstractButton*)", self.__onSubtypesRadioButtonClicked__) self.artifactsRadioButtonGroup.connect("buttonClicked (QAbstractButton*)", self.__onSubtypesRadioButtonClicked__) self.volumeSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.__onCurrentNodeChanged__) self.loadButton.connect('clicked()', self.openFiducialsFile) self.removeLastFiducialButton.connect('clicked()', self.__onRemoveLastFiducialButtonClicked__) # self.saveResultsOpenDirectoryDialogButton.connect('clicked()', self.onOpenDirectoryDialogButtonClicked) self.saveResultsDirectoryButton.connect("directoryChanged (str)", self.__onSaveResultsDirectoryChanged__) self.saveResultsButton.connect('clicked()', self.__onSaveResultsButtonClicked__) self.observers = [] self.observers.append(slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.NodeAddedEvent, self.__onNodeAddedObserver__)) self.observers.append(slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.EndCloseEvent, self.__onSceneClosed__))
def setup(self): w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout ####################IMPORTAR VOLUMEN 4D#################################################3 ### Se crea la sección para importar importDataCollapsibleButton = ctk.ctkCollapsibleButton() importDataCollapsibleButton.text = "Import DICOM" self.layout.addWidget(importDataCollapsibleButton) importDataFormLayout = qt.QFormLayout(importDataCollapsibleButton) #### Crear desplegable para seleccionar dirección del volumen self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input directory' importDataFormLayout.addRow('Input directory:', self.__fDialog) #### Crear desplegable para seleccionar dirección del volumen 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 = True # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.inputSelector.setMRMLScene(slicer.mrmlScene) importDataFormLayout.addRow("Input node:", self.inputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.inputSelector, 'setMRMLScene(vtkMRMLScene*)') self.__nameFrame = qt.QLineEdit() self.__nameFrame.text = 'NA' importDataFormLayout.addRow('Volume Name', self.__nameFrame) # Botón de importar self.buttonImport = qt.QPushButton("Import") self.buttonImport.toolTip = "Run the algorithm." importDataFormLayout.addRow("", self.buttonImport) self.buttonImport.connect('clicked(bool)', self.importFunction) ### Se crea la sección para exportar exportDataCollapsibleButton = ctk.ctkCollapsibleButton() exportDataCollapsibleButton.text = "Export DICOM" self.layout.addWidget(exportDataCollapsibleButton) exportDataFormLayout = qt.QFormLayout(exportDataCollapsibleButton) ###Selector de volumen donde se guardara el volumen de la direccion self.outputSelector = slicer.qMRMLNodeComboBox() self.outputSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.outputSelector.addEnabled = False # Se habilita la posibildad al usuario de crear un nuevo nodo con este widget self.outputSelector.removeEnabled = False # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.outputSelector.setMRMLScene(slicer.mrmlScene) exportDataFormLayout.addRow("Volumen to export:", self.outputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.outputSelector, 'setMRMLScene(vtkMRMLScene*)') #### Crear desplegable para seleccionar direccion del volumen self.__fDialogOutput = ctk.ctkDirectoryButton() self.__fDialogOutput.caption = 'DICOM directory' exportDataFormLayout.addRow('DiCOM directory:', self.__fDialogOutput) # Botón de exportar self.buttonExport = qt.QPushButton("Export") self.buttonExport.toolTip = "Run the algorithm." exportDataFormLayout.addRow("", self.buttonExport) self.buttonExport.connect('clicked(bool)', self.ExportFunction)
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 = "tipiXExporter 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) # # source directory button # self.sourceButton = ctk.ctkDirectoryButton() self.sourceButton.setToolTip( "Select the directory containing the source image volumes to load." ) parametersFormLayout.addRow("Source Image Files: ", self.sourceButton) # # destination directory button # self.destinationButton = ctk.ctkDirectoryButton() self.destinationButton.setToolTip( "Select the destination for rendered images." ) parametersFormLayout.addRow("Destination Files: ", self.destinationButton) if False: # # 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) # # 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 = "Render the images." 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) # ------------------------------------------------------------------------------------- self.modelList = list() self.fieldList = list() self.ROIList = list() self.ROIDict = dict() # Key = Name of ROI # Value = Dictionary of Fields (key = Name of Field # Value = dictionary of shapes # key = name of shapes # value = Statistics store() self.logic = MeshStatisticsLogic() # ------------------------------------------------------------------------------------ # SHAPES INPUT # ------------------------------------------------------------------------------------ self.inputComboBox = slicer.qMRMLCheckableNodeComboBox() self.inputComboBox.nodeTypes = ['vtkMRMLModelNode'] self.inputComboBox.setMRMLScene(slicer.mrmlScene) inputLayout = qt.QFormLayout() inputLayout.addRow(' Models: ', self.inputComboBox) self.layout.addLayout(inputLayout) self.inputComboBox.connect('checkedNodesChanged()', self.onInputComboBoxCheckedNodesChanged) # ------------------------------------------------------------------------------------ # ROI TABLE # ------------------------------------------------------------------------------------ self.ROIComboBox = ctk.ctkComboBox() self.ROIComboBox.adjustSize() self.ROICheckBox = qt.QCheckBox('All') ROILayout = qt.QHBoxLayout() ROILayout_0 = qt.QFormLayout() ROILayout_0.addRow(' Region considered: ', self.ROIComboBox) ROILayout.addLayout(ROILayout_0) ROILayout.addWidget(self.ROICheckBox) self.layout.addLayout(ROILayout) self.ROICheckBox.connect('stateChanged(int)', self.onROICheckBoxStateChanged) # ------------------------------------------------------------------------------------ # FIELD TABLE # ------------------------------------------------------------------------------------ self.tableField = qt.QTableWidget() self.tableField.setColumnCount(2) self.tableField.setMinimumHeight(250) self.tableField.setHorizontalHeaderLabels([' ', ' Field Name ']) self.tableField.setColumnWidth(0, 20) self.tableField.setColumnWidth(1, 260) self.tableField.setSizePolicy(qt.QSizePolicy().Expanding, qt.QSizePolicy().Expanding) label = qt.QLabel(' Select a Field to compute statistics on:') self.fieldLayout = qt.QVBoxLayout() self.fieldLayout.addWidget(label) self.fieldLayout.addWidget(self.tableField) self.layout.addLayout(self.fieldLayout) # ------------------------------------------------------------------------------------ # RUN # ------------------------------------------------------------------------------------ self.runButton = qt.QPushButton(' Run ') self.runButton.enabled = False roiLayout = qt.QHBoxLayout() roiLayout.addWidget(self.runButton) self.layout.addLayout(roiLayout) self.runButton.connect('clicked()', self.onRunButton) # ------------------------------------------------------------------------------------ # Statistics Table - Export # ------------------------------------------------------------------------------------ self.tabROI = qt.QTabWidget() self.tabROI.setTabPosition(0) self.tabROI.adjustSize() # ---------------------------- Directory - Export Button ----------------------------- self.directoryExport = ctk.ctkDirectoryButton() self.exportCheckBox = qt.QCheckBox('Separate Files') self.exportCheckBox.setChecked(True) self.exportButton = qt.QPushButton(' Export ') self.exportButton.enabled = True self.exportPointValueCheckBox = qt.QCheckBox('Export Value on Each Point') self.exportLayout = qt.QVBoxLayout() self.directoryAndExportLayout = qt.QHBoxLayout() self.directoryAndExportLayout.addWidget(self.directoryExport) self.directoryAndExportLayout.addWidget(self.exportCheckBox) self.directoryAndExportLayout.addWidget(self.exportPointValueCheckBox) self.exportButtonsLayout = qt.QHBoxLayout() self.exportButtonsLayout.addWidget(self.exportButton) self.exportLayout.addLayout(self.directoryAndExportLayout) self.exportLayout.addLayout(self.exportButtonsLayout) self.layout.addStretch(1) self.logic.updateInterface(self.tableField, self.ROIComboBox, self.ROIList, self.modelList, self.layout) # ------------------------------------------------------------------------------------ # OBSERVERS # ------------------------------------------------------------------------------------ def onCloseScene(obj, event): # initialize Parameters globals()['MeshStatistics'] = slicer.util.reloadScriptedModule('MeshStatistics') slicer.mrmlScene.AddObserver(slicer.mrmlScene.EndCloseEvent, onCloseScene)
def setup(self): w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout ####################IMPORTAR VOLUMEN 4D#################################################3 ### Se crea la sección para cargar el volumen 4D en una pestaña desplegable importDataCollapsibleButton = ctk.ctkCollapsibleButton() importDataCollapsibleButton.text = "Import Data" self.layout.addWidget(importDataCollapsibleButton) importDataFormLayout = qt.QFormLayout(importDataCollapsibleButton) #### Crear desplegable para seleccionar dirección del volumen self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input directory' importDataFormLayout.addRow('Input directory:', self.__fDialog) ###Selector de volumen donde se guardara el volumen de la direccion self.outputSelector = slicer.qMRMLNodeComboBox() self.outputSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.outputSelector.addEnabled = True # Se habilita la posibildad al usuario de crear un nuevo nodo con este widget self.outputSelector.removeEnabled = False # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.outputSelector.setMRMLScene(slicer.mrmlScene) importDataFormLayout.addRow("Output node:", self.outputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.outputSelector, 'setMRMLScene(vtkMRMLScene*)') ### Parametros avanzados self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = 'NA' importDataFormLayout.addRow('Frame identifying DICOM tag:', self.__dicomTag) self.__veLabel = qt.QLineEdit() self.__veLabel.text = 'na' importDataFormLayout.addRow('Frame identifying units:', self.__veLabel) self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 importDataFormLayout.addRow('Initial value:', self.__veInitial) self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 importDataFormLayout.addRow('Step:', self.__veStep) self.__te = qt.QDoubleSpinBox() self.__te.value = 1 importDataFormLayout.addRow('EchoTime:', self.__te) self.__tr = qt.QDoubleSpinBox() self.__tr.value = 1 importDataFormLayout.addRow('RepetitionTime:', self.__tr) self.__fa = qt.QDoubleSpinBox() self.__fa.value = 1 importDataFormLayout.addRow('FlipAngle:', self.__fa) # Botón de importar self.buttonImport = qt.QPushButton("Import") self.buttonImport.toolTip = "Run the algorithm." ##self.buttonImport.enabled = True importDataFormLayout.addRow(" ", self.buttonImport) self.buttonImport.connect('clicked(bool)', self.importFunction)
def setup(self): # Instantiate and connect widgets ... # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Basic settings" self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) # add input directory selector label = qt.QLabel("Input directory:") self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = "Input directory" dummyFormLayout.addRow(label, self.__fDialog) label = qt.QLabel("Output node:") self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ["vtkMRMLMultiVolumeNode"] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect("mrmlSceneChanged(vtkMRMLScene*)", self.onMRMLSceneChanged) self.__mvSelector.addEnabled = 1 dummyFormLayout.addRow(label, self.__mvSelector) # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Advanced settings" dummyCollapsibleButton.collapsed = 1 self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) self.__advancedFrame = dummyCollapsibleButton label = qt.QLabel("Frame identifying DICOM tag (if known):") self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = "NA" dummyFormLayout.addRow(label, self.__dicomTag) label = qt.QLabel("Frame identifying units:") self.__veLabel = qt.QLineEdit() self.__veLabel.text = "na" dummyFormLayout.addRow(label, self.__veLabel) label = qt.QLabel("Initial value:") self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 dummyFormLayout.addRow(label, self.__veInitial) label = qt.QLabel("Step:") self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 dummyFormLayout.addRow(label, self.__veStep) label = qt.QLabel("EchoTime:") self.__te = qt.QDoubleSpinBox() self.__te.value = 1 dummyFormLayout.addRow(label, self.__te) label = qt.QLabel("RepetitionTime:") self.__tr = qt.QDoubleSpinBox() self.__tr.value = 1 dummyFormLayout.addRow(label, self.__tr) label = qt.QLabel("FlipAngle:") self.__fa = qt.QDoubleSpinBox() self.__fa.value = 1 dummyFormLayout.addRow(label, self.__fa) importButton = qt.QPushButton("Import") importButton.toolTip = "Import the contents of the directory as a MultiVolume" self.layout.addWidget(importButton) importButton.connect("clicked(bool)", self.onImportButtonClicked) self.__status = qt.QLabel("Status: Idle") self.layout.addWidget(self.__status) # Add vertical spacer self.layout.addStretch(1)
def setup(self): w = qt.QWidget(); layout = qt.QGridLayout(); w.setLayout(layout); self.layout.addWidget(w); w.show(); self.layout = layout; ####################IMPORTAR VOLUMEN 4D#################################################3 ### Se crea la sección para cargar el volumen 4D en una pestaña desplegable importDataCollapsibleButton = ctk.ctkCollapsibleButton() importDataCollapsibleButton.text = "Import Data" self.layout.addWidget(importDataCollapsibleButton) importDataFormLayout = qt.QFormLayout(importDataCollapsibleButton) #### Crear desplegable para seleccionar dirección del volumen self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input directory' importDataFormLayout.addRow('Input directory:', self.__fDialog) ###Selector de volumen donde se guardara el volumen de la direccion self.outputSelector = slicer.qMRMLNodeComboBox() self.outputSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.outputSelector.addEnabled = True # Se habilita la posibildad al usuario de crear un nuevo nodo con este widget self.outputSelector.removeEnabled = False # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.outputSelector.setMRMLScene(slicer.mrmlScene) importDataFormLayout.addRow("Output node:", self.outputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.outputSelector, 'setMRMLScene(vtkMRMLScene*)') ### Parametros avanzados self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = 'NA' importDataFormLayout.addRow('Frame identifying DICOM tag:', self.__dicomTag) self.__veLabel = qt.QLineEdit() self.__veLabel.text = 'na' importDataFormLayout.addRow('Frame identifying units:', self.__veLabel) self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 importDataFormLayout.addRow('Initial value:', self.__veInitial) self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 importDataFormLayout.addRow('Step:', self.__veStep) self.__te = qt.QDoubleSpinBox() self.__te.value = 1 importDataFormLayout.addRow('EchoTime:', self.__te) self.__tr = qt.QDoubleSpinBox() self.__tr.value = 1 importDataFormLayout.addRow('RepetitionTime:', self.__tr) self.__fa = qt.QDoubleSpinBox() self.__fa.value = 1 importDataFormLayout.addRow('FlipAngle:', self.__fa) # Botón de importar self.buttonImport = qt.QPushButton("Import") self.buttonImport.toolTip = "Run the algorithm." ##self.buttonImport.enabled = True importDataFormLayout.addRow(" ", self.buttonImport) self.buttonImport.connect('clicked(bool)', self.importFunction) ##self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) ################################### PARÁMETROS DE PROCESAMIENTO################################################# ## # Se crea la sección para seleccionar parámetros el volumen 4D en una pestaña desplegable parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) self.inputSelector = slicer.qMRMLNodeComboBox() self.inputSelector.nodeTypes = ["vtkMRMLMultiVolumeNode"] self.inputSelector.selectNodeUponCreation = True self.inputSelector.addEnabled = True self.inputSelector.removeEnabled = False self.inputSelector.noneEnabled = True self.inputSelector.showHidden = False self.inputSelector.showChildNodeTypes = False self.inputSelector.setMRMLScene( slicer.mrmlScene ) self.inputSelector.setToolTip( "Pick the input to the algorithm." ) parametersFormLayout.addRow("Volumen 4D: ", self.inputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.inputSelector, 'setMRMLScene(vtkMRMLScene*)') ##########################PROCESAMIENTO########################################################################## ## # Se crea la sección para seleccionar procesamiento del volumen 4D en una pestaña desplegable processingCollapsibleButton = ctk.ctkCollapsibleButton() processingCollapsibleButton.text = "Processing" self.layout.addWidget(processingCollapsibleButton) processingFormLayout = qt.QFormLayout(processingCollapsibleButton) # Botón de Segmentación #Este botón solo se activa si el multivolumen ha sido seleccionado en la #ventana desplegable de Volumen 4D. Al presionarlo, el algoritmo #realiza el registro de los diferentes volumenes en el volumen 4D self.buttonSegmentation = qt.QPushButton("Segmentation") self.buttonSegmentation.toolTip = "Run the algorithm." self.buttonSegmentation.enabled = True processingFormLayout.addRow(" ", self.buttonSegmentation) # Botón de modelo 3D #Este botón solo se activa si el multivolumen ha sido seleccionado en la #ventana desplegable de Volumen 4D. Al presionarlo, el algoritmo #realiza el registro de los diferentes volumenes en el volumen 4D self.buttonModel = qt.QPushButton("Show 3D model") self.buttonModel.toolTip = "Run the algorithm." self.buttonModel.enabled = True processingFormLayout.addRow(" ",self.buttonModel) ########################################CURVAS####################################################### ## # Se crea la sección para seleccionar curvas del volumen 4D en una pestaña desplegable curvesCollapsibleButton = ctk.ctkCollapsibleButton() curvesCollapsibleButton.text = "Curves" self.layout.addWidget(curvesCollapsibleButton) curvesFormLayout = qt.QFormLayout(curvesCollapsibleButton) # Botón de generación de curvas #Este botón solo se activa si el multivolumen ha sido seleccionado en la #ventana desplegable de Volumen 4D. Al presionarlo, el algoritmo #realiza el registro de los diferentes volumenes en el volumen 4D self.buttonCurves = qt.QPushButton("Generate curves") self.buttonCurves.toolTip = "Run the algorithm." self.buttonCurves.enabled = True curvesFormLayout.addRow(" ",self.buttonCurves)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... if not NUMPY_AVAILABLE: label = qt.QLabel( 'The module is not available due to missing Numpy package.') self.layout.addWidget(label) label = qt.QLabel( 'You can seek help by contacting 3D Slicer user list: [email protected]' ) self.layout.addWidget(label) # Add vertical spacer self.layout.addStretch(1) return # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Basic settings" self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) # add input directory selector label = qt.QLabel('Input directory:') self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input directory' dummyFormLayout.addRow(label, self.__fDialog) label = qt.QLabel('Output node:') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onMRMLSceneChanged) self.__mvSelector.addEnabled = 1 dummyFormLayout.addRow(label, self.__mvSelector) # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Advanced settings" dummyCollapsibleButton.collapsed = 1 self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) self.__advancedFrame = dummyCollapsibleButton label = qt.QLabel('Frame identifying DICOM tag (if known):') self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = 'NA' dummyFormLayout.addRow(label, self.__dicomTag) label = qt.QLabel('Frame identifying units:') self.__veLabel = qt.QLineEdit() self.__veLabel.text = 'na' dummyFormLayout.addRow(label, self.__veLabel) label = qt.QLabel('Initial value:') self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 dummyFormLayout.addRow(label, self.__veInitial) label = qt.QLabel('Step:') self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 dummyFormLayout.addRow(label, self.__veStep) label = qt.QLabel('EchoTime:') self.__te = qt.QDoubleSpinBox() self.__te.value = 1 dummyFormLayout.addRow(label, self.__te) label = qt.QLabel('RepetitionTime:') self.__tr = qt.QDoubleSpinBox() self.__tr.value = 1 dummyFormLayout.addRow(label, self.__tr) label = qt.QLabel('FlipAngle:') self.__fa = qt.QDoubleSpinBox() self.__fa.value = 1 dummyFormLayout.addRow(label, self.__fa) importButton = qt.QPushButton("Import") importButton.toolTip = "Import the contents of the directory as a MultiVolume" self.layout.addWidget(importButton) importButton.connect('clicked(bool)', self.onImportButtonClicked) self.__status = qt.QLabel('Status: Idle') self.layout.addWidget(self.__status) # Add vertical spacer self.layout.addStretch(1)
def setup(self): """Init the widget """ self.modulePath = SlicerUtil.getModuleFolder("CIP_GetImage") self.resourcesPath = os.path.join(self.modulePath, "CIP_GetImage_Resources") self.StudyId = "" self.logic = CIP_GetImageLogic(self.modulePath) # Widget to load cases faster self.loadSaveDatabuttonsWidget = CIPUI.LoadSaveDataWidget(parentWidget=self.parent) self.loadSaveDatabuttonsWidget.setup(moduleName="CIP_GetImage") # # Obligatory parameters area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Image data" self.layout.addWidget(parametersCollapsibleButton) parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # Study radio buttons label = qt.QLabel() label.text = "Select the study:" parametersFormLayout.addRow(label) self.rbgStudy=qt.QButtonGroup() for key in self.studyIds: rbStudyid = qt.QRadioButton(key) self.rbgStudy.addButton(rbStudyid) parametersFormLayout.addWidget(rbStudyid) self.txtOtherStudy = qt.QLineEdit() self.txtOtherStudy.hide() parametersFormLayout.addWidget(self.txtOtherStudy) # Case id self.txtCaseId = qt.QLineEdit() parametersFormLayout.addRow("Case ID ", self.txtCaseId) # Image types label = qt.QLabel() label.text = "Select the images that you want to load:" parametersFormLayout.addRow(label) self.cbsImageTypes = [] for key in self.imageTypes: check = qt.QCheckBox() check.checked = True check.setText(key) parametersFormLayout.addWidget(check) self.cbsImageTypes.append(check) # Label maps label = qt.QLabel() label.text = "Select the label maps that you want to load:" parametersFormLayout.addRow(label) # Labelmap types checkboxes self.cbsLabelMapTypes = [] for key in self.labelMapTypes: check = qt.QCheckBox() check.setText(key) check.checked = self.labelMapTypes[key][0] parametersFormLayout.addWidget(check) self.cbsLabelMapTypes.append(check) # Load image Button self.downloadButton = qt.QPushButton("Download") self.downloadButton.toolTip = "Load the image" #self.downloadButton.enabled = False self.downloadButton.setStyleSheet("background-color: green; font-weight:bold; color:white" ) parametersFormLayout.addRow(self.downloadButton) self.downloadButton.connect('clicked (bool)', self.onDownloadButton) # Information message self.lblDownloading = qt.QLabel() self.lblDownloading.text = "Downloading images. Please wait..." self.lblDownloading.hide() parametersFormLayout.addRow(self.lblDownloading) # # Optional Parameters # optionalParametersCollapsibleButton = ctk.ctkCollapsibleButton() optionalParametersCollapsibleButton.text = "Optional parameters" self.layout.addWidget(optionalParametersCollapsibleButton) optionalParametersFormLayout = qt.QFormLayout(optionalParametersCollapsibleButton) # Local storage (Slicer temporary path) self.localStoragePath = "{0}/CIP".format(slicer.app.temporaryPath) if not os.path.exists(self.localStoragePath): os.makedirs(self.localStoragePath) # Make sure that everybody has write permissions (sometimes there are problems because of umask) os.chmod(self.localStoragePath, 0777) self.storagePathButton = ctk.ctkDirectoryButton() self.storagePathButton.directory = self.localStoragePath optionalParametersFormLayout.addRow("Local directory: ", self.storagePathButton) # Connection type (SSH, "normal") label = qt.QLabel() label.text = "Connection type:" optionalParametersFormLayout.addRow(label) self.rbgConnectionType=qt.QButtonGroup() self.rbSSH = qt.QRadioButton("SSH (secure connection)") self.rbSSH.setChecked(True) self.rbgConnectionType.addButton(self.rbSSH) optionalParametersFormLayout.addWidget(self.rbSSH) self.rbCP = qt.QRadioButton("Common") self.rbgConnectionType.addButton(self.rbCP) optionalParametersFormLayout.addWidget(self.rbCP) # SSH Server login self.txtServer = qt.QLineEdit() s = SlicerUtil.settingGetOrSetDefault("CIP_GetImage", "server", "This is your ssh user and server. Example: [email protected]") self.txtServer.text = s # This is your ssh user and server. Example: [email protected]" optionalParametersFormLayout.addRow("Server:", self.txtServer) # Server root path self.txtServerpath = qt.QLineEdit() s = SlicerUtil.settingGetOrSetDefault("CIP_GetImage", "serverRootPath", "This is your root path to search for files. Ex: /Cases/Processed") self.txtServerpath.text = s # This is your root path to search for files. Ex: /Cases/Processed optionalParametersFormLayout.addRow("Server root path:", self.txtServerpath) # SSH Private key self.txtPrivateKeySSH = qt.QLineEdit() s = SlicerUtil.settingGetOrSetDefault("CIP_GetImage", "sshKey", "") self.txtPrivateKeySSH.text = s # this is the full path to your ssh key if you need it. Be aware of Unix/Windows comaptibility (hint: use os.path.join) # Please notice that you won't need a SSH key if your computer already has one locally installed" optionalParametersFormLayout.addRow("SSH private key (leave blank for computer's default): ", self.txtPrivateKeySSH) # Cache mode self.cbCacheMode = qt.QCheckBox("Cache mode activated") self.cbCacheMode.setChecked(True) # Cache mode is activated by default optionalParametersFormLayout.addRow("", self.cbCacheMode) # Clean cache Button self.cleanCacheButton = qt.QPushButton("Clean cache") self.cleanCacheButton.toolTip = "Remove all the local cached files" optionalParametersFormLayout.addRow(self.cleanCacheButton) optionalParametersCollapsibleButton.collapsed = True if SlicerUtil.IsDevelopment: # reload button self.reloadButton = qt.QPushButton("Reload (just development)") self.reloadButton.toolTip = "Reload this module (for development purposes)." self.reloadButton.name = "Reload" self.layout.addWidget(self.reloadButton) self.reloadButton.connect('clicked()', self.onReload) # Add vertical spacer self.layout.addStretch(1) # Connections self.rbgStudy.connect("buttonClicked (QAbstractButton*)", self.onRbStudyClicked) self.txtOtherStudy.connect("textEdited (QString)", self.onTxtOtherStudyEdited) self.rbgConnectionType.connect("buttonClicked (QAbstractButton*)", self.onRbgConnectionType) self.storagePathButton.connect("directorySelected(QString)", self.onTmpDirChanged) self.cleanCacheButton.connect('clicked (bool)', self.onCleanCacheButtonClicked)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... ### Parameters Area inputCollapsibleButton = ctk.ctkCollapsibleButton() inputCollapsibleButton.text = "Input" self.layout.addWidget(inputCollapsibleButton) # Layout within the dummy collapsible button inputFormLayout = qt.QFormLayout(inputCollapsibleButton) # fixed landmarks (mrml input) self.fixedLandmarks = slicer.qMRMLNodeComboBox() self.fixedLandmarks.nodeTypes = ["vtkMRMLMarkupsFiducialNode"] self.fixedLandmarks.selectNodeUponCreation = True self.fixedLandmarks.addEnabled = False self.fixedLandmarks.removeEnabled = False self.fixedLandmarks.noneEnabled = True self.fixedLandmarks.showHidden = False self.fixedLandmarks.renameEnabled = True self.fixedLandmarks.setMRMLScene(slicer.mrmlScene) self.fixedLandmarks.setToolTip("Landmarks on fixed image.") inputFormLayout.addRow("Fixed landmarks: ", self.fixedLandmarks) # fixed landmarks (directory input) self.fixedLandmarksDirectory = ctk.ctkDirectoryButton() self.fixedLandmarksDirectory.directory = qt.QDir.homePath() inputFormLayout.addRow("", self.fixedLandmarksDirectory) # moving landmarks (mrml input) self.movingLandmarks = slicer.qMRMLNodeComboBox() self.movingLandmarks.nodeTypes = ["vtkMRMLMarkupsFiducialNode"] self.movingLandmarks.selectNodeUponCreation = True self.movingLandmarks.addEnabled = False self.movingLandmarks.removeEnabled = False self.movingLandmarks.noneEnabled = True self.movingLandmarks.showHidden = False self.movingLandmarks.showChildNodeTypes = False self.movingLandmarks.setMRMLScene(slicer.mrmlScene) self.movingLandmarks.setToolTip("Landmarks on moving image.") inputFormLayout.addRow("Moving landmarks: ", self.movingLandmarks) self.view = qt.QTableView() self.view.sortingEnabled = True self.parent.layout().addWidget(self.view) # moving landmarks (directory input) self.movingLandmarksDirectory = ctk.ctkDirectoryButton() self.movingLandmarksDirectory.directory = qt.QDir.homePath() inputFormLayout.addRow("", self.movingLandmarksDirectory) # Apply Button self.applyButton = qt.QPushButton("Apply") self.applyButton.toolTip = "Run the algorithm." self.applyButton.enabled = True self.layout.addWidget(self.applyButton) ### Output Area outputCollapsibleButton = ctk.ctkCollapsibleButton() outputCollapsibleButton.text = "Output statistics" self.layout.addWidget(outputCollapsibleButton) # Layout within the dummy collapsible button outputFormLayout = qt.QFormLayout(outputCollapsibleButton) # output statistics buttonLayout = qt.QHBoxLayout() self.averageError = qt.QLineEdit() self.averageErrorValue = 1 self.averageError.setToolTip("Average landmark separation") buttonLayout.addWidget(self.averageError) outputFormLayout.addRow("Average error:", buttonLayout) buttonLayout = qt.QHBoxLayout() self.Variance = qt.QLineEdit() self.VarianceValue = 1 self.Variance.setToolTip("Variance") buttonLayout.addWidget(self.Variance) outputFormLayout.addRow("Variance:", buttonLayout) buttonLayout = qt.QHBoxLayout() self.stDev = qt.QLineEdit() self.stDevValue = 1 self.stDev.setToolTip("Standard deviation") buttonLayout.addWidget(self.stDev) outputFormLayout.addRow("Standard deviation:", buttonLayout) # model and view for stats table self.view = qt.QTableView() self.view.sortingEnabled = True self.parent.layout().addWidget(self.view) # connections self.fixedLandmarks.connect("currentNodeChanged(vtkMRMLNode*)", self.onFixedLandmarksSelect) self.movingLandmarks.connect("currentNodeChanged(vtkMRMLNode*)", self.onMovingLandmarksSelect) self.applyButton.connect("clicked(bool)", self.onMismatchErrorApply)
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 - CT Image # self.inputSelectorCTImage = slicer.qMRMLNodeComboBox() self.inputSelectorCTImage.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.inputSelectorCTImage.selectNodeUponCreation = True self.inputSelectorCTImage.addEnabled = False self.inputSelectorCTImage.removeEnabled = False self.inputSelectorCTImage.noneEnabled = False self.inputSelectorCTImage.showHidden = False self.inputSelectorCTImage.showChildNodeTypes = False self.inputSelectorCTImage.setMRMLScene(slicer.mrmlScene) self.inputSelectorCTImage.setToolTip( "Pick the input to the algorithm.") parametersFormLayout.addRow("Reference CT Image: ", self.inputSelectorCTImage) # # input volume selector - Spheres label # self.inputSelectorMaskImg = slicer.qMRMLNodeComboBox() self.inputSelectorMaskImg.nodeTypes = ["vtkMRMLLabelMapVolumeNode"] self.inputSelectorMaskImg.selectNodeUponCreation = True self.inputSelectorMaskImg.addEnabled = False self.inputSelectorMaskImg.removeEnabled = False self.inputSelectorMaskImg.noneEnabled = False self.inputSelectorMaskImg.showHidden = False self.inputSelectorMaskImg.showChildNodeTypes = False self.inputSelectorMaskImg.setMRMLScene(slicer.mrmlScene) self.inputSelectorMaskImg.setToolTip( "Pick the input to the algorithm.") parametersFormLayout.addRow("Spheres label (CT space): ", self.inputSelectorMaskImg) # # input volume selector - MRI Image # self.inputSelectorMRImage = slicer.qMRMLNodeComboBox() self.inputSelectorMRImage.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.inputSelectorMRImage.selectNodeUponCreation = True self.inputSelectorMRImage.addEnabled = False self.inputSelectorMRImage.removeEnabled = False self.inputSelectorMRImage.noneEnabled = False self.inputSelectorMRImage.showHidden = False self.inputSelectorMRImage.showChildNodeTypes = False self.inputSelectorMRImage.setMRMLScene(slicer.mrmlScene) self.inputSelectorMRImage.setToolTip( "Pick the input to the algorithm.") parametersFormLayout.addRow("MR Image to analyse: ", self.inputSelectorMRImage) # # Output director Button # label = qt.QLabel('Directory output:') self.OutputDirectory = ctk.ctkDirectoryButton() self.OutputDirectory.directory = u'//s-grp/grp/Imagerie/CQ/IRM/Resultats_mensuel' self.OutputDirectory.caption = 'Output directory' parametersFormLayout.addRow(label, self.OutputDirectory) # # Registration Button # self.RegistrationButton = qt.QPushButton("1) Registration") self.RegistrationButton.toolTip = "Run the algorithm." self.RegistrationButton.enabled = False parametersFormLayout.addRow(self.RegistrationButton) # # Geometric distorsion Button # self.GeoDistorsionButton = qt.QPushButton( "2A) Geometric distorsion analysis") self.GeoDistorsionButton.toolTip = "Run the geometric distorsion algorithm." self.GeoDistorsionButton.enabled = False parametersFormLayout.addRow(self.GeoDistorsionButton) # # input volume selector - geometric distorsion result volume # self.inputSelectorGeoDistorsionResult = slicer.qMRMLNodeComboBox() self.inputSelectorGeoDistorsionResult.nodeTypes = [ "vtkMRMLScalarVolumeNode" ] self.inputSelectorGeoDistorsionResult.selectNodeUponCreation = True self.inputSelectorGeoDistorsionResult.addEnabled = False self.inputSelectorGeoDistorsionResult.removeEnabled = False self.inputSelectorGeoDistorsionResult.noneEnabled = True self.inputSelectorGeoDistorsionResult.showHidden = False self.inputSelectorGeoDistorsionResult.showChildNodeTypes = False self.inputSelectorGeoDistorsionResult.setMRMLScene(slicer.mrmlScene) self.inputSelectorGeoDistorsionResult.setToolTip( "Pick the input to the algorithm.") parametersFormLayout.addRow( "Geometric distorsion result image (only for testing, let it in none): ", self.inputSelectorGeoDistorsionResult) # # Show 3D Geometric distorsion Button # self.Show3DGeoDistorsionButton = qt.QPushButton( "2B) Show 3D Geometric distorsion results") self.Show3DGeoDistorsionButton.toolTip = "Run the Show3D algorithm." self.Show3DGeoDistorsionButton.enabled = True parametersFormLayout.addRow(self.Show3DGeoDistorsionButton) # # SNR Button # self.SNRButton = qt.QPushButton("3) Signal to Noise Ratio analysis") self.SNRButton.toolTip = "Run the SNR algorithm." self.SNRButton.enabled = True parametersFormLayout.addRow(self.SNRButton) # # Signal Linearity Button # self.SignalLinearityButton = qt.QPushButton( "4) Signal Linearity analysis") self.SignalLinearityButton.toolTip = "Run the analysis of the mean signal in the principales spheres." self.SignalLinearityButton.enabled = True parametersFormLayout.addRow(self.SignalLinearityButton) # connections self.RegistrationButton.connect('clicked(bool)', self.onRegistrationButton) self.SNRButton.connect('clicked(bool)', self.onSNRButton) self.SignalLinearityButton.connect('clicked(bool)', self.onSignalLinearityButton) self.GeoDistorsionButton.connect('clicked(bool)', self.onGeoDistorsionButton) self.Show3DGeoDistorsionButton.connect( 'clicked(bool)', self.onShow3DGeoDistorsionButton) self.inputSelectorCTImage.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.inputSelectorMaskImg.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.inputSelectorMRImage.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.inputSelectorGeoDistorsionResult.connect( "currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.OutputDirectory.connect("Output directory)", self.onSelect) # Add vertical spacer self.layout.addStretch(1) # Refresh regsitration and SNR buttons state self.onSelect()
def setup(self): w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout ####################IMPORTAR VOLUMEN 4D#################################################3 ### Se crea la sección para cargar el volumen 4D en una pestaña desplegable importDataCollapsibleButton = ctk.ctkCollapsibleButton() importDataCollapsibleButton.text = "Import Data" self.layout.addWidget(importDataCollapsibleButton) importDataFormLayout = qt.QFormLayout(importDataCollapsibleButton) #### Crear desplegable para seleccionar dirección del volumen self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input directory' importDataFormLayout.addRow('Input directory:', self.__fDialog) ###Selector de volumen donde se guardara el volumen de la direccion self.outputSelector = slicer.qMRMLNodeComboBox() self.outputSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.outputSelector.addEnabled = True # Se habilita la posibildad al usuario de crear un nuevo nodo con este widget self.outputSelector.removeEnabled = False # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.outputSelector.setMRMLScene(slicer.mrmlScene) importDataFormLayout.addRow("Output node:", self.outputSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.outputSelector, 'setMRMLScene(vtkMRMLScene*)') ### Parametros avanzados self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = 'NA' importDataFormLayout.addRow('Frame identifying DICOM tag:', self.__dicomTag) self.__veLabel = qt.QLineEdit() self.__veLabel.text = 'na' importDataFormLayout.addRow('Frame identifying units:', self.__veLabel) self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 importDataFormLayout.addRow('Initial value:', self.__veInitial) self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 importDataFormLayout.addRow('Step:', self.__veStep) self.__te = qt.QDoubleSpinBox() self.__te.value = 1 importDataFormLayout.addRow('EchoTime:', self.__te) self.__tr = qt.QDoubleSpinBox() self.__tr.value = 1 importDataFormLayout.addRow('RepetitionTime:', self.__tr) self.__fa = qt.QDoubleSpinBox() self.__fa.value = 1 importDataFormLayout.addRow('FlipAngle:', self.__fa) # Botón de importar self.buttonImport = qt.QPushButton("Import") self.buttonImport.toolTip = "Run the algorithm." ##self.buttonImport.enabled = True importDataFormLayout.addRow(" ", self.buttonImport) self.buttonImport.connect('clicked(bool)', self.importFunction) ##self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) ###########################REGISTRO########################################## ## # Se crea una sección de parámetros en una pestaña desplegable registerCollapsibleButton = ctk.ctkCollapsibleButton() registerCollapsibleButton.text = "Register" self.layout.addWidget(registerCollapsibleButton) registerFormLayout = qt.QFormLayout(registerCollapsibleButton) #Se crea una ventana desplegable en la cual se ingresa el volumen 4D de #entrada que se quiere registrar, este volumen debe ser de tipo #"vtkMRMLMultiVolumeNode", además si se tienen varios multivolumenes cargados #se puede elegir entre ellos el que se desea registrar self.inputRegSelector = slicer.qMRMLNodeComboBox() self.inputRegSelector.nodeTypes = ["vtkMRMLMultiVolumeNode"] self.inputRegSelector.selectNodeUponCreation = True self.inputRegSelector.addEnabled = True self.inputRegSelector.removeEnabled = False self.inputRegSelector.noneEnabled = True self.inputRegSelector.showHidden = False self.inputRegSelector.showChildNodeTypes = False self.inputRegSelector.setMRMLScene(slicer.mrmlScene) self.inputRegSelector.setToolTip("Pick the input to the algorithm.") registerFormLayout.addRow("Volumen 4D: ", self.inputRegSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.inputRegSelector, 'setMRMLScene(vtkMRMLScene*)') ###Selector de volumen donde se guardara el volumen de la direccion self.outputRegSelector = slicer.qMRMLNodeComboBox() self.outputRegSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.outputRegSelector.addEnabled = True # Se habilita la posibildad al usuario de crear un nuevo nodo con este widget self.outputRegSelector.removeEnabled = False # Se le quita al usuario la posibilidad de eliminar el nodo seleccionado en ese momento self.outputRegSelector.setMRMLScene(slicer.mrmlScene) registerFormLayout.addRow("Output node:", self.outputRegSelector) self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.outputRegSelector, 'setMRMLScene(vtkMRMLScene*)') # Botón de Registro #Este botón solo se activa si el multivolumen ha sido seleccionado en la #ventana desplegable de Volumen 4D. Al presionarlo, el algoritmo #realiza el registro de los diferentes volumenes en el volumen 4D self.applyButton = qt.QPushButton("Registrar") self.applyButton.toolTip = "Run the algorithm." self.applyButton.enabled = True registerFormLayout.addRow(self.applyButton) # Conexiones necesarias para el algoritmo #entrega al algoritmo el volumen 4D de entrada y conecta la función del botón #con la ejecución del registro self.applyButton.connect('clicked(bool)', self.registrarButton)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... ### Input Area inputCollapsibleButton = ctk.ctkCollapsibleButton() inputCollapsibleButton.text = "Input" self.layout.addWidget(inputCollapsibleButton) # Layout within the dummy collapsible button inputFormLayout = qt.QFormLayout(inputCollapsibleButton) # vf image (mrml input) self.vfMRMLSelector = slicer.qMRMLNodeComboBox() self.vfMRMLSelector.nodeTypes = ["vtkMRMLVectorVolumeNode"] self.vfMRMLSelector.selectNodeUponCreation = True self.vfMRMLSelector.addEnabled = False self.vfMRMLSelector.removeEnabled = False self.vfMRMLSelector.noneEnabled = True self.vfMRMLSelector.showHidden = False self.vfMRMLSelector.setMRMLScene( slicer.mrmlScene ) self.vfMRMLSelector.setToolTip( "Pick the input to the algorithm." ) inputFormLayout.addRow("Vector Field image: ", self.vfMRMLSelector) # variables self.minJacobianValue = 1 self.maxJacobianValue = 1 # vf image (directory input) self.vfInputDirectory = ctk.ctkDirectoryButton() self.vfInputDirectory.directory = qt.QDir.homePath() inputFormLayout.addRow("Input Directory:", self.vfInputDirectory) # Fixed image (for geometry info) self.fixedImage = slicer.qMRMLNodeComboBox() self.fixedImage.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.fixedImage.setMRMLScene( slicer.mrmlScene ) self.fixedImage.selectNodeUponCreation = True self.fixedImage.addEnabled = False self.fixedImage.renameEnabled = True self.fixedImage.noneEnabled = True self.fixedImage.setToolTip( "Output image of Jacobian matrix.vtkSlicerPlastimatchModuleLogicPython" ) inputFormLayout.addRow("Fixed image (for geometry info): ", self.fixedImage) # Apply Button self.applyButton = qt.QPushButton("Apply") self.applyButton.toolTip = "Run the algorithm." self.applyButton.enabled = True self.layout.addWidget(self.applyButton) ### Output Area outputCollapsibleButton = ctk.ctkCollapsibleButton() outputCollapsibleButton.text = "Output" self.layout.addWidget(outputCollapsibleButton) # Layout within the dummy collapsible button outputFormLayout = qt.QFormLayout(outputCollapsibleButton) # Jacobian image (mrml output) self.outputJacobian = slicer.qMRMLNodeComboBox() self.outputJacobian.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.outputJacobian.setMRMLScene( slicer.mrmlScene ) self.outputJacobian.addEnabled = True self.outputJacobian.renameEnabled = True #self.outputJacobian.layout().addWidget(self.outputSelector) self.outputJacobian.setToolTip( "Output image of Jacobian matrix.vtkSlicerPlastimatchModuleLogicPython" ) outputFormLayout.addRow("Jacobian image: ", self.outputJacobian) # output directory selector # self.outputDirectory = ctk.ctkDirectoryButton() # self.outputDirectory.directory = qt.QDir.homePath() # outputFormLayout.addRow("Output Directory: ", self.outputDirectory) # output statistics buttonLayout = qt.QHBoxLayout() self.minJacobian = qt.QLineEdit() self.minJacobian.setToolTip( "Minimum value of Jacobian matrix" ) buttonLayout.addWidget(self.minJacobian) outputFormLayout.addRow("Minimum Jacobian:", buttonLayout) buttonLayout = qt.QHBoxLayout() self.maxJacobian = qt.QLineEdit() self.maxJacobian.setToolTip( "Maximum value of Jacobian matrix" ) buttonLayout.addWidget(self.maxJacobian) outputFormLayout.addRow("Maximum Jacobian:", buttonLayout) # connections self.applyButton.connect('clicked(bool)', self.onJacobianApply) self.outputJacobian.connect("currentNodeChanged(vtkMRMLNode*)", self.onOutputJacobianSelect) self.fixedImage.connect("currentNodeChanged(vtkMRMLNode*)", self.onFixedImageSelect) self.vfMRMLSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onvfMRMLSelect) # Add vertical spacer self.layout.addStretch(1)
def setup(self): # Instantiate and connect widgets ... # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Basic settings" self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) # add input directory selector label = qt.QLabel('Input directory:') self.__fDialog = ctk.ctkDirectoryButton() self.__fDialog.caption = 'Input DICOM directory' dummyFormLayout.addRow(label, self.__fDialog) label = qt.QLabel('Output node:') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onMRMLSceneChanged) self.__mvSelector.addEnabled = 1 dummyFormLayout.addRow(label, self.__mvSelector) label = qt.QLabel('Input data type:') self.__modeSelector = qt.QComboBox() # parameter tuples: long title (for the selector), dicom tag, units, short title self.__processingModes = [] self.__processingModes.append(['DICOM 4D DCE MRI (GE)', '0018|1060', 'ms', 'DCE']) self.__processingModes.append(['DICOM variable TE MRI (GE)', '0018|0081', 'ms', 'vTE']) self.__processingModes.append(['DICOM variable FA MRI (GE)', '0018|1314', 'deg', 'vFA']) self.__processingModes.append(['DICOM variable TR MRI (GE)', '0018|0080', 'ms', 'vTR']) self.__processingModes.append(['User-defined DICOM', '??', '??', 'MultiVolumeDICOM']) self.__processingModes.append(['User-defined non-DICOM', 'N/A', '??', 'MultiVolume']) for p in self.__processingModes: print("Processing mode found: %s" % p) self.__modeSelector.addItem(p[0]) self.__modeSelector.currentIndex = 0 self.__modeSelector.connect('currentIndexChanged(int)', self.onProcessingModeChanged) dummyFormLayout.addRow(label, self.__modeSelector) # Collapsible button dummyCollapsibleButton = ctk.ctkCollapsibleButton() dummyCollapsibleButton.text = "Advanced settings" dummyCollapsibleButton.collapsed = 1 self.layout.addWidget(dummyCollapsibleButton) dummyFormLayout = qt.QFormLayout(dummyCollapsibleButton) self.__advancedFrame = dummyCollapsibleButton # label name and values label = qt.QLabel('DICOM tag:') label.toolTip = 'DICOM tag used to separate individual volumes in the series' self.__dicomTag = qt.QLineEdit() self.__dicomTag.text = "" dummyFormLayout.addRow(label, self.__dicomTag) label = qt.QLabel('Frame identifying units:') self.__veLabel = qt.QLineEdit() dummyFormLayout.addRow(label, self.__veLabel) label = qt.QLabel('Initial value:') self.__veInitial = qt.QDoubleSpinBox() self.__veInitial.value = 0 dummyFormLayout.addRow(label, self.__veInitial) label = qt.QLabel('Step:') self.__veStep = qt.QDoubleSpinBox() self.__veStep.value = 1 dummyFormLayout.addRow(label, self.__veStep) importButton = qt.QPushButton("Import") importButton.toolTip = "Import the contents of the DICOM directory as a MultiVolume" self.layout.addWidget(importButton) importButton.connect('clicked(bool)', self.onImportButtonClicked) self.__status = qt.QLabel('Status: Idle') self.layout.addWidget(self.__status) # 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 = "Freehand3DUltrasound 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) # IGTLink Connector connectorCollapsibleButton = ctk.ctkCollapsibleButton() connectorCollapsibleButton.text = "OpenIGTLink Settings" self.layout.addWidget(connectorCollapsibleButton) self.parametersVBoxLayout = qt.QVBoxLayout(connectorCollapsibleButton) self.connectorWidget = qt.QWidget() self.parametersVBoxLayout.addWidget(self.connectorWidget) self.connectorLayout = qt.QFormLayout(self.connectorWidget) self.linkInputSelector = slicer.qMRMLNodeComboBox() self.linkInputSelector.nodeTypes = ( ("vtkMRMLIGTLConnectorNode"), "" ) self.linkInputSelector.selectNodeUponCreation = True self.linkInputSelector.addEnabled = True self.linkInputSelector.removeEnabled = True self.linkInputSelector.noneEnabled = False self.linkInputSelector.showHidden = False self.linkInputSelector.showChildNodeTypes = False self.linkInputSelector.setMRMLScene( slicer.mrmlScene ) self.linkInputSelector.setToolTip( "Pick connector node" ) self.connectorLayout.addRow("PlusServer Connector: ", self.linkInputSelector) self.igtLinkWidget = qt.QWidget() self.igtLinkWidget.enabled = False self.parametersVBoxLayout.addWidget(self.igtLinkWidget) self.igtLinkHBoxLayout = qt.QHBoxLayout(self.igtLinkWidget) self.hostNameLabel = qt.QLabel("Host Name:") self.igtLinkHBoxLayout.addWidget(self.hostNameLabel) self.hostNameLineEdit = qt.QLineEdit("localhost") self.igtLinkHBoxLayout.addWidget(self.hostNameLineEdit) self.portLabel = qt.QLabel(" Port:") self.igtLinkHBoxLayout.addWidget(self.portLabel) self.portLineEdit = qt.QLineEdit("18944") self.portLineEdit.setMaximumWidth(60) self.igtLinkHBoxLayout.addWidget(self.portLineEdit) self.statusLabel = qt.QLabel(" Active:") self.igtLinkHBoxLayout.addWidget(self.statusLabel) self.linkStatusCheckBox= qt.QCheckBox(" ") self.igtLinkHBoxLayout.addWidget(self.linkStatusCheckBox) # # Reconstruction Area # reconstructionCollapsibleButton = ctk.ctkCollapsibleButton() reconstructionCollapsibleButton.text = "Record and Reconstruction" self.layout.addWidget(reconstructionCollapsibleButton) # Layout within the dummy collapsible button reconstructionVBoxLayout = qt.QVBoxLayout(reconstructionCollapsibleButton) # Input Tracker node selector # inputImageTrackerWidget = qt.QWidget() reconstructionVBoxLayout.addWidget(inputImageTrackerWidget) inputImageTrackerQFormLayout = qt.QFormLayout(inputImageTrackerWidget) self.inputImageTrackerNodeSelector = slicer.qMRMLNodeComboBox() self.inputImageTrackerNodeSelector.nodeTypes = ['vtkMRMLLinearTransformNode'] self.inputImageTrackerNodeSelector.selectNodeUponCreation = True self.inputImageTrackerNodeSelector.addEnabled = False self.inputImageTrackerNodeSelector.removeEnabled = False self.inputImageTrackerNodeSelector.noneEnabled = True self.inputImageTrackerNodeSelector.showHidden = False self.inputImageTrackerNodeSelector.showChildNodeTypes = False self.inputImageTrackerNodeSelector.setMRMLScene( slicer.mrmlScene ) self.inputImageTrackerNodeSelector.objectName = 'inputImageTrackerNodeSelector' self.inputImageTrackerNodeSelector.toolTip = "Select the tracker linear transform node." #inputImageTrackerNodeSelector.connect('currentNodeChanged(bool)', self.enableOrDisableCreateButton) inputImageTrackerQFormLayout.addRow( 'Image Transform Node:',self.inputImageTrackerNodeSelector) #self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', inputImageTrackerNodeSelector, 'setMRMLScene(vtkMRMLScene*)') # # ROI Node Selector # self.inputROINodeSelector = slicer.qMRMLNodeComboBox() self.inputROINodeSelector.enabled = True self.inputROINodeSelector.addEnabled = True self.inputROINodeSelector.removeEnabled = True self.inputROINodeSelector.setMRMLScene( slicer.mrmlScene) self.inputROINodeSelector.nodeTypes = ['vtkMRMLAnnotationROINode'] inputImageTrackerQFormLayout.addRow( 'Reconstruction ROI:',self.inputROINodeSelector) # # Icons # self.statusRedIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/icon_DotRed.png') self.statusGreenIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/icon_DotGreen.png') self.connectIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/connect.png') self.disconnectIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/disconnect.png') self.recordIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/icon_Record.png') self.pauseIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/icon_pause.png') self.stopIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/icon_stop.png') self.snapshotIcon = qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/snapshot.png') self.deleteIcon= qt.QIcon(self.freehand3DUltrasoundDirectoryPath+'/Resources/Icons/delete.png') # # reconstruction and recording buttons self.recordAndReconstructionWidget = qt.QWidget() self.recordAndReconstructionWidget.enabled = False reconstructionVBoxLayout.addWidget(self.recordAndReconstructionWidget) recordAndReconstructionHBoxLayout = qt.QHBoxLayout(self.recordAndReconstructionWidget) self.startButton = qt.QPushButton("") buttonSize = 35 iconSize = qt.QSize(25,25) #self.startButton.toolTip = "Tracker Status" self.startButton.enabled = True self.startButton.setIcon(self.recordIcon) self.startButton.checkable = True self.startButton.setMinimumHeight(buttonSize) self.startButton.setIconSize(iconSize) self.startButton.setMinimumWidth(buttonSize) self.startButton.setMaximumWidth(buttonSize) recordAndReconstructionHBoxLayout.addWidget(self.startButton) self.pauseButton = qt.QPushButton("") #self.pauseButton.toolTip = "Tracker Status" self.pauseButton.enabled = False self.pauseButton.checkable = True self.pauseButton.setIcon(self.pauseIcon) self.pauseButton.setMinimumHeight(buttonSize) self.pauseButton.setIconSize(iconSize) self.pauseButton.setMinimumWidth(buttonSize) self.pauseButton.setMaximumWidth(buttonSize) recordAndReconstructionHBoxLayout.addWidget(self.pauseButton) self.snapshotButton = qt.QPushButton("") #self.snapshotButton.toolTip = "Tracker Status" self.snapshotButton.enabled = False self.snapshotButton.setIcon(self.snapshotIcon) recordAndReconstructionHBoxLayout.addWidget(self.snapshotButton) self.snapshotButton.setMinimumHeight(buttonSize) self.snapshotButton.setIconSize(iconSize) self.snapshotButton.setMinimumWidth(buttonSize) self.snapshotButton.setMaximumWidth(buttonSize) self.deleteButton = qt.QPushButton("") #self.deleteButton.toolTip = "Tracker Status" self.deleteButton.enabled = False self.deleteButton.setIcon(self.deleteIcon) self.deleteButton.setMinimumHeight(buttonSize) self.deleteButton.setIconSize(iconSize) self.deleteButton.setMinimumWidth(buttonSize) self.deleteButton.setMaximumWidth(buttonSize) recordAndReconstructionHBoxLayout.addWidget(self.deleteButton) #recordAndReconstructionHBoxLayout.addStretch(1) self.statusButton = qt.QPushButton("") #self.startButton.toolTip = "Tracker Status" self.statusButton.enabled = False self.statusButton.setIcon(self.disconnectIcon) self.statusButton.setIconSize(iconSize) self.statusButton.setMinimumHeight(buttonSize) self.statusButton.setMaximumWidth(buttonSize) self.statusButton.setMinimumWidth(buttonSize) recordAndReconstructionHBoxLayout.addWidget(self.statusButton) # # Display Area # displayCollapsibleButton = ctk.ctkCollapsibleButton() displayCollapsibleButton.text = "Display" self.layout.addWidget(displayCollapsibleButton) # Layout within the dummy collapsible button displayVBoxLayout = qt.QVBoxLayout(displayCollapsibleButton) volumesWidget = qt.QWidget() displayVBoxLayout.addWidget(volumesWidget) volumesFormLayout = qt.QFormLayout(volumesWidget) # # base volume node selector # self.baseVolumeNodeSelector = slicer.qMRMLNodeComboBox() self.baseVolumeNodeSelector.setMRMLScene( slicer.mrmlScene) self.baseVolumeNodeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] volumesFormLayout.addRow( 'Base Volume (MR/CT):',self.baseVolumeNodeSelector) # # reconstructed volume node selector # self.reconstructedVolumeNodeSelector = slicer.qMRMLNodeComboBox() self.reconstructedVolumeNodeSelector.setMRMLScene( slicer.mrmlScene) self.reconstructedVolumeNodeSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] volumesFormLayout.addRow( 'Reconstructed Volume:',self.reconstructedVolumeNodeSelector) # # Pointer Transform Node Selector # self.pointerTransformNodeSelector = slicer.qMRMLNodeComboBox() self.pointerTransformNodeSelector.nodeTypes = ['vtkMRMLLinearTransformNode'] self.pointerTransformNodeSelector.selectNodeUponCreation = True self.pointerTransformNodeSelector.addEnabled = False self.pointerTransformNodeSelector.removeEnabled = False self.pointerTransformNodeSelector.noneEnabled = True self.pointerTransformNodeSelector.showHidden = False self.pointerTransformNodeSelector.showChildNodeTypes = False self.pointerTransformNodeSelector.setMRMLScene( slicer.mrmlScene ) self.pointerTransformNodeSelector.objectName = 'pointerTransformNodeSelector' self.pointerTransformNodeSelector.toolTip = "Select the tracker linear transform node." #pointerTransformNodeSelector.connect('currentNodeChanged(bool)', self.enableOrDisableCreateButton) volumesFormLayout.addRow( 'Pointer Transform Node:',self.pointerTransformNodeSelector) #self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', pointerTransformNodeSelector, 'setMRMLScene(vtkMRMLScene*)') # # Display Mode Group Buttons # displayModesWidget = qt.QWidget() displayVBoxLayout.addWidget(displayModesWidget) displayModesHBoxLayout = qt.QHBoxLayout(displayModesWidget) displayGroup = qt.QButtonGroup(volumesWidget) displayModeLabel = qt.QLabel("Display Mode: ") displayModesHBoxLayout.addWidget(displayModeLabel) self.mode1RadioButton = qt.QRadioButton("1- Recording") displayGroup.addButton(self.mode1RadioButton) self.mode2RadioButton = qt.QRadioButton("2- Pointer") displayGroup.addButton(self.mode2RadioButton) self.mode3RadioButton = qt.QRadioButton("3- Reslicing off") displayGroup.addButton(self.mode3RadioButton) displayModesHBoxLayout.addWidget(self.mode1RadioButton) displayModesHBoxLayout.addWidget(self.mode2RadioButton) displayModesHBoxLayout.addWidget(self.mode3RadioButton) displayModesHBoxLayout.addStretch(1) # # Settings Area # self.settingsCollapsibleButton = ctk.ctkCollapsibleButton() self.settingsCollapsibleButton.text = "Settings" self.layout.addWidget(self.settingsCollapsibleButton) # Layout within the dummy collapsible button settingsVBoxLayout = qt.QVBoxLayout(self.settingsCollapsibleButton) pathWidget = qt.QWidget() settingsVBoxLayout.addWidget(pathWidget) pathFormLayout = qt.QFormLayout(pathWidget) self.directoryButton = ctk.ctkDirectoryButton() pathFormLayout.addRow("Output Directory: ", self.directoryButton) # # Record and Reconstruction Parameters # recordOptionsWidget = qt.QWidget() settingsVBoxLayout.addWidget(recordOptionsWidget) recordOptionsHBoxLayout = qt.QHBoxLayout(recordOptionsWidget) recordOptionsLabel = qt.QLabel("Options: ") recordOptionsHBoxLayout.addWidget(recordOptionsLabel) self.onlineReconstructionCheckBox = qt.QCheckBox("Online Reconstruction") self.onlineReconstructionCheckBox.checked = True self.recordTrackedFramesCheckBox = qt.QCheckBox("Record Tracked Frames") self.recordTrackedFramesCheckBox.checked = True self.probeSweepGuideCheckBox = qt.QCheckBox("Probe Sweep Guide") self.probeSweepGuideCheckBox.checked = True recordOptionsHBoxLayout.addWidget(self.onlineReconstructionCheckBox) recordOptionsHBoxLayout.addWidget(self.recordTrackedFramesCheckBox) recordOptionsHBoxLayout.addWidget(self.probeSweepGuideCheckBox) recordOptionsHBoxLayout.addStretch(1) # Add vertical spacer self.layout.addStretch(1) # # Connections # self.linkInputSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.setLink) self.linkStatusCheckBox.connect('stateChanged(int)',self.onLinkStatusCheckBox) self.startButton.connect('toggled(bool)', self.onStartButton) self.inputImageTrackerNodeSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.setTransformNode) self.deleteButton.connect('clicked(bool)',self.onDeleteButton) self.directoryButton.connect('directoryChanged(const QString &)',self.onDirectoryButton)