def setupTabBarNavigation(self): self.tabWidget = qt.QTabWidget() self.layout.addWidget(self.tabWidget) setupGroupBox = qt.QGroupBox() imageSelectionGroupBox = qt.QGroupBox() segmentationGroupBox = qt.QGroupBox() submissionGroupBox = qt.QGroupBox() self.setupGroupBoxLayout = qt.QFormLayout() self.imageSelectionGroupBoxLayout = qt.QFormLayout() self.segmentationGroupBoxLayout = qt.QGridLayout() self.submissionGroupBoxLayout = qt.QFormLayout() setupGroupBox.setLayout(self.setupGroupBoxLayout) imageSelectionGroupBox.setLayout(self.imageSelectionGroupBoxLayout) segmentationGroupBox.setLayout(self.segmentationGroupBoxLayout) submissionGroupBox.setLayout(self.submissionGroupBoxLayout) self.tabWidget.setIconSize(qt.QSize(85, 30)) self.tabWidget.addTab(setupGroupBox, self.setupIcon, '') self.tabWidget.addTab(imageSelectionGroupBox, self.imageSelectionIcon, '') self.tabWidget.addTab(segmentationGroupBox, self.segmentationIcon, '') self.tabWidget.addTab(submissionGroupBox, self.submissionIcon, '') self.tabWidget.connect('currentChanged(int)', self.onTabWidgetClicked) self.setTabsEnabled([1, 2, 3, 4], True)
def setup(self): ScriptedLoadableModuleWidget.setup(self) #Widget variables self.meshFolder = None self.outputFolder = None self.visualizationMeshFolder = None self.outputFolderPrepared = False self.Auto3dgmData = Auto3dgmData() self.webWidget = None self.serverNode = None # Instantiate and connect widgets ... tabsWidget = qt.QTabWidget() setupTab = qt.QWidget() setupTabLayout = qt.QFormLayout(setupTab) runTab = qt.QWidget() runTabLayout = qt.QFormLayout(runTab) outTab = qt.QWidget() outTabLayout = qt.QFormLayout(outTab) tabsWidget.addTab(setupTab, "Setup") tabsWidget.addTab(runTab, "Run") tabsWidget.addTab(outTab, "Visualize") self.layout.addWidget(tabsWidget) self.setupSetupTab(setupTabLayout) self.setupRunTab(runTabLayout) self.setupOutTab(outTabLayout)
def __init__(self, ProstateAblationSession): super().__init__(ProstateAblationSession) self.gotoSegmentationButton = self.createButton("", icon=self.startIcon, iconSize=self.iconSize, toolTip="Go To Segmentaion Step") self.gotoSegmentationButton.clicked.connect(self.onGoToSegmentButtonClicked) self._NeedleType = self.ICESEED self.tabWidget = qt.QTabWidget() self.layout().addWidget(self.tabWidget)
def __init__(self, parent, node): BaseNodeWidget.__init__(self, parent, node) mainsplitter = qt.QSplitter(qt.QSplitter.Vertical, self) orderslistview = OrderSupervisorList(mainsplitter, node) tabssplitter = qt.QSplitter(qt.QSplitter.Horizontal, mainsplitter) ordertabs = qt.QTabWidget(tabssplitter) ordertab = OrderTab(ordertabs, {}) ordertabs.insertTab(ordertab, "Order") reporttab = ReportTab(ordertabs, []) ordertabs.insertTab(reporttab, "Report") messagestab = MessagesTab(ordertabs, {}) ordertabs.insertTab(messagestab, "Messages") contracttabs = qt.QTabWidget(tabssplitter) contracttab = ContractTab(contracttabs, {}) contracttabs.insertTab(contracttab, "Contract") layout = qt.QVBoxLayout(self) layout.addWidget(mainsplitter) for widget in ( ordertabs, tabssplitter, contracttabs, ): widget.setMargin(0) for widget in (ordertab, contracttab, messagestab, reporttab): self.connect(orderslistview, util.sigSelectChanged, widget.displayOrderItem) self.connect(orderslistview, util.sigOrdersUpdated, widget.displayOrderItem) firstitem = orderslistview.firstChild() if firstitem: orderslistview.setSelected(firstitem, True) link.connect(orderslistview)
def setupTabBarNavigation(self): self.tabWidget = qt.QTabWidget() self.layout.addWidget(self.tabWidget) self.mainModuleWidget = qt.QWidget() self.mainModuleWidgetLayout = qt.QGridLayout() self.mainModuleWidget.setLayout(self.mainModuleWidgetLayout) self.tabWidget.setIconSize(qt.QSize(85, 30)) self.tabWidget.addTab(self.mainModuleWidget, 'QR')
def makeParametersButton(self): self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = 'Parameters' self.layout.addWidget(self.parametersCollapsibleButton) self.parametersLayout = qt.QVBoxLayout( self.parametersCollapsibleButton) self.parametersTabWidget = qt.QTabWidget() self.parametersLayout.addWidget(self.parametersTabWidget) self.makeTransformationTypeWidgets() self.makePyramidWidgets() self.makeThresholdsWidgets()
def setup(self): ScriptedLoadableModuleWidget.setup(self) os.environ['ITK_AUTOLOAD_PATH'] = '' self.moduleName = 'TraficMulti' self.editionTabWidget = qt.QWidget() self.trainingTabWidget = qt.QWidget() self.classificationTabWidget = qt.QWidget() self.tabs = qt.QTabWidget() self.tabs.addTab(self.editionTabWidget, "Edition") self.tabs.addTab(self.trainingTabWidget, "Training") self.tabs.addTab(self.classificationTabWidget, "Classification") self.layout = self.parent.layout() self.layout.addWidget(self.tabs) self.setupEditionTab() self.setupClassificationTab() self.setupTrainingTab()
def setup(self): ScriptedLoadableModuleWidget.setup(self) os.environ['ITK_AUTOLOAD_PATH'] = '' self.name_labels = [ 'Select a type of fiber', '0', 'Arc_L_FT', 'Arc_L_FrontoParietal', 'Arc_L_TemporoParietal', 'Arc_R_FT', 'Arc_R_FrontoParietal', 'Arc_R_TemporoParietal', 'CGC_L', 'CGC_R', 'CGH_L', 'CGH_R', 'CorpusCallosum_Genu', 'CorpusCallosum_Motor', 'CorpusCallosum_Parietal', 'CorpusCallosum_PreMotor', 'CorpusCallosum_Rostrum', 'CorpusCallosum_Splenium', 'CorpusCallosum_Tapetum', 'CorticoFugal-Left_Motor', 'CorticoFugal-Left_Parietal', 'CorticoFugal-Left_PreFrontal', 'CorticoFugal-Left_PreMotor', 'CorticoFugal-Right_Motor', 'CorticoFugal-Right_Parietal', 'CorticoFugal-Right_PreFrontal', 'CorticoFugal-Right_PreMotor', 'CorticoRecticular-Left', 'CorticoRecticular-Right', 'CorticoSpinal-Left', 'CorticoSpinal-Right', 'CorticoThalamic_L_PreFrontal', 'CorticoThalamic_L_SUPERIOR', 'CorticoThalamic_Left_Motor', 'CorticoThalamic_Left_Parietal', 'CorticoThalamic_Left_PreMotor', 'CorticoThalamic_R_PreFrontal', 'CorticoThalamic_R_SUPERIOR', 'CorticoThalamic_Right_Motor', 'CorticoThalamic_Right_Parietal', 'CorticoThalamic_Right_PreMotor', 'Fornix_L', 'Fornix_R', 'IFOF_L', 'IFOF_R', 'ILF_L', 'ILF_R', 'OpticRadiation_Left', 'OpticRadiation_Right', 'Optic_Tract_L', 'Optic_Tract_R', 'SLF_II_L', 'SLF_II_R', 'UNC_L', 'UNC_R' ] self.moduleName = 'TraficBi' self.editionTabWidget = qt.QWidget() self.trainingTabWidget = qt.QWidget() self.classificationTabWidget = qt.QWidget() self.tabs = qt.QTabWidget() self.tabs.addTab(self.editionTabWidget, "Edition") self.tabs.addTab(self.trainingTabWidget, "Training") self.tabs.addTab(self.classificationTabWidget, "Classification") self.layout = self.parent.layout() self.layout.addWidget(self.tabs) self.setupEditionTab() self.setupClassificationTab() self.setupTrainingTab()
def __init__(self, parent, apps): qt.QDialog.__init__(self, parent, self.title, 0, 0) self.setName('DataCollectorMain') self.allLogs = [] mainLayout = qt.QVBoxLayout(self, 6, 6, 'mainLayout') self.processTabs = qt.QTabWidget(self, 'processTabs') self.setupChildApps(apps) mainLayout.addWidget(self.processTabs) buttonsLayout = qt.QHBoxLayout(None, 0, 6, 'buttonsLayout') spacer = qt.QSpacerItem(20, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum) buttonsLayout.addItem(spacer) self.buttonStop = qt.QPushButton(self, 'buttonStop') buttonsLayout.addWidget(self.buttonStop) self.buttonClose = qt.QPushButton(self, 'buttonClose') buttonsLayout.addWidget(self.buttonClose) mainLayout.addLayout(buttonsLayout) self.setupSignals() self.setupMisc() self.emit(qt.PYSIGNAL('RunChildApps'), ())
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Set up tabs to split workflow tabsWidget = qt.QTabWidget() alignSingleTab = qt.QWidget() alignSingleTabLayout = qt.QFormLayout(alignSingleTab) alignMultiTab = qt.QWidget() alignMultiTabLayout = qt.QFormLayout(alignMultiTab) tabsWidget.addTab(alignSingleTab, "Single Alignment") tabsWidget.addTab(alignMultiTab, "Batch processing") self.layout.addWidget(tabsWidget) # Layout within the tab alignSingleWidget = ctk.ctkCollapsibleButton() alignSingleWidgetLayout = qt.QFormLayout(alignSingleWidget) alignSingleWidget.text = "Align and subsample a source and reference mesh " alignSingleTabLayout.addRow(alignSingleWidget) # # Select source mesh # self.sourceModelSelector = ctk.ctkPathLineEdit() self.sourceModelSelector.filters = ctk.ctkPathLineEdit().Files self.sourceModelSelector.nameFilters = ["*.ply"] alignSingleWidgetLayout.addRow("Source mesh: ", self.sourceModelSelector) # # Select source landmarks # self.sourceFiducialSelector = ctk.ctkPathLineEdit() self.sourceFiducialSelector.filters = ctk.ctkPathLineEdit().Files self.sourceFiducialSelector.nameFilters = ["*.fcsv"] alignSingleWidgetLayout.addRow("Source landmarks: ", self.sourceFiducialSelector) # Select target mesh # self.targetModelSelector = ctk.ctkPathLineEdit() self.targetModelSelector.filters = ctk.ctkPathLineEdit().Files self.targetModelSelector.nameFilters = ["*.ply"] alignSingleWidgetLayout.addRow("Reference mesh: ", self.targetModelSelector) self.skipScalingCheckBox = qt.QCheckBox() self.skipScalingCheckBox.checked = 0 self.skipScalingCheckBox.setToolTip( "If checked, PointCloudRegistration will skip scaling during the alignment (Not recommended)." ) alignSingleWidgetLayout.addRow("Skip scaling", self.skipScalingCheckBox) [ self.pointDensity, self.normalSearchRadius, self.FPFHSearchRadius, self.distanceThreshold, self.maxRANSAC, self.maxRANSACValidation, self.ICPDistanceThreshold ] = self.addAdvancedMenu(alignSingleWidgetLayout) # Advanced tab connections self.pointDensity.connect('valueChanged(double)', self.onChangeAdvanced) self.normalSearchRadius.connect('valueChanged(double)', self.onChangeAdvanced) self.FPFHSearchRadius.connect('valueChanged(double)', self.onChangeAdvanced) self.distanceThreshold.connect('valueChanged(double)', self.onChangeAdvanced) self.maxRANSAC.connect('valueChanged(double)', self.onChangeAdvanced) self.maxRANSACValidation.connect('valueChanged(double)', self.onChangeAdvanced) self.ICPDistanceThreshold.connect('valueChanged(double)', self.onChangeAdvanced) # # Subsample Button # self.subsampleButton = qt.QPushButton("Run subsampling") self.subsampleButton.toolTip = "Run subsampling of the source and reference meshes" self.subsampleButton.enabled = False alignSingleWidgetLayout.addRow(self.subsampleButton) # # Subsample Information # self.subsampleInfo = qt.QPlainTextEdit() self.subsampleInfo.setPlaceholderText("Subsampling information") self.subsampleInfo.setReadOnly(True) alignSingleWidgetLayout.addRow(self.subsampleInfo) # # Align Button # self.alignButton = qt.QPushButton("Run rigid alignment") self.alignButton.toolTip = "Run rigid alignment of the source and reference meshes" self.alignButton.enabled = False alignSingleWidgetLayout.addRow(self.alignButton) # # Plot Aligned Mesh Button # self.displayMeshButton = qt.QPushButton("Display alignment") self.displayMeshButton.toolTip = "Display rigid alignment of the source and references meshes" self.displayMeshButton.enabled = False alignSingleWidgetLayout.addRow(self.displayMeshButton) # connections self.sourceModelSelector.connect('validInputChanged(bool)', self.onSelect) self.sourceFiducialSelector.connect('validInputChanged(bool)', self.onSelect) self.targetModelSelector.connect('validInputChanged(bool)', self.onSelect) self.subsampleButton.connect('clicked(bool)', self.onSubsampleButton) self.alignButton.connect('clicked(bool)', self.onAlignButton) self.displayMeshButton.connect('clicked(bool)', self.onDisplayMeshButton) # Layout within the multiprocessing tab alignMultiWidget = ctk.ctkCollapsibleButton() alignMultiWidgetLayout = qt.QFormLayout(alignMultiWidget) alignMultiWidget.text = "Alings landmarks from multiple specimens to a reference 3d model (mesh)" alignMultiTabLayout.addRow(alignMultiWidget) # # Select source mesh # self.sourceModelMultiSelector = ctk.ctkPathLineEdit() self.sourceModelMultiSelector.filters = ctk.ctkPathLineEdit.Dirs self.sourceModelMultiSelector.toolTip = "Select the directory containing the source meshes" alignMultiWidgetLayout.addRow("Source mesh directory: ", self.sourceModelMultiSelector) # # Select source landmark file # self.sourceFiducialMultiSelector = ctk.ctkPathLineEdit() self.sourceFiducialMultiSelector.filters = ctk.ctkPathLineEdit.Dirs self.sourceFiducialMultiSelector.toolTip = "Select the directory containing the source landmarks" alignMultiWidgetLayout.addRow("Source landmark directory: ", self.sourceFiducialMultiSelector) # Select target mesh directory # self.targetModelMultiSelector = ctk.ctkPathLineEdit() self.targetModelMultiSelector.filters = ctk.ctkPathLineEdit().Files self.targetModelMultiSelector.nameFilters = ["*.ply"] alignMultiWidgetLayout.addRow("Reference mesh: ", self.targetModelMultiSelector) # Select output landmark directory # self.landmarkOutputSelector = ctk.ctkPathLineEdit() self.landmarkOutputSelector.filters = ctk.ctkPathLineEdit.Dirs self.landmarkOutputSelector.toolTip = "Select the output directory where the landmarks will be saved" alignMultiWidgetLayout.addRow("Output landmark directory: ", self.landmarkOutputSelector) self.skipScalingMultiCheckBox = qt.QCheckBox() self.skipScalingMultiCheckBox.checked = 0 self.skipScalingMultiCheckBox.setToolTip( "If checked, PointCloudRegistration will skip scaling during the alignment." ) alignMultiWidgetLayout.addRow("Skip scaling", self.skipScalingMultiCheckBox) [ self.pointDensityMulti, self.normalSearchRadiusMulti, self.FPFHSearchRadiusMulti, self.distanceThresholdMulti, self.maxRANSACMulti, self.maxRANSACValidationMulti, self.ICPDistanceThresholdMulti ] = self.addAdvancedMenu(alignMultiWidgetLayout) # # Run landmarking Button # self.applyLandmarkMultiButton = qt.QPushButton( "Run PointCloud Registration") self.applyLandmarkMultiButton.toolTip = "Align the source meshes and landmarks with a reference mesh" self.applyLandmarkMultiButton.enabled = False alignMultiWidgetLayout.addRow(self.applyLandmarkMultiButton) # connections self.sourceModelMultiSelector.connect('validInputChanged(bool)', self.onSelectMultiProcess) self.sourceFiducialMultiSelector.connect('validInputChanged(bool)', self.onSelectMultiProcess) self.targetModelMultiSelector.connect('validInputChanged(bool)', self.onSelectMultiProcess) self.landmarkOutputSelector.connect('validInputChanged(bool)', self.onSelectMultiProcess) self.skipScalingMultiCheckBox.connect('validInputChanged(bool)', self.onSelectMultiProcess) self.applyLandmarkMultiButton.connect('clicked(bool)', self.onApplyLandmarkMulti) # Add vertical spacer self.layout.addStretch(1) # Advanced tab connections self.pointDensityMulti.connect('valueChanged(double)', self.updateParameterDictionary) self.normalSearchRadiusMulti.connect('valueChanged(double)', self.updateParameterDictionary) self.FPFHSearchRadiusMulti.connect('valueChanged(double)', self.updateParameterDictionary) self.distanceThresholdMulti.connect('valueChanged(double)', self.updateParameterDictionary) self.maxRANSACMulti.connect('valueChanged(double)', self.updateParameterDictionary) self.maxRANSACValidationMulti.connect('valueChanged(double)', self.updateParameterDictionary) self.ICPDistanceThresholdMulti.connect('valueChanged(double)', self.updateParameterDictionary) # initialize the parameter dictionary from single run parameters self.parameterDictionary = { "pointDensity": self.pointDensity.value, "normalSearchRadius": self.normalSearchRadius.value, "FPFHSearchRadius": self.FPFHSearchRadius.value, "distanceThreshold": self.distanceThreshold.value, "maxRANSAC": int(self.maxRANSAC.value), "maxRANSACValidation": int(self.maxRANSACValidation.value), "ICPDistanceThreshold": self.ICPDistanceThreshold.value } # initialize the parameter dictionary from multi run parameters self.parameterDictionaryMulti = { "pointDensity": self.pointDensityMulti.value, "normalSearchRadius": self.normalSearchRadiusMulti.value, "FPFHSearchRadius": self.FPFHSearchRadiusMulti.value, "distanceThreshold": self.distanceThresholdMulti.value, "maxRANSAC": int(self.maxRANSACMulti.value), "maxRANSACValidation": int(self.maxRANSACValidationMulti.value), "ICPDistanceThreshold": self.ICPDistanceThresholdMulti.value }
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # # Input/Export Area # IOCollapsibleButton = ctk.ctkCollapsibleButton() IOCollapsibleButton.text = "Input and Export" self.layout.addWidget(IOCollapsibleButton) # Layout within the dummy collapsible button # IOFormLayout = qt.QFormLayout(IOCollapsibleButton) IOFormLayout = qt.QGridLayout(IOCollapsibleButton) # # Table volume selector # tableSelectorLable = qt.QLabel("Project File: ") self.tableSelector = ctk.ctkPathLineEdit() self.tableSelector.nameFilters = ["*.txt"] self.tableSelector.setToolTip("Select project file") # IOFormLayout.addRow("Input table: ", self.tableSelector) self.selectorButton = qt.QPushButton("Load") self.selectorButton.toolTip = "Load the project file" self.selectorButton.enabled = False # IOFormLayout.addRow(self.selectorButton) IOFormLayout.addWidget(tableSelectorLable, 1, 1) IOFormLayout.addWidget(self.tableSelector, 1, 2) IOFormLayout.addWidget(self.selectorButton, 1, 3) # # Import Volume Button # # TODO When to activate/deactivate this button self.importVolumeButton = qt.QPushButton("Import image") self.importVolumeButton.toolTip = "Import the image selected in the table" self.importVolumeButton.enabled = False IOFormLayout.addWidget(self.importVolumeButton, 5, 1, 1, 3) # # Annotations area # annotationsButton = ctk.ctkCollapsibleButton() annotationsButton.text = "Annotations" self.layout.addWidget(annotationsButton) annotationsLayout = qt.QGridLayout(annotationsButton) # Set up tabs to split workflow tabsWidget = qt.QTabWidget() landmarkTab = qt.QWidget() landmarkTabLayout = qt.QFormLayout(landmarkTab) tabsWidget.addTab(landmarkTab, "Landmark") annotationsLayout.addWidget(tabsWidget) exports = ctk.ctkCollapsibleButton() exports.text = "Export/Skip" landmarkTabLayout.addWidget(exports) exportsLayout = qt.QGridLayout(exports) # # Markups Incomplete Button # self.markIncompleteButton = qt.QPushButton("Incomplete") self.markIncompleteButton.toolTip = "Click if the sample cannot be landmarked - no landmark file will be saved." self.markIncompleteButton.enabled = False exportsLayout.addWidget(self.markIncompleteButton, 1, 1) # # Export Landmarks Button # self.exportLandmarksButton = qt.QPushButton("Export") self.exportLandmarksButton.toolTip = "Export landmarks placed on the selected image" self.exportLandmarksButton.enabled = False exportsLayout.addWidget(self.exportLandmarksButton, 1, 2) # # Skip Button # self.skipButton = qt.QPushButton("Clear Scene /Skip") self.skipButton.toolTip = "Clean scene and skip" self.skipButton.enabled = False exportsLayout.addWidget(self.skipButton, 1, 3) # connections self.tableSelector.connect("validInputChanged(bool)", self.onSelectTablePath) self.selectorButton.connect('clicked(bool)', self.onLoadTable) self.importVolumeButton.connect('clicked(bool)', self.onImportMesh) self.exportLandmarksButton.connect('clicked(bool)', self.onExportLandmarks) self.markIncompleteButton.connect('clicked(bool)', self.onMarkIncomplete) self.skipButton.connect('clicked(bool)', self.onSkip) # Add vertical spacer self.layout.addStretch(1)
addDataButton.connect('clicked()', slicer.util.openAddDataDialog) #save data button if saveData: saveDataButton = qt.QPushButton("Save Data") topleftLayout.addWidget(saveDataButton) saveDataButton.connect('clicked()', slicer.util.openSaveDataDialog) #dynamic add modules if addModule: moduleSelector = slicer.qSlicerModuleSelectorToolBar() moduleSelector.setModuleManager(slicer.app.moduleManager()) topleftLayout.addWidget(moduleSelector) moduleSelector.connect('moduleSelected(QString)', onModuleSelected) tabWidget = qt.QTabWidget() leftLayout.addWidget(tabWidget) for module in defaultModules: onModuleSelected(module) #add 2D/3D viewer to right layout layoutManager = slicer.qMRMLLayoutWidget() layoutManager.setMRMLScene(slicer.mrmlScene) layoutManager.setLayout(slicerLayout) rightLayout.addWidget(layoutManager) splitter.show() __main__.splitter = splitter # Keep track of the widget to avoid its premature destruction
def __init__(self, master): self.this = qt.QTabWidget(master.group[-1][0]) self.master = master
def setup(self): ScriptedLoadableModuleWidget.setup(self) self.logic = slicer.vtkSlicerInteractiveUKFLogic() self.grayscaleNode = None self.labelNode = None self.fileName = None self.fileDialog = None # Instantiate and connect widgets # self.tabFrame = qt.QTabWidget(self.parent) self.tabFrame.setLayout(qt.QHBoxLayout()) self.parent.layout().addWidget(self.tabFrame) self.cliWidget = slicer.modules.ukftractography.createNewWidgetRepresentation( ) self.cliWidget.setMRMLScene(slicer.mrmlScene) ###################### # Customize the widget # # labels and other anonymous UI elements cliw = self.cliWidget for name in [ "Apply", "AutoRun", "Restore Defaults", "Cancel", "Parameter set:", "Input Label Map", "ROI label to use for seeding", "Signal Parameters (Expert Only)", "Not Used: Debug/Develop Only" ]: w = slicer.util.findChildren(widget=cliw, text=name) if len(w) > 0: w = w[0] cliw.layout().removeWidget(w) w.hide() # named selector widgets correspond to CLI argument name for name in ["labels", "seedsFile"]: with It(slicer.util.findChild(widget=cliw, name=name)) as w: cliw.layout().removeWidget(w) w.hide() with It( slicer.util.findChildren( cliw, text="UKF Tractography", className="ctkCollapsibleButton")[0]) as w: with It( slicer.util.findChildren( w, text="IO", className="ctkCollapsibleButton")[0]) as iow: w.layout().removeWidget(iow) w.parent().layout().addWidget(iow) w.parent().layout().removeWidget(w) w.parent().layout().addStretch(1) w.hide() self.ioSelector = iow ###################### # get handles to important selectors self.cliSelector = slicer.util.findChild( cliw, "MRMLCommandLineModuleNodeSelector") self.cliSelector.hide() self.dwiSelector = slicer.util.findChild(cliw, "dwiFile") self.fiberBundleSelector = slicer.util.findChild(cliw, "tracts") self.maskSelector = slicer.util.findChild(cliw, "maskFile") # add Setup widget to tab frame self.tabFrame.addTab(self.cliWidget, "Setup") # Add "Next" button with It(qt.QPushButton(self.parent)) as w: w.text = "Next step: Interact" w.setStyleSheet("background-color: lightgray") self.ioSelector.layout().addItem( qt.QSpacerItem(0, 10, qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)) self.ioSelector.layout().addWidget(w) w.connect('clicked(bool)', lambda: self.tabFrame.setCurrentIndex(1)) # add Interact widget to tab frame self.interactFrame = qt.QFrame(self.parent) self.interactFrame.setLayout(qt.QVBoxLayout()) self.tabFrame.addTab(self.interactFrame, "Interact") # selector widget and frame self.markupSelectorFrame = qt.QFrame(self.parent) self.markupSelectorFrame.setLayout(qt.QVBoxLayout()) self.parent.layout().addWidget(self.markupSelectorFrame) self.markupSelectorLabel = qt.QLabel("Interactive markup node: ", self.markupSelectorFrame) self.markupSelectorLabel.setToolTip( "Select the markup node for interactive seeding.") self.markupSelectorFrame.layout().addWidget(self.markupSelectorLabel) with It(slicer.qMRMLNodeComboBox(self.parent)) as w: w.nodeTypes = ["vtkMRMLMarkupsFiducialNode"] w.selectNodeUponCreation = False w.addEnabled = False w.removeEnabled = False w.noneEnabled = True w.showHidden = False w.showChildNodeTypes = False w.setMRMLScene(slicer.mrmlScene) w.connect('currentNodeChanged(bool)', self.markupNodeSelected) self.markupSelectorFrame.layout().addWidget(w) self.markupSelector = w # enable checkbox self.enableCBFrame = qt.QFrame(self.markupSelectorFrame) self.enableCBFrame.setLayout(qt.QHBoxLayout()) self.enableSeedingCB = ctk.ctkCheckablePushButton() self.enableSeedingCB.text = "Update (check for interactive)" self.enableCBFrame.layout().addWidget(self.enableSeedingCB) self.markupSelectorFrame.layout().addWidget(self.enableCBFrame) self.interactFrame.layout().addWidget(self.markupSelectorFrame) self.optsFrame = qt.QFrame(self.parent) self.optsFrame.setLayout(qt.QVBoxLayout()) self.interactFrame.layout().addWidget(self.optsFrame) # Move seeding options frame to interactor with It( slicer.util.findChildren(cliw, text="Tractography Options")[0]) as w: self.tractOpts = w cliw.layout().removeWidget(w) self.optsFrame.layout().addWidget(w) w.collapsed = True self.c_seedsPerVoxel = findChild(w, "seedsPerVoxel") self.c_seedingThreshold = findChild(w, "seedingThreshold") self.c_stoppingFA = findChild(w, "stoppingFA") self.c_stoppingThreshold = findChild(w, "stoppingThreshold") self.c_numTensor = findChild(w, "numTensor") self.c_stepLength = findChild(w, "stepLength") self.c_Qm = findChild(w, "Qm") self.c_recordLength = findChild(w, "recordLength") self.c_recordLength.setValue(2) # TODO numThread? # TODO maxTract, NMSE # Move tensor options frame to interactor with It( slicer.util.findChildren( cliw, text="Tensor Model (default)")[0]) as w: findChild(w, "recordFA").setChecked(False) findChild(w, "recordTrace").setChecked(False) findChild(w, "recordFreeWater").setChecked(False) findChild(w, "recordTensors").setChecked(False) self.c_useFreeWater = findChild(w, "freeWater") self.tractTensorOpts = w cliw.layout().removeWidget(w) self.optsFrame.layout().addWidget(w) w.collapsed = True # Move NODDI options frame to interactor with It(slicer.util.findChildren(cliw, text="NODDI Model")[0]) as w: self.noddiOpts = w cliw.layout().removeWidget(w) self.optsFrame.layout().addWidget(w) self.c_noddi = findChild(w, "noddi") # # Finished customizing ###################### # Event handling self.tabFrame.connect('currentChanged(int)', self.onTabChanged) self.enableSeedingCB.connect('checkStateChanged(Qt::CheckState)', self.onSeedingCBChanged) self.enableSeedingCB.connect('clicked(bool)', self.onSeedingCBClicked) self.logic.SetMRMLScene(slicer.mrmlScene) # This needs to be last so that all widgets are pushed to top self.interactFrame.layout().addStretch(0)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # # Input/Export Area # IOCollapsibleButton = ctk.ctkCollapsibleButton() IOCollapsibleButton.text = "Input and Export" self.layout.addWidget(IOCollapsibleButton) # Layout within the dummy collapsible button #IOFormLayout = qt.QFormLayout(IOCollapsibleButton) IOFormLayout = qt.QGridLayout(IOCollapsibleButton) # # Table volume selector # tableSelectorLable = qt.QLabel("Input table: ") self.tableSelector = ctk.ctkPathLineEdit() self.tableSelector.nameFilters = ["*.csv"] self.tableSelector.setToolTip("Select table with filenames to process") #IOFormLayout.addRow("Input table: ", self.tableSelector) self.selectorButton = qt.QPushButton("Load Table") self.selectorButton.toolTip = "Load the table of image filenames to process" self.selectorButton.enabled = False #IOFormLayout.addRow(self.selectorButton) IOFormLayout.addWidget(tableSelectorLable, 1, 1) IOFormLayout.addWidget(self.tableSelector, 1, 2) IOFormLayout.addWidget(self.selectorButton, 1, 3) # # Import Volume Button # self.importVolumeButton = qt.QPushButton("Import image") self.importVolumeButton.toolTip = "Import the image selected in the table" self.importVolumeButton.enabled = False IOFormLayout.addWidget(self.importVolumeButton, 2, 1, 1, 3) # # Image editing Area # parametersCollapsibleButton = ctk.ctkCollapsibleButton() parametersCollapsibleButton.text = "Image Editing" self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # # input volume selector # self.volumeSelector = slicer.qMRMLNodeComboBox() self.volumeSelector.nodeTypes = [ "vtkMRMLScalarVolumeNode", "vtkMRMLVectorVolumeNode" ] self.volumeSelector.selectNodeUponCreation = True self.volumeSelector.addEnabled = True self.volumeSelector.removeEnabled = True self.volumeSelector.noneEnabled = True self.volumeSelector.showHidden = False self.volumeSelector.showChildNodeTypes = False self.volumeSelector.renameEnabled = True self.volumeSelector.setMRMLScene(slicer.mrmlScene) self.volumeSelector.setToolTip("Select volume to resample") parametersFormLayout.addRow("Input Volume: ", self.volumeSelector) # # # # input spacing # # # spacingLayout= qt.QGridLayout() # self.spacingX = ctk.ctkDoubleSpinBox() # self.spacingX.value = 1 # self.spacingX.minimum = 0 # self.spacingX.singleStep = 1 # self.spacingX.setDecimals(2) # self.spacingX.setToolTip("Input spacing X") # # self.spacingY = ctk.ctkDoubleSpinBox() # self.spacingY.value = 1 # self.spacingY.minimum = 0 # self.spacingY.singleStep = 1 # self.spacingY.setDecimals(2) # self.spacingY.setToolTip("Input spacing Y") # # self.spacingZ = ctk.ctkDoubleSpinBox() # self.spacingZ.value = 1 # self.spacingZ.minimum = 0 # self.spacingZ.singleStep = 1 # self.spacingZ.setDecimals(2) # self.spacingZ.setToolTip("Input spacing Z") # # spacingLayout.addWidget(self.spacingX,1,2) # spacingLayout.addWidget(self.spacingY,1,3) # spacingLayout.addWidget(self.spacingZ,1,4) # # parametersFormLayout.addRow("Spacing (mm):", spacingLayout) # # # # Apply Button # # # self.applySpacingButton = qt.QPushButton("Apply Spacing") # self.applySpacingButton.toolTip = "Run the algorithm." # self.applySpacingButton.enabled = False # parametersFormLayout.addRow(self.applySpacingButton) # # Flip X-axis Button # self.flipXButton = qt.QPushButton("Flip X-axis") self.flipXButton.toolTip = "Flip the loaded volume across the X-axis" self.flipXButton.enabled = False parametersFormLayout.addRow(self.flipXButton) # # Flip Y-axis Button # self.flipYButton = qt.QPushButton("Flip Y-axis") self.flipYButton.toolTip = "Flip the loaded volume across the Y-axis" self.flipYButton.enabled = False parametersFormLayout.addRow(self.flipYButton) # # Flip Z-axis Button # self.flipZButton = qt.QPushButton("Flip Z-axis") self.flipZButton.toolTip = "Flip the loaded volume across the x-axis" self.flipZButton.enabled = False parametersFormLayout.addRow(self.flipZButton) # # Annotations area # annotationsButton = ctk.ctkCollapsibleButton() annotationsButton.text = "Annotations" self.layout.addWidget(annotationsButton) annotationsLayout = qt.QGridLayout(annotationsButton) # Set up tabs to split workflow tabsWidget = qt.QTabWidget() landmarkTab = qt.QWidget() landmarkTabLayout = qt.QFormLayout(landmarkTab) segmentTab = qt.QWidget() segmentTabLayout = qt.QFormLayout(segmentTab) tabsWidget.addTab(landmarkTab, "Landmark") tabsWidget.addTab(segmentTab, "Segment") annotationsLayout.addWidget(tabsWidget) # # Markups Launch Button # self.launchMarkupsButton = qt.QPushButton("Start landmarking") self.launchMarkupsButton.toolTip = "Pop up the markups view for placing landmarks" self.launchMarkupsButton.enabled = False landmarkTabLayout.addRow(self.launchMarkupsButton) # # Export Landmarks Button # self.exportLandmarksButton = qt.QPushButton("Export landmarks") self.exportLandmarksButton.toolTip = "Export landmarks placed on the selected image" self.exportLandmarksButton.enabled = False landmarkTabLayout.addRow(self.exportLandmarksButton) # # Initiate Segmentation # self.startSegmentationButton = qt.QPushButton("Start segmenation") self.startSegmentationButton.toolTip = "Initialize segmentation and view Segment Editor" self.startSegmentationButton.enabled = False segmentTabLayout.addRow(self.startSegmentationButton) # # Export Segmentation # self.exportSegmentationButton = qt.QPushButton("Export segmenation") self.exportSegmentationButton.toolTip = "Export segmentation as a model" self.exportSegmentationButton.enabled = False segmentTabLayout.addRow(self.exportSegmentationButton) # connections #self.applySpacingButton.connect('clicked(bool)', self.onApplySpacingButton) self.flipXButton.connect('clicked(bool)', self.onFlipX) self.flipYButton.connect('clicked(bool)', self.onFlipY) self.flipZButton.connect('clicked(bool)', self.onFlipZ) self.selectorButton.connect('clicked(bool)', self.onLoadTable) self.volumeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect) self.tableSelector.connect("validInputChanged(bool)", self.onSelectTablePath) self.importVolumeButton.connect('clicked(bool)', self.onImportVolume) self.exportLandmarksButton.connect('clicked(bool)', self.onExportLandmarks) self.launchMarkupsButton.connect('clicked(bool)', self.onLaunchMarkups) self.startSegmentationButton.connect('clicked(bool)', self.onStartSegmentation) self.exportSegmentationButton.connect('clicked(bool)', self.onExportSegmentation) # Add vertical spacer self.layout.addStretch(1) # Refresh Apply button state self.onSelect()
def buildInterface(self): vlayout = qt.QVBoxLayout(self) """ title """ title = qt.QLabel("<B>Ccd Bpm<B>", self) title.setSizePolicy(qt.QSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)) vlayout.addWidget(title) """ brick frame """ self.frame = qt.QFrame(self) self.frame.setFrameShape(qt.QFrame.Box) self.frame.setFrameShadow(qt.QFrame.Sunken) vlayout.addWidget(self.frame) vlay = qt.QVBoxLayout(self.frame) vlay.setMargin(10) """ create tab widget """ self.tabWidget = qt.QTabWidget(self.frame) vlay.addWidget(self.tabWidget) """ create tab for display values """ self.valuesTab = qt.QWidget(None) self.tabWidget.addTab(self.valuesTab, "Info") vlayout1 = qt.QVBoxLayout(self.valuesTab) vlayout1.setMargin(10) self.exposureLabel = QubValue(self.valuesTab, "Exposure (%)", False) titlesize = self.exposureLabel.titleSizeHint() self.exposureLabel.setText("1123.1234") valuesize = self.exposureLabel.valueSizeHint() self.exposureLabel.setText("") vlayout1.addWidget(self.exposureLabel) vlayout1.addSpacing(2) self.gainLabel = QubValue(self.valuesTab, "Gain (%)", False) vlayout1.addWidget(self.gainLabel) vlayout1.addSpacing(2) self.thresholdLabel = QubValue(self.valuesTab, "Threshold (%)", False) vlayout1.addWidget(self.thresholdLabel) vlayout1.addSpacing(10) self.centerxLabel = QubValue(self.valuesTab, "X center", False) vlayout1.addWidget(self.centerxLabel) vlayout1.addSpacing(2) self.centeryLabel = QubValue(self.valuesTab, "Y center", False) vlayout1.addWidget(self.centeryLabel) vlayout1.addSpacing(2) self.fwhmxLabel = QubValue(self.valuesTab, "X FWHM", False) vlayout1.addWidget(self.fwhmxLabel) vlayout1.addSpacing(2) self.fwhmyLabel = QubValue(self.valuesTab, "Y FWHM", False) vlayout1.addWidget(self.fwhmyLabel) vlayout1.addSpacing(2) self.intensityLabel = QubValue(self.valuesTab, "Intensity", False) vlayout1.addWidget(self.intensityLabel) vlayout1.addSpacing(2) self.maxpixLabel = QubValue(self.valuesTab, "Maximum", False) vlayout1.addWidget(self.maxpixLabel) vlayout1.addSpacing(10) self.widthLabel = QubValue(self.valuesTab, "Im. width", False) vlayout1.addWidget(self.widthLabel) vlayout1.addSpacing(2) self.heightLabel = QubValue(self.valuesTab, "Im. height", False) vlayout1.addWidget(self.heightLabel) vlayout1.addSpacing(2) self.startxLabel = QubValue(self.valuesTab, "ROI X start", False) vlayout1.addWidget(self.startxLabel) vlayout1.addSpacing(2) self.endxLabel = QubValue(self.valuesTab, "ROI X end", False) vlayout1.addWidget(self.endxLabel) vlayout1.addSpacing(2) self.startyLabel = QubValue(self.valuesTab, "ROI Y start", False) vlayout1.addWidget(self.startyLabel) vlayout1.addSpacing(2) self.endyLabel = QubValue(self.valuesTab, "ROI Y end", False) vlayout1.addWidget(self.endyLabel) vlayout1.addSpacing(20) """ create tab for control """ self.cameraTab = qt.QWidget(None) self.tabWidget.addTab(self.cameraTab, "Control") vlayout2 = qt.QVBoxLayout(self.cameraTab) vlayout2.setMargin(10) self.exposureText = QubValue(self.cameraTab, "Exposure (%)", True) self.connect(self.exposureText, qt.PYSIGNAL("returnPressed"), self.setExposure) vlayout2.addWidget(self.exposureText) vlayout2.addSpacing(2) self.gainText = QubValue(self.cameraTab, "Gain (%)", True) self.connect(self.gainText, qt.PYSIGNAL("returnPressed"), self.setGain) vlayout2.addWidget(self.gainText) vlayout2.addSpacing(2) self.thresholdText = QubValue(self.cameraTab, "Threshold (%)", True) self.connect(self.thresholdText, qt.PYSIGNAL("returnPressed"), self.setThreshold) vlayout2.addWidget(self.thresholdText) vlayout2.addSpacing(20) self.liveControlToggle = qt.QPushButton("Live mode", self.cameraTab) self.liveControlToggle.setToggleButton(True) self.connect(self.liveControlToggle, qt.SIGNAL("toggled(bool)"), self.setLive) vlayout2.addWidget(self.liveControlToggle) self.bpmControlToggle = qt.QPushButton("BPM on", self.cameraTab) self.bpmControlToggle.setToggleButton(True) self.connect(self.bpmControlToggle, qt.SIGNAL("toggled(bool)"), self.setBpm) vlayout2.addWidget(self.bpmControlToggle) vlayout2.addStretch(1) """ create Tab for ROI """ self.roiTab = qt.QWidget(None) self.tabWidget.addTab(self.roiTab, "ROI") vlayout3 = qt.QVBoxLayout(self.roiTab) vlayout3.setMargin(10) """ ROI toggle button """ hlayout3 = qt.QHBoxLayout(vlayout3) self.roiButton = qt.QPushButton("Select on Image", self.roiTab) self.roiButton.setToggleButton(True) self.connect(self.roiButton, qt.SIGNAL("toggled(bool)"), self.startROISelection) hlayout3.addWidget(self.roiButton) vlayout3.addSpacing(10) """ ROI values """ self.startxText = QubValue(self.roiTab, "X start", True) vlayout3.addWidget(self.startxText) vlayout3.addSpacing(2) self.endxText = QubValue(self.roiTab, "X end", True) vlayout3.addWidget(self.endxText) vlayout3.addSpacing(2) self.startyText = QubValue(self.roiTab, "Y start", True) vlayout3.addWidget(self.startyText) vlayout3.addSpacing(2) self.endyText = QubValue(self.roiTab, "Y end", True) vlayout3.addWidget(self.endyText) vlayout3.addSpacing(10) hlayout2 = qt.QHBoxLayout(vlayout3) self.resetButton = qt.QPushButton("Reset", self.roiTab) self.connect(self.resetButton, qt.SIGNAL("clicked()"), self.resetROI) hlayout2.addWidget(self.resetButton) hlayout2.addStretch(1) self.sendButton = qt.QPushButton("Send", self.roiTab) self.connect(self.sendButton, qt.SIGNAL("clicked()"), self.sendROI) hlayout2.addWidget(self.sendButton) vlayout3.addStretch(1) """ resize """ self.exposureText.setTitleMinimumSize(titlesize) self.gainText.setTitleMinimumSize(titlesize) self.thresholdText.setTitleMinimumSize(titlesize) self.exposureLabel.setTitleMinimumSize(titlesize) self.gainLabel.setTitleMinimumSize(titlesize) self.thresholdLabel.setTitleMinimumSize(titlesize) self.centerxLabel.setTitleMinimumSize(titlesize) self.centeryLabel.setTitleMinimumSize(titlesize) self.fwhmxLabel.setTitleMinimumSize(titlesize) self.fwhmyLabel.setTitleMinimumSize(titlesize) self.intensityLabel.setTitleMinimumSize(titlesize) self.maxpixLabel.setTitleMinimumSize(titlesize) self.widthLabel.setTitleMinimumSize(titlesize) self.heightLabel.setTitleMinimumSize(titlesize) self.startxLabel.setTitleMinimumSize(titlesize) self.endxLabel.setTitleMinimumSize(titlesize) self.startyLabel.setTitleMinimumSize(titlesize) self.endyLabel.setTitleMinimumSize(titlesize) self.startxText.setTitleMinimumSize(titlesize) self.endxText.setTitleMinimumSize(titlesize) self.startyText.setTitleMinimumSize(titlesize) self.endyText.setTitleMinimumSize(titlesize) self.exposureText.setValueMaximumSize(valuesize) self.gainText.setValueMaximumSize(valuesize) self.thresholdText.setValueMaximumSize(valuesize) self.exposureLabel.setValueMaximumSize(valuesize) self.gainLabel.setValueMaximumSize(valuesize) self.thresholdLabel.setValueMaximumSize(valuesize) self.centerxLabel.setValueMaximumSize(valuesize) self.centeryLabel.setValueMaximumSize(valuesize) self.fwhmxLabel.setValueMaximumSize(valuesize) self.fwhmyLabel.setValueMaximumSize(valuesize) self.intensityLabel.setValueMaximumSize(valuesize) self.maxpixLabel.setValueMaximumSize(valuesize) self.widthLabel.setValueMaximumSize(valuesize) self.heightLabel.setValueMaximumSize(valuesize) self.startxLabel.setValueMaximumSize(valuesize) self.endxLabel.setValueMaximumSize(valuesize) self.startyLabel.setValueMaximumSize(valuesize) self.endyLabel.setValueMaximumSize(valuesize) self.startxText.setValueMaximumSize(valuesize) self.endxText.setValueMaximumSize(valuesize) self.startyText.setValueMaximumSize(valuesize) self.endyText.setValueMaximumSize(valuesize)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # Instantiate and connect widgets ... # Set up tabs to split workflow tabsWidget = qt.QTabWidget() curvesTab = qt.QWidget() curvesTabLayout = qt.QFormLayout(curvesTab) fiducialsTab = qt.QWidget() fiducialsTabLayout = qt.QFormLayout(fiducialsTab) batchTab = qt.QWidget() batchTabLayout = qt.QFormLayout(batchTab) tabsWidget.addTab(curvesTab, "Merge Curves") tabsWidget.addTab(fiducialsTab, "Merge Landmark Sets") tabsWidget.addTab(batchTab, "Batch Merge Landmark Sets") self.layout.addWidget(tabsWidget) ################## Curves Tab # # Parameters Area # parametersCurveCollapsibleButton = ctk.ctkCollapsibleButton() parametersCurveCollapsibleButton.text = "Curve Viewer" curvesTabLayout.addRow(parametersCurveCollapsibleButton) # Layout within the dummy collapsible button parametersCurveFormLayout = qt.QFormLayout( parametersCurveCollapsibleButton) # # check box to trigger taking screen shots for later use in tutorials # self.continuousCurvesCheckBox = qt.QCheckBox() self.continuousCurvesCheckBox.checked = 0 self.continuousCurvesCheckBox.setToolTip( "If checked, redundant points will be removed on merging.") parametersCurveFormLayout.addRow("Contiuous curves", self.continuousCurvesCheckBox) # # markups view # self.markupsView = slicer.qMRMLSubjectHierarchyTreeView() self.markupsView.setMRMLScene(slicer.mrmlScene) self.markupsView.setMultiSelection(True) self.markupsView.setAlternatingRowColors(True) self.markupsView.setDragDropMode(qt.QAbstractItemView().DragDrop) self.markupsView.setColumnHidden( self.markupsView.model().transformColumn, True) self.markupsView.sortFilterProxyModel().setNodeTypes( ["vtkMRMLMarkupsCurveNode"]) parametersCurveFormLayout.addRow(self.markupsView) # # Merge Button # self.mergeButton = qt.QPushButton("Merge highlighted nodes") self.mergeButton.toolTip = "Generate a single merged markup file from the selected nodes" self.mergeButton.enabled = False parametersCurveFormLayout.addRow(self.mergeButton) # connections self.mergeButton.connect('clicked(bool)', self.onMergeButton) self.markupsView.connect('currentItemChanged(vtkIdType)', self.updateMergeButton) ################ Landmark Set Tab # # Parameters Area # parametersLMCollapsibleButton = ctk.ctkCollapsibleButton() parametersLMCollapsibleButton.text = "Landmark Viewer" fiducialsTabLayout.addRow(parametersLMCollapsibleButton) # Layout within the dummy collapsible button parametersLMFormLayout = qt.QGridLayout(parametersLMCollapsibleButton) # # markups view # self.markupsFiducialView = slicer.qMRMLSubjectHierarchyTreeView() self.markupsFiducialView.setMRMLScene(slicer.mrmlScene) self.markupsFiducialView.setMultiSelection(True) self.markupsFiducialView.setAlternatingRowColors(True) self.markupsFiducialView.setDragDropMode( qt.QAbstractItemView().DragDrop) self.markupsFiducialView.setColumnHidden( self.markupsView.model().transformColumn, True) self.markupsFiducialView.sortFilterProxyModel().setNodeTypes( ["vtkMRMLMarkupsFiducialNode"]) parametersLMFormLayout.addWidget(self.markupsFiducialView, 0, 0, 1, 3) # # Set landmark type menu # boxLabel = qt.QLabel("Select landmark type description to apply: ") self.LandmarkTypeSelection = qt.QComboBox() self.LandmarkTypeSelection.addItems( ["Select", "Fixed", "Semi", "No description"]) parametersLMFormLayout.addWidget(boxLabel, 1, 0) parametersLMFormLayout.addWidget(self.LandmarkTypeSelection, 1, 1) # # Apply Landmark Type Button # self.ApplyLMButton = qt.QPushButton("Apply to highlighted nodes") self.ApplyLMButton.toolTip = "Apply the selected landmark type to points in the the selected nodes" self.ApplyLMButton.enabled = False parametersLMFormLayout.addWidget(self.ApplyLMButton, 1, 2) # # Merge Button # self.mergeLMButton = qt.QPushButton("Merge highlighted nodes") self.mergeLMButton.toolTip = "Generate a single merged markup file from the selected nodes" self.mergeLMButton.enabled = False parametersLMFormLayout.addWidget(self.mergeLMButton, 2, 0, 1, 3) # connections self.mergeLMButton.connect('clicked(bool)', self.onMergeLMButton) self.ApplyLMButton.connect('clicked(bool)', self.onApplyLMButton) self.markupsFiducialView.connect('currentItemChanged(vtkIdType)', self.updateMergeLMButton) self.LandmarkTypeSelection.connect('currentIndexChanged(int)', self.updateApplyLMButton) ################ Batch Run LM Merge Tab # # Fixed LM Area # fixedBatchCollapsibleButton = ctk.ctkCollapsibleButton() fixedBatchCollapsibleButton.text = "Fixed LM File Selection" batchTabLayout.addRow(fixedBatchCollapsibleButton) # Layout within the dummy collapsible button fixedBatchLayout = qt.QFormLayout(fixedBatchCollapsibleButton) # # Browse Fixed LM Button # self.browseFixedLMButton = qt.QPushButton("Select files...") self.browseFixedLMButton.toolTip = "Select one fixed landmark file for each subject" self.browseFixedLMButton.enabled = True fixedBatchLayout.addRow(self.browseFixedLMButton) # # File viewer box # self.fixedFileTable = qt.QTextEdit() fixedBatchLayout.addRow(self.fixedFileTable) # # Semi LM Area # semiBatchCollapsibleButton = ctk.ctkCollapsibleButton() semiBatchCollapsibleButton.text = "Semi LM File Selection" batchTabLayout.addRow(semiBatchCollapsibleButton) # Layout within the dummy collapsible button semiBatchLayout = qt.QFormLayout(semiBatchCollapsibleButton) # # Browse Fixed LM Button # self.browseSemiLMButton = qt.QPushButton("Select files...") self.browseSemiLMButton.toolTip = "Select one semi-landmark file for each subject, in the same order as the fixed landmarks" self.browseSemiLMButton.enabled = True semiBatchLayout.addRow(self.browseSemiLMButton) # # File viewer box # self.semiFileTable = qt.QTextEdit() semiBatchLayout.addRow(self.semiFileTable) # # Merge LM Area # batchMergeCollapsibleButton = ctk.ctkCollapsibleButton() batchMergeCollapsibleButton.text = "Run merge" batchTabLayout.addRow(batchMergeCollapsibleButton) # Layout within the dummy collapsible button batchMergeLayout = qt.QFormLayout(batchMergeCollapsibleButton) # # Select output landmark directory # self.outputDirectorySelector = ctk.ctkPathLineEdit() self.outputDirectorySelector.filters = ctk.ctkPathLineEdit.Dirs self.outputDirectorySelector.toolTip = "Select the output directory where the merged landmark nodes will be saved" batchMergeLayout.addRow("Select output landmark directory: ", self.outputDirectorySelector) # # Batch Merge Button # self.batchMergeButton = qt.QPushButton( "Merge fixed and semi-landmark nodes") self.batchMergeButton.toolTip = "Generate a single merged markup file from the selected nodes" self.batchMergeButton.enabled = False batchMergeLayout.addRow(self.batchMergeButton) # # Clear Button # self.clearButton = qt.QPushButton("Clear landmark file selections") self.clearButton.toolTip = "Clear the landmark files selected in the viewer boxes" self.clearButton.enabled = False batchMergeLayout.addRow(self.clearButton) # connections self.browseFixedLMButton.connect('clicked(bool)', self.addFixedByBrowsing) self.browseSemiLMButton.connect('clicked(bool)', self.addSemiByBrowsing) self.outputDirectorySelector.connect('validInputChanged(bool)', self.onSelectDirectory) self.batchMergeButton.connect('clicked(bool)', self.onBatchMergeButton) self.clearButton.connect('clicked(bool)', self.onClearButton) # Add vertical spacer self.layout.addStretch(1)
def setup(self): ScriptedLoadableModuleWidget.setup(self) #Widget variables self.mesh_folder = None self.visualizationmesh_folder = None # Instantiate and connect widgets ... # # Parameters Area # # parametersCollapsibleButton = ctk.ctkCollapsibleButton() # parametersCollapsibleButton.text = "Parameters" # self.layout.addWidget(parametersCollapsibleButton) # Layout within the dummy collapsible button # parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton) # Add vertical spacer # Create Tabs # self.layout.addStretch(1) tabsWidget = qt.QTabWidget() setupTab = qt.QWidget() setupTabLayout = qt.QFormLayout(setupTab) runTab = qt.QWidget() runTabLayout = qt.QFormLayout(runTab) outTab = qt.QWidget() outTabLayout = qt.QFormLayout(outTab) tabsWidget.addTab(setupTab, "Setup") tabsWidget.addTab(runTab, "Run") tabsWidget.addTab(outTab, "Visualize/Output") self.layout.addWidget(tabsWidget) self.setupRunTab(runTabLayout) self.setupOutTab(outTabLayout) ### SETUP TAB WIDGETS AND BEHAVIORS ### # Input and Output Folder section inputfolderWidget = ctk.ctkCollapsibleButton() inputfolderLayout = qt.QFormLayout(inputfolderWidget) inputfolderWidget.text = "Input and output folder" setupTabLayout.addRow(inputfolderWidget) self.meshInputText, volumeInLabel, self.inputFolderButton = self.textIn( 'Input folder', 'Choose input folder', '') self.inputFolderButton.connect('clicked(bool)', self.selectMeshFolder) self.loadButton = qt.QPushButton("Load Data") self.loadButton.enabled = False self.loadButton.connect('clicked(bool)', self.onLoad) self.LMText, volumeInLabel, self.LMbutton = self.textIn( 'Input Directory', '..', '') self.meshOutputText, volumeOutLabel, self.outputFolderButton = self.textIn( 'Output folder', 'Choose output folder', '') self.outputFolderButton.connect('clicked(bool)', self.selectOutputFolder) inputfolderLayout.addRow(volumeInLabel) #,1,1) inputfolderLayout.addRow(self.meshInputText) #,1,2) inputfolderLayout.addRow(self.inputFolderButton) #,1,3) inputfolderLayout.addRow(self.loadButton) inputfolderLayout.addRow(self.meshOutputText) inputfolderLayout.addRow(self.outputFolderButton) #self.layout.addWidget(inbutton) self.LMbutton.connect('clicked(bool)', self.selectMeshFolder) self.parameterWidget = ctk.ctkCollapsibleButton() self.parameterLayout = qt.QFormLayout(self.parameterWidget) self.parameterWidget.text = "Parameters" setupTabLayout.addRow(self.parameterWidget) self.maxIterSliderWidget = ctk.ctkSliderWidget() self.maxIterSliderWidget.setDecimals(0) self.maxIterSliderWidget.singleStep = 1 self.maxIterSliderWidget.minimum = 1 self.maxIterSliderWidget.maximum = 5000 self.maxIterSliderWidget.value = 1000 self.maxIterSliderWidget.setToolTip( "Maximum possible number of iterations for pairwise alignment optimization." ) self.parameterLayout.addRow("Maximum iterations", self.maxIterSliderWidget) self.reflectionCheckBox = qt.QCheckBox() self.reflectionCheckBox.checked = 0 self.reflectionCheckBox.setToolTip( "Whether meshes can be reflected/mirrored to achieve more optimal alignments." ) self.parameterLayout.addRow("Allow reflection", self.reflectionCheckBox) self.subsampleComboBox = qt.QComboBox() self.subsampleComboBox.addItem("FPS (Furthest Point Sampling)") self.subsampleComboBox.addItem("GPL (Gaussian Process Landmarks)") self.subsampleComboBox.addItem("FPS/GPL Hybrid") self.parameterLayout.addRow("Subsampling", self.subsampleComboBox) self.fpsSeed = qt.QSpinBox() self.fpsSeed.setSpecialValueText('-') self.parameterLayout.addRow("Optional FPS Seed", self.fpsSeed) self.hybridPoints = qt.QSpinBox() self.hybridPoints.setSpecialValueText('-') self.hybridPoints.setMinimum(1) self.hybridPoints.setMaximum(1000) self.parameterLayout.addRow("Hybrid GPL Points", self.hybridPoints) self.phaseChoiceComboBox = qt.QComboBox() self.phaseChoiceComboBox.addItem("1 (Single Alignment Pass)") self.phaseChoiceComboBox.addItem("2 (Double Alignment Pass)") self.phaseChoiceComboBox.setCurrentIndex(1) self.parameterLayout.addRow("Analysis phases", self.phaseChoiceComboBox) self.phase1PointNumber = qt.QSpinBox() self.phase1PointNumber.setMinimum(1) self.phase1PointNumber.setMaximum(100000) self.phase1PointNumber.setValue(200) self.parameterLayout.addRow("Phase 1 Points", self.phase1PointNumber) self.phase2PointNumber = qt.QSpinBox() self.phase2PointNumber.setMinimum(1) self.phase2PointNumber.setMaximum(1000000) self.phase2PointNumber.setValue(1000) self.parameterLayout.addRow("Phase 2 Points", self.phase2PointNumber) self.processingComboBox = qt.QComboBox() self.processingComboBox.addItem("Local Single CPU Core") self.processingComboBox.addItem("Local Multiple CPU Cores") self.processingComboBox.addItem("Cluster/Grid") self.parameterLayout.addRow("Processing", self.processingComboBox)