def setup(self): self.methodLayout = qt.QHBoxLayout(self) self.methodSelectorComboBox = qt.QComboBox() self.methodSelectorComboBox.insertItem( 1, "Single Component Extraction", VectorToScalarVolumeLogic.SINGLE_COMPONENT) self.methodSelectorComboBox.setItemData(1, 'Extract single component', qt.Qt.ToolTipRole) self.methodSelectorComboBox.insertItem( 2, "Luminance", VectorToScalarVolumeLogic.LUMINANCE) self.methodSelectorComboBox.setItemData( 2, '(RGB,RGBA) Luminance from first three components: 0.30*R + 0.59*G + 0.11*B + 0.0*A)', qt.Qt.ToolTipRole) self.methodSelectorComboBox.insertItem( 3, "Average", VectorToScalarVolumeLogic.AVERAGE) self.methodSelectorComboBox.setItemData(3, 'Average all the components.', qt.Qt.ToolTipRole) self.methodLayout.addWidget(self.methodSelectorComboBox) self.methodLayout.addItem( qt.QSpacerItem(40, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum)) # ComponentToExtract singleComponentLayout = qt.QHBoxLayout() self.componentsComboBox = qt.QComboBox() singleComponentLayout.addWidget(self.componentsComboBox) singleComponentLayout.addItem( qt.QSpacerItem(40, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum)) self.methodLayout.addLayout(singleComponentLayout)
def createFeaturePanels(self): logging.debug('USRegistrationGuidelet.createFeaturePanels') moduleDirectoryPath = slicer.modules.usregistration.path.replace( 'USRegistration.py', '') self.uiWidget = slicer.util.loadUI(moduleDirectoryPath + 'Resources/UI/USRegistration.ui') self.sliceletPanelLayout.addWidget(self.uiWidget) self.ui = slicer.util.childWidgetVariables(self.uiWidget) self.ui.line.setFrameShadow(qt.QFrame.Plain) self.ui.line_2.setFrameShadow(qt.QFrame.Plain) featurePanelList = [ self.ui.captureCollapsibleButton, self.ui.segmentCollapsibleButton, self.ui.registerCollapsibleButton, ] featurePanelList[len(featurePanelList ):] = Guidelet.createFeaturePanels(self) self.sliceletPanelLayout.addItem( qt.QSpacerItem(20, 40, qt.QSizePolicy.Minimum, qt.QSizePolicy.Expanding)) return featurePanelList
def __init__(self, parent = None, name = "task_toolbox"): qt.QWidget.__init__(self, parent, name) # Data atributes self.shape_history = None self.tree_brick = None self.previous_page_index = 0 #Layout self.v_layout = qt.QVBoxLayout(self) self.v_layout.setSpacing(10) self.method_group_box = qt.QVGroupBox("Collection method", self) font = self.method_group_box.font() font.setPointSize(12) self.method_group_box.setFont(font) self.tool_box = qt.QToolBox(self.method_group_box , "tool_box") self.tool_box.setFixedWidth(475) font = self.tool_box.font() font.setPointSize(10) self.tool_box.setFont(font) self.discrete_page = CreateDiscreteWidget(self.tool_box, "Discrete",) self.discrete_page.setBackgroundMode(qt.QWidget.PaletteBackground) self.char_page = CreateCharWidget(self.tool_box, "Characterise") self.char_page.setBackgroundMode(qt.QWidget.PaletteBackground) self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page") self.helical_page.setBackgroundMode(qt.QWidget.PaletteBackground) self.energy_scan_page = CreateEnergyScanWidget(self.tool_box, "energy_scan") self.xrf_scan_page = CreateXRFScanWidget(self.tool_box, "xrf_scan") self.workflow_page = CreateWorkflowWidget(self.tool_box, 'workflow') self.tool_box.addItem(self.discrete_page, "Standard Collection") self.tool_box.addItem(self.char_page, "Characterisation") self.tool_box.addItem(self.helical_page, "Helical Collection") self.tool_box.addItem(self.energy_scan_page, "Energy Scan") self.tool_box.addItem(self.xrf_scan_page, "XRF Scan") self.tool_box.addItem(self.workflow_page, "Advanced") self.add_pixmap = Icons.load("add_row.png") self.create_task_button = qt.QPushButton(" Add to queue", self) self.create_task_button.setIconSet(qt.QIconSet(self.add_pixmap)) msg = "Add the collection method to the selected sample" qt.QToolTip.add(self.create_task_button, msg) self.v_layout.addWidget(self.method_group_box) self.button_hlayout = qt.QHBoxLayout(None) self.spacer = qt.QSpacerItem(1, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum) self.button_hlayout.addItem(self.spacer) self.button_hlayout.addWidget(self.create_task_button) self.method_group_box.layout().setSpacing(10) self.method_group_box.layout().addLayout(self.button_hlayout) qt.QObject.connect(self.create_task_button, qt.SIGNAL("clicked()"), self.create_task_button_click) qt.QObject.connect(self.tool_box, qt.SIGNAL("currentChanged( int )"), self.current_page_changed)
def __init__(self, parent=None, name=None, fl=0): qt.QWidget.__init__(self, parent, name, fl) # AsyncResult to return values self._async_result = None # Layout qt.QVBoxLayout(self) main_layout = self.layout() main_layout.setSpacing(10) main_layout.setMargin(6) self.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self.setCaption("GPhL Workflow parameters") # Info box self.info_gbox = qt.QVGroupBox("Info", self, "info_gbox") main_layout.addWidget(self.info_gbox) self.info_text = qt.QTextEdit(self.info_gbox, "info_text") self.info_text.setTextFormat(0) # PlainText self.info_text.setFont(qt.QFont("Courier")) self.info_text.setReadOnly(True) # Special parameter box self.cplx_gbox = qt.QVGroupBox("Indexing solution", self, "cplx_gbox") main_layout.addWidget(self.cplx_gbox) self.cplx_widget = None # Parameter box self.parameter_gbox = qt.QVGroupBox("Parameters", self, "parameter_gbox") main_layout.addWidget(self.parameter_gbox) self.params_widget = None # Button bar button_layout = qt.QHBoxLayout(None, 0, 6, "button_layout") hspacer = qt.QSpacerItem(1, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum) button_layout.addItem(hspacer) self.continue_button = qt.QPushButton("Continue", self, "continue_button") button_layout.addWidget(self.continue_button) self.cancel_button = qt.QPushButton("Abort", self, "cancel_button") button_layout.addWidget(self.cancel_button) main_layout.addLayout(button_layout) qt.QObject.connect(self.continue_button, qt.SIGNAL("clicked()"), self.continue_button_click) qt.QObject.connect(self.cancel_button, qt.SIGNAL("clicked()"), self.cancel_button_click) self.resize(qt.QSize(1018, 472).expandedTo(self.minimumSizeHint())) self.clearWState(qt.Qt.WState_Polished)
def __init__(self, *args): BaseComponents.BlissWidget.__init__(self, *args) self.addProperty("hwobj", "string", "") self.addProperty("titel", "string", "") self.addProperty("unit", "string", "") self.value_label = qt.QLabel(self) self.prefix_label = qt.QLabel(self) self.postfix_label = qt.QLabel(self) self.spacer = qt.QSpacerItem(1, 20, qt.QSizePolicy.Expanding, qt.QSizePolicy.Minimum) qt.QHBoxLayout(self) self.layout().addWidget(self.prefix_label) self.layout().addItem(self.spacer) self.layout().addWidget(self.value_label) self.layout().addWidget(self.postfix_label)
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) 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)