Ejemplo n.º 1
0
    def __init__(self, fields, parent=None):
        qt.QWidget.__init__(self, parent)
        self.field_widgets = list()

        #        qt.QVBoxLayout(self)
        #        grid = qt.QGridLayout()
        qt.QGridLayout(self)
        #        button_box = qt.QHBoxLayout()
        # We're trying to pack everything together on the lower left corner of the GUI
        self.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed)

        current_row = 0
        for field in fields:
            # should not happen but lets just skip them
            if field['type'] != 'message' and not field.has_key('uiLabel'):
                continue

            # hack until the 'real' xml gets implemented server side and this mess gets rewritten
            if field['type'] == 'message':
                logging.debug('creating widget with options: %s', field)
                w = make_widget(self, field)
                # message will be alone in the layout so that will not fsck up the layout
                self.layout().addMultiCellWidget(w, current_row, current_row,
                                                 0, 1)
            else:
                label = qt.QLabel(field['uiLabel'], self)
                logging.debug('creating widget with options: %s', field)
                w = make_widget(self, field)
                # Temporary (like this brick ...) hack to get a nicer UI
                w.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed)
                self.field_widgets.append(w)
                self.layout().addWidget(label, current_row, 0, qt.Qt.AlignLeft)
                self.layout().addWidget(w, current_row, 1, qt.Qt.AlignLeft)

            current_row += 1
Ejemplo n.º 2
0
  def setupUI(self):
    self.setWindowTitle("Case Number Selection")
    self.spinbox = qt.QSpinBox()
    self.spinbox.setRange(self.minimum, int("9" * self.CASE_NUMBER_OF_DIGITS))

    self.hideInvisibleUnneededComponents()

    self.textLabel = qt.QLabel("Please select a case number for the new case.")
    self.textLabel.setStyleSheet("font-weight: bold;")
    self.previewLabel = qt.QLabel("New case directory:")
    self.preview = qt.QLabel()
    self.notice = qt.QLabel()
    self.notice.setStyleSheet("color:red;")

    self.okButton = self.addButton(self.Ok)
    self.okButton.enabled = False
    self.cancelButton = self.addButton(self.Cancel)
    self.setDefaultButton(self.okButton)

    self.groupBox = qt.QGroupBox()
    self.groupBox.setLayout(qt.QGridLayout())
    self.groupBox.layout().addWidget(self.textLabel, 0, 0, 1, 2)
    self.groupBox.layout().addWidget(qt.QLabel("Proposed Case Number"), 1, 0)
    self.groupBox.layout().addWidget(self.spinbox, 1, 1)
    self.groupBox.layout().addWidget(self.previewLabel, 2, 0, 1, 2)
    self.groupBox.layout().addWidget(self.preview, 3, 0, 1, 2)
    self.groupBox.layout().addWidget(self.notice, 4, 0, 1, 2)

    self.groupBox.layout().addWidget(self.okButton, 5, 0)
    self.groupBox.layout().addWidget(self.cancelButton, 5, 1)

    self.layout().addWidget(self.groupBox, 1, 1)
Ejemplo n.º 3
0
    def __init__(self):
        # Init the main window.
        qt.QMainWindow.__init__(self)
        self.resize(350, 350)

        # Create the central widget.
        self.CentralWidget = qt.QWidget(self)
        self.setCentralWidget(self.CentralWidget)
        self.Layout = qt.QGridLayout(self.CentralWidget)

        # Create a button.
        self.QuitButton = qt.QPushButton(self.centralWidget())
        self.QuitButton.setText('Quit')
        self.Layout.addWidget(self.QuitButton, 1, 0)
        # Connect the button.
        qt.QObject.connect(self.QuitButton, qt.SIGNAL('clicked()'), self.quit)

        # Create a root histogram.
        self.hist = ROOT.TH1F("pipo", "pipo", 100, 0, 100)

        # Create the main TQtWidget (using sip to get the pointer to the central widget).
        self.Address = sip.unwrapinstance(self.CentralWidget)
        self.Canvas = ROOT.TQtWidget(sip.voidptr(self.Address).ascobject())

        # Place the TQtWidget in the main grid layout and draw the histogram.

        self.Layout.addWidget(
            sip.wrapinstance(ROOT.AddressOf(self.Canvas)[0], qt.QWidget), 0, 0)
        self.hist.Draw()
Ejemplo n.º 4
0
    def __init__(self, *args):
        qt.QWidget.__init__(self, *args)

        layout = qt.QGridLayout(self)

        # try to create a plot for SciPy arrays
        try:
            # import does_not_exist
            import numpy
            # make a curve and copy the data
            numpy_curve = Qwt.QwtPlotCurve('y = lorentzian(x)')
            x = numpy.arange(0.0, 10.0, 0.01)
            y = lorentzian(x)
            numpy_curve.setData(x, y)
            # here, we know we can plot NumPy arrays
            numpy_plot = Qwt.QwtPlot(self)
            numpy_plot.setTitle('numpy array')
            numpy_plot.setCanvasBackground(qt.Qt.white)
            numpy_plot.plotLayout().setCanvasMargin(0)
            numpy_plot.plotLayout().setAlignCanvasToScales(True)
            # insert a curve and make it red
            numpy_curve.attach(numpy_plot)
            numpy_curve.setPen(qt.QPen(qt.Qt.red))
            layout.addWidget(numpy_plot, 0, 0)
            numpy_plot.replot()
        except ImportError, message:
            print "%s: %s" % (ImportError, message)
            print "Install NumPy to plot NumPy arrays"
Ejemplo n.º 5
0
    def makePyramidWidgets(self):
        self.pyramidTab = qt.QWidget()
        self.parametersTabWidget.addTab(self.pyramidTab, 'Pyramid levels')
        self.pyramidLayout = qt.QGridLayout(self.pyramidTab)

        self.pyramidHighestSpinBox = qt.QSpinBox()
        self.pyramidHighestSpinBox.value = 3
        self.pyramidHighestSpinBox.setAlignment(qt.Qt.AlignCenter)
        self.pyramidHighestSpinBox.valueChanged.connect(
            self.onPyramidLevelsChanged)
        self.pyramidHighestLabel = qt.QLabel()
        self.pyramidHighestLabel.setAlignment(qt.Qt.AlignCenter)
        self.pyramidLayout.addWidget(qt.QLabel('Highest:'), 0, 0)
        self.pyramidLayout.addWidget(self.pyramidHighestSpinBox, 0, 1)
        self.pyramidLayout.addWidget(self.pyramidHighestLabel, 0, 2)

        self.pyramidLowestSpinBox = qt.QSpinBox()
        self.pyramidLowestSpinBox.value = 2
        self.pyramidLowestSpinBox.setAlignment(qt.Qt.AlignCenter)
        self.pyramidLowestSpinBox.valueChanged.connect(
            self.onPyramidLevelsChanged)
        self.pyramidLowestLabel = qt.QLabel()
        self.pyramidLowestLabel.setAlignment(qt.Qt.AlignCenter)
        self.pyramidLayout.addWidget(qt.QLabel('Lowest:'), 1, 0)
        self.pyramidLayout.addWidget(self.pyramidLowestSpinBox, 1, 1)
        self.pyramidLayout.addWidget(self.pyramidLowestLabel, 1, 2)

        self.pyramidGaussianFilteringCheckBox = qt.QCheckBox()
        self.pyramidLayout.addWidget(qt.QLabel('Gaussian filtering:'), 2, 0)
        self.pyramidLayout.addWidget(self.pyramidGaussianFilteringCheckBox, 2,
                                     1)
Ejemplo n.º 6
0
    def setup(self):
        self.setLayout(qt.QGridLayout())
        self.setupSliceWidget()

        iconSize = qt.QSize(36, 36)
        self.modifySegmentButton = self.createButton(
            "Modify Segmentation",
            icon=slicer.modules.segmenteditor.icon,
            iconSize=iconSize)
        self.confirmSegmentButton = self.createButton("Confirm Segmentation",
                                                      icon=Icons.apply,
                                                      iconSize=iconSize)
        self.cancelButton = self.createButton("Cancel",
                                              icon=Icons.cancel,
                                              iconSize=iconSize)

        self.setupSegmentEditor()
        self.layout().addWidget(self.segmentEditorWidget, 0, 0, 2, 1)
        self.layout().addWidget(self.sliceWidget, 0, 1)
        self.layout().addWidget(
            self.createHLayout([
                self.modifySegmentButton, self.confirmSegmentButton,
                self.cancelButton
            ]), 1, 1)
        self.setupConnections()
Ejemplo n.º 7
0
    def setup(self):
        self._findingInformationWidget = None

        self.setLayout(qt.QGridLayout())
        self._loadUI()
        self.layout().addWidget(self.ui)
        self._setupConnections()
Ejemplo n.º 8
0
  def setupMeasurementsArea(self):
    self.measurementsGroupBox = qt.QGroupBox("Measurements")
    self.measurementsGroupBox.setLayout(qt.QGridLayout())
    self.tableView = slicer.qMRMLTableView()
    self.tableView.setMinimumHeight(150)
    self.tableView.setMaximumHeight(150)
    self.tableView.setSelectionBehavior(qt.QTableView.SelectRows)

    if ModuleWidgetMixin.isQtVersionOlder():
      self.tableView.horizontalHeader().setResizeMode(qt.QHeaderView.Stretch)
    else:
      self.tableView.horizontalHeader().setSectionResizeMode(qt.QHeaderView.Stretch)

    self.fourUpTableView = None
    self.segmentStatisticsConfigButton = self.createButton("Segment Statistics Parameters")

    self.calculateMeasurementsButton = self.createButton("Calculate Measurements", enabled=False)
    self.calculateAutomaticallyCheckbox = qt.QCheckBox("Auto Update")
    self.calculateAutomaticallyCheckbox.checked = True

    self.measurementsGroupBox.layout().addWidget(self.tableView, 0, 0, 1, 2)
    self.measurementsGroupBox.layout().addWidget(self.segmentStatisticsConfigButton, 1, 0, 1, 2)
    self.measurementsGroupBox.layout().addWidget(self.calculateMeasurementsButton, 2, 0)
    self.measurementsGroupBox.layout().addWidget(self.calculateAutomaticallyCheckbox, 2, 1)

    self.mainModuleWidgetLayout.addWidget(self.measurementsGroupBox)
Ejemplo n.º 9
0
    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)
Ejemplo n.º 10
0
    def buildFontsPage(self, config, frame):
        """ buildFontsPage(...) -> construct widgets for the font settings

        """
        layout = qt.QGridLayout(frame, 10, 2, gridMargin, gridSpace)
        layout.setRowStretch(layout.numRows() + 10, 10)
        defaultfont = kdecore.KGlobalSettings.fixedFont()

        for args in ((0, 0), (1, 2), (2, 0)):
            layout.setColStretch(*args)

        for index, key in enumerate(('shell', 'code')):
            font = config.readFontEntry(key, defaultfont)

            fontlabel = qt.QLabel('%s' % (key.capitalize(), ), frame)
            fontchoose = kdeui.KPushButton('Choose...', frame)
            fontpreview = fontchoose.target = FontLabel(frame, font)

            layout.addWidget(fontlabel, index, 0)
            layout.addWidget(fontpreview, index, 1)
            layout.addWidget(fontchoose, index, 2)

            configrecord = (key, fontpreview, defaultfont, fontpreview.font,
                            fontpreview.setFont)
            self.setConfigWidget(frame, configrecord)

            self.connect(fontchoose, util.sigClicked, self.selectFont)
            self.connectChanged((fontpreview, util.sigTextChanged))
Ejemplo n.º 11
0
 def _setupSelectorArea(self):
     self.imageVolumeLabel = self.createLabel("Image volume: ",
                                              objectName="imageVolumeLabel")
     self.imageVolumeSelector = self.createComboBox(
         nodeTypes=["vtkMRMLScalarVolumeNode", ""],
         showChildNodeTypes=False,
         selectNodeUponCreation=True,
         toolTip="Pick algorithm input.",
         objectName="imageVolumeSelector")
     self.labelMapLabel = self.createLabel("Output label: ",
                                           objectName="labelMapLabel")
     self.labelMapSelector = self.createComboBox(
         nodeTypes=["vtkMRMLLabelMapVolumeNode", ""],
         showChildNodeTypes=False,
         selectNodeUponCreation=True,
         toolTip="Output label node",
         addEnabled=True,
         removeEnabled=True,
         noneEnabled=True,
         objectName="outputLabelMapSelector")
     self.selectorsGroupBox = qt.QGroupBox()
     self.selectorsGroupBox.objectName = "selectorsGroupBox"
     self.selectorsGroupBoxLayout = qt.QGridLayout()
     self.selectorsGroupBox.setLayout(self.selectorsGroupBoxLayout)
     self.selectorsGroupBoxLayout.addWidget(self.imageVolumeLabel, 0, 0)
     self.selectorsGroupBoxLayout.addWidget(self.imageVolumeSelector, 0, 1)
     self.selectorsGroupBoxLayout.addWidget(self.labelMapLabel, 1, 0)
     self.selectorsGroupBoxLayout.addWidget(self.labelMapSelector, 1, 1)
     self.layout.addWidget(self.selectorsGroupBox)
Ejemplo n.º 12
0
    def setup(self):
        self.setLayout(qt.QGridLayout())
        self.statusLabel = qt.QLabel("Status:")
        self.textLabel = qt.QLabel()
        self.layout().addWidget(self.statusLabel, 0, 0)
        self.layout().addWidget(self.textLabel, 0, 1, 1, 2)

        self.progress = qt.QProgressBar()
        self.progress.maximum = 0
        self.progress.setAlignment(qt.Qt.AlignCenter)

        self.layout().addWidget(self.progress, 1, 0, 1, qt.QSizePolicy.Maximum)

        self.buttonGroup = qt.QButtonGroup()
        self.skipButton = self.createButton(self.skipButtonText)
        self.cancelButton = self.createButton(self.cancelButtonText)
        self.directoryImportButton = self.createDirectoryButton(
            text="Import from directory",
            caption="Choose directory to import DICOM data from")

        self.buttonGroup.addButton(self.skipButton)
        self.buttonGroup.addButton(self.cancelButton)
        self.layout().addWidget(self.skipButton, 2, 0)
        self.layout().addWidget(self.cancelButton, 2, 1)
        self.layout().addWidget(self.directoryImportButton, 2, 2)

        buttonHeight = 30
        for b in [
                self.skipButton, self.cancelButton, self.directoryImportButton
        ]:
            b.minimumHeight = buttonHeight

        self.setupConnections()
Ejemplo n.º 13
0
    def setup(self):

        w = qt.QWidget()
        layout = qt.QGridLayout()
        w.setLayout(layout)
        self.layout.addWidget(w)
        w.show()
        self.layout = layout
Ejemplo n.º 14
0
  def setup(self):

    w = qt.QWidget();
    layout = qt.QGridLayout();
    w.setLayout(layout);
    self.layout.addWidget(w);
    w.show();
    self.layout = layout;

    ##    # Se crea una sección de parámetros en una pestaña desplegable
    parametersCollapsibleButton = ctk.ctkCollapsibleButton()
    parametersCollapsibleButton.text = "Parametros"
    self.layout.addWidget(parametersCollapsibleButton)

    parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)


    #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.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*)')


    # 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
    parametersFormLayout.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.onApplyButton)
##    self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect)

###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)
    parametersFormLayout.addRow("Output node:", self.outputSelector)
    self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.outputSelector, 'setMRMLScene(vtkMRMLScene*)')  
Ejemplo n.º 15
0
  def setup(self):
    self.setLayout(qt.QGridLayout())
    path = os.path.join(self.modulePath, 'Resources', 'UI', 'ProstateMeasurementItemWidget.ui')
    self.ui = slicer.util.loadUI(path)

    self._measurementIconLabel = self.ui.findChild(qt.QLabel, "measurementTypeLabel")
    self._measurementLabel = self.ui.findChild(qt.QLabel, "measurementLabel")

    self.layout().addWidget(self.ui)
Ejemplo n.º 16
0
    def __init__(self, infile):
        qt.QWidget.__init__(self)
        layout = qt.QGridLayout()

        # load parameters
        with open(infile) as f:
            self.pars = pars = yaml.load(f, Loader=yaml.FullLoader)

        self.images = ImageContainer(pars)

        def getOnChanged(idx):
            def func(vals):
                self.images.radii[idx] = vals[0]
                self.images.weights[idx] = vals[1]
                self.redraw()
            return func

        def getEditChanged(cntrl, idx):
            def func():
                text = cntrl.text()
                try:
                    self.images.scales[idx] = float(text)
                except ValueError:
                    cntrl.setText(str(self.images.scales[idx]))
                    return
                self.redraw()
            return func

        def getCheck(idx, cntrl):
            def func():
                self.images.scales[idx] = -self.images.scales[idx]
                cntrl.setText(str(self.images.scales[idx]))
                self.redraw()
            return func

        for i in range(len(self.images.images)):

            radii = self.images.radii[i]
            weights = self.images.weights[i]
#            print('r', radii)
#            print('w', weights)

            cntrl = curvecontrol.CurveView([radii, weights])
            cntrl.changed.connect( getOnChanged(i) )
            layout.addWidget(cntrl, i, 0)

            l = qt.QLineEdit()
            l.setText(str(self.images.scales[i]))
            l.editingFinished.connect( getEditChanged(l, i) )
            layout.addWidget(l, i, 1)

            c = qt.QCheckBox()
            c.clicked.connect( getCheck(i, l) )
            layout.addWidget(c, i, 2)

        self.setLayout(layout)
        self.redraw()
Ejemplo n.º 17
0
    def setup(self):
        self.mainFrame = qt.QFrame()
        frameLayout = qt.QGridLayout()
        self.mainFrame.setLayout(frameLayout)
        self.layout.addWidget(self.mainFrame)

        self.saveButton = ctk.ctkPushButton()
        self.saveButton.text = "Save"
        self.saveButton.toolTip = "Save the current table"
        self.saveButton.objectName = "reportSaveButton"
        self.saveButton.setIcon(qt.QIcon("{0}/Save.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.saveButton.setIconSize(qt.QSize(24, 24))
        frameLayout.addWidget(self.saveButton, 0, 0)

        self.openButton = ctk.ctkPushButton()
        self.openButton.text = "Open"
        self.openButton.toolTip = "Open all the results saved"
        self.openButton.objectName = "reportOpenButton"
        self.openButton.setIcon(qt.QIcon("{0}/open_file.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.openButton.setIconSize(qt.QSize(24,24))
        frameLayout.addWidget(self.openButton, 0, 1)

        self.exportButton = ctk.ctkPushButton()
        self.exportButton.text = "Export"
        self.exportButton.toolTip = "Export all the saved results to a CSV file"
        self.exportButton.objectName = "reportExportButton"
        self.exportButton.setIcon(qt.QIcon("{0}/export-csv.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.exportButton.setIconSize(qt.QSize(24,24))
        frameLayout.addWidget(self.exportButton, 0, 2)

        self.removeButton = ctk.ctkPushButton()
        self.removeButton.setIcon(qt.QIcon("{0}/delete.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.removeButton.setIconSize(qt.QSize(24,24))
        self.removeButton.text = "Clean cache"
        frameLayout.addWidget(self.removeButton, 0, 3)

        self.printButton = ctk.ctkPushButton()
        self.printButton.text = "Print"
        self.printButton.toolTip = "Print report"
        self.printButton.objectName = "reportPrintButton"
        self.printButton.setIcon(qt.QIcon("{0}/print.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.printButton.setIconSize(qt.QSize(24,24))
        self.printButton.setVisible(False)  # By default, this button will be hidden
        frameLayout.addWidget(self.printButton, 0, 4)

        self.additionalComentsLabel = qt.QLabel("Additional comments:")
        self.additionalComentsLabel.setStyleSheet("margin-top: 3px")
        frameLayout.addWidget(self.additionalComentsLabel, 1, 0, 1, 2)
        self.additionalComentsTextEdit = CollapsibleMultilineText()
        frameLayout.addWidget(self.additionalComentsTextEdit, 1, 1, 1, 3)

        self.openButton.connect('clicked()', self.onShowStoredData)
        self.saveButton.connect('clicked()', self.onSave)
        self.exportButton.connect('clicked()', self.onExport)
        self.printButton.connect('clicked()', self.onPrintReport)
        self.removeButton.connect('clicked()', self.onRemoveStoredData)
  def setup(self):
    self.setLayout(qt.QGridLayout())
    self._loadUI()

    self.generateFormWidgets()
    self.currentForm = self.formWidgets[0]

    self.updateNavigationButtons()

    self.layout().addWidget(self.ui)
 def setupGUIAndConnections(self):
     iconSize = qt.QSize(36, 36)
     self.inputVolumeGroupBox = qt.QGroupBox()
     self.inputVolumeGroupBoxLayout = qt.QFormLayout()
     self.inputVolumeGroupBox.setLayout(self.inputVolumeGroupBoxLayout)
     self.inputVolumeGroupBox.setFlat(True)
     self.zFrameTemplateVolumeSelector = self.createComboBox(
         nodeTypes=["vtkMRMLScalarVolumeNode", ""])
     self.inputVolumeGroupBoxLayout.addRow(
         "ZFrame template volume: ", self.zFrameTemplateVolumeSelector)
     self.layout.addWidget(self.inputVolumeGroupBox)
     self.layout.addStretch()
     self.zFrameRegistrationManualIndexesGroupBox = qt.QGroupBox(
         "Use manual start/end indexes")
     self.zFrameRegistrationManualIndexesGroupBox.setCheckable(True)
     self.zFrameRegistrationManualIndexesGroupBoxLayout = qt.QGridLayout()
     self.zFrameRegistrationManualIndexesGroupBox.setLayout(
         self.zFrameRegistrationManualIndexesGroupBoxLayout)
     self.zFrameRegistrationManualIndexesGroupBox.checked = False
     self.zFrameRegistrationStartIndex = qt.QSpinBox()
     self.zFrameRegistrationEndIndex = qt.QSpinBox()
     hBox = qt.QWidget()
     hBox.setLayout(qt.QHBoxLayout())
     hBox.layout().addWidget(qt.QLabel("start"))
     hBox.layout().addWidget(self.zFrameRegistrationStartIndex)
     hBox.layout().addWidget(qt.QLabel("end"))
     hBox.layout().addWidget(self.zFrameRegistrationEndIndex)
     self.zFrameRegistrationManualIndexesGroupBoxLayout.addWidget(
         hBox, 1, 1, qt.Qt.AlignRight)
     self.runZFrameRegistrationButton = self.createButton(
         "",
         enabled=False,
         icon=Icons.apply,
         iconSize=iconSize,
         toolTip="Run ZFrame Registration")
     self.retryZFrameRegistrationButton = self.createButton(
         "",
         enabled=False,
         icon=Icons.retry,
         iconSize=iconSize,
         toolTip="Reset")
     self.layout.addWidget(self.zFrameRegistrationManualIndexesGroupBox)
     widget = qt.QWidget()
     widget.setLayout(qt.QHBoxLayout())
     widget.layout().addWidget(self.runZFrameRegistrationButton)
     widget.layout().addWidget(self.retryZFrameRegistrationButton)
     self.layout.addWidget(widget)
     self.layout.addStretch(1)
     self.zFrameTemplateVolumeSelector.connect(
         'currentNodeChanged(bool)', self.loadVolumeAndEnableEditor)
     self.retryZFrameRegistrationButton.clicked.connect(
         self.onRetryZFrameRegistrationButtonClicked)
     self.runZFrameRegistrationButton.clicked.connect(
         self.onApplyZFrameRegistrationButtonClicked)
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        settings = qt.QSettings()
        if settings.value("lapdMouseDBBrowserLocalCacheFolder", "") == "":
            settings.setValue("lapdMouseDBBrowserLocalCacheFolder",
                              "./lapdMouse")
            settings.sync()
        databaseDirectory = settings.value(
            "lapdMouseDBBrowserLocalCacheFolder")

        self.browserWindow = lapdMouseBrowserWindow()
        self.browserWindow.localCashFolder = databaseDirectory
        self.browserWindow.load()
        self.browserWindow.show()

        self.logic = lapdMouseDBBrowserLogic()

        # Instantiate and connect widgets ...

        #
        # Parameters Area
        #
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "lapdMouse database"
        self.layout.addWidget(parametersCollapsibleButton)

        # Layout within the dummy collapsible button
        parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

        # extract/merge
        self.openBrowserWindowButton = qt.QPushButton("Show browser")
        self.openBrowserWindowButton.toolTip = "Open lapdMouse database browser window."
        self.openBrowserWindowButton.connect('clicked()',
                                             self.browserWindow.show)
        parametersFormLayout.addRow("Window:", self.openBrowserWindowButton)

        settingsCollapsibleButton = ctk.ctkCollapsibleButton()
        settingsCollapsibleButton.text = "Settings"
        self.layout.addWidget(settingsCollapsibleButton)
        settingsGridLayout = qt.QGridLayout(settingsCollapsibleButton)
        settingsCollapsibleButton.collapsed = False

        self.storagePath = self.browserWindow.localCashFolder
        storagePathLabel = qt.QLabel("Storage Folder: ")
        self.storagePathButton = ctk.ctkDirectoryButton()
        self.storagePathButton.directory = self.storagePath
        settingsGridLayout.addWidget(storagePathLabel, 0, 0, 1, 1)
        settingsGridLayout.addWidget(self.storagePathButton, 0, 1, 1, 4)

        self.storagePathButton.connect('directoryChanged(const QString &)',
                                       self.onStorageChanged)

        self.layout.addStretch(1)
Ejemplo n.º 21
0
 def __init__(self, connectedLayout, parent=None, **kwargs):
     qt.QMessageBox.__init__(self, parent, **kwargs)
     self.setStandardButtons(0)
     self.setLayout(qt.QGridLayout())
     self.algorithmFrame = qt.QFrame()
     self.algorithmFrame.setLayout(connectedLayout)
     self.layout().addWidget(self.algorithmFrame, 0, 0, 1, 1)
     self.okButton = self.createButton("OK")
     self.addButton(self.okButton, qt.QMessageBox.AcceptRole)
     self.layout().addWidget(self.createHLayout([self.okButton]), 1, 0, 1,
                             1)
Ejemplo n.º 22
0
 def setupManualIndexesGroupBox(self):
   self.zFrameRegistrationManualIndexesGroupBox = qt.QGroupBox("Use manual start/end indexes")
   self.zFrameRegistrationManualIndexesGroupBox.setCheckable(True)
   self.zFrameRegistrationManualIndexesGroupBoxLayout = qt.QGridLayout()
   self.zFrameRegistrationManualIndexesGroupBox.setLayout(self.zFrameRegistrationManualIndexesGroupBoxLayout)
   self.zFrameRegistrationManualIndexesGroupBox.checked = False
   self.zFrameRegistrationStartIndex = qt.QSpinBox()
   self.zFrameRegistrationEndIndex = qt.QSpinBox()
   hBox = self.createHLayout([qt.QLabel("start"), self.zFrameRegistrationStartIndex,
                              qt.QLabel("end"), self.zFrameRegistrationEndIndex])
   self.zFrameRegistrationManualIndexesGroupBoxLayout.addWidget(hBox, 1, 1, qt.Qt.AlignRight)
Ejemplo n.º 23
0
    def createSmall(self):
        """Make the internals of the widget to display in the
    Data Probe frame (lower left of slicer main window by default)"""
        # top row - things about the viewer itself
        self.viewerFrame = qt.QFrame(self.frame)
        self.viewerFrame.setLayout(qt.QHBoxLayout())
        self.frame.layout().addWidget(self.viewerFrame)
        self.viewerColor = qt.QLabel(self.viewerFrame)
        self.viewerFrame.layout().addWidget(self.viewerColor)
        self.viewerName = qt.QLabel(self.viewerFrame)
        self.viewerFrame.layout().addWidget(self.viewerName)
        self.viewerRAS = qt.QLabel()
        self.viewerFrame.layout().addWidget(self.viewerRAS)
        self.viewerOrient = qt.QLabel()
        self.viewerFrame.layout().addWidget(self.viewerOrient)
        self.viewerSpacing = qt.QLabel()
        self.viewerFrame.layout().addWidget(self.viewerSpacing)
        self.viewerFrame.layout().addStretch(1)

        # the grid - things about the layers
        # this method makes labels
        self.layerGrid = qt.QFrame(self.frame)
        self.layerGrid.setLayout(qt.QGridLayout())
        self.frame.layout().addWidget(self.layerGrid)
        layers = ('L', 'F', 'B')
        self.layerNames = {}
        self.layerIJKs = {}
        self.layerValues = {}
        row = 0
        for layer in layers:
            col = 0
            self.layerGrid.layout().addWidget(qt.QLabel(layer), row, col)
            col += 1
            self.layerNames[layer] = qt.QLabel()
            self.layerGrid.layout().addWidget(self.layerNames[layer], row, col)
            col += 1
            self.layerIJKs[layer] = qt.QLabel()
            self.layerGrid.layout().addWidget(self.layerIJKs[layer], row, col)
            col += 1
            self.layerValues[layer] = qt.QLabel()
            self.layerGrid.layout().addWidget(self.layerValues[layer], row,
                                              col)
            self.layerGrid.layout().setColumnStretch(col, 100)
            col += 1
            row += 1

        # goto module button
        self.goToModule = qt.QPushButton('->', self.frame)
        self.goToModule.setToolTip(
            'Go to the DataProbe module for more information and options')
        self.frame.layout().addWidget(self.goToModule)
        self.goToModule.connect("clicked()", self.onGoToModule)
        # hide this for now - there's not much to see in the module itself
        self.goToModule.hide()
Ejemplo n.º 24
0
 def createCaseInformationArea(self):
   self.casesRootDirectoryButton = self.createDirectoryButton(text="Choose cases root location",
                                                              caption="Choose cases root location",
                                                              directory=self.getSetting('CasesRootLocation'))
   self.createCaseWatchBox()
   self._collapsibleDirectoryConfigurationArea.collapsed = True
   self._collapsibleDirectoryConfigurationArea.text = "Case Directory Settings"
   self.directoryConfigurationLayout = qt.QGridLayout(self._collapsibleDirectoryConfigurationArea)
   self.directoryConfigurationLayout.addWidget(qt.QLabel("Cases Root Directory"), 1, 0, 1, 1)
   self.directoryConfigurationLayout.addWidget(self.casesRootDirectoryButton, 1, 1, 1, 1)
   self.directoryConfigurationLayout.addWidget(self.caseWatchBox, 2, 0, 1, qt.QSizePolicy.ExpandFlag)
   self.layout.addWidget(self._collapsibleDirectoryConfigurationArea)
Ejemplo n.º 25
0
  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')
Ejemplo n.º 26
0
    def setup(self):
        self.setStyleSheet(self.DEFAULT_STYLE)
        layout = qt.QGridLayout()
        self.setLayout(layout)

        column = 0
        for index, attribute in enumerate(self.attributes):
            layout.addWidget(attribute.titleLabel, index / self.columns,
                             column * 2, 1, 1, qt.Qt.AlignLeft)
            layout.addWidget(attribute.valueLabel, index / self.columns,
                             column * 2 + 1, 1, qt.Qt.AlignLeft)
            column = column + 1 if column < self.columns - 1 else 0
Ejemplo n.º 27
0
  def setupImportLabelmap(self):
    self.importLabelMapCollapsibleButton = ctk.ctkCollapsibleButton()
    self.importLabelMapCollapsibleButton.collapsed = True
    self.importLabelMapCollapsibleButton.enabled = False
    self.importLabelMapCollapsibleButton.text = "Import from labelmap"
    self.importLabelMapCollapsibleLayout = qt.QGridLayout(self.importLabelMapCollapsibleButton)

    self.labelMapImportWidget = ImportLabelMapIntoSegmentationWidget()
    self.labelMapImportWidget.addEventObserver(self.labelMapImportWidget.FailedEvent, self.onImportFailed)
    self.labelMapImportWidget.addEventObserver(self.labelMapImportWidget.SuccessEvent, self.onLabelMapImportSuccessful)
    self.labelMapImportWidget.segmentationNodeSelectorVisible = False
    self.importLabelMapCollapsibleLayout.addWidget(self.labelMapImportWidget)
    self.mainModuleWidgetLayout.addWidget(self.importLabelMapCollapsibleButton)
Ejemplo n.º 28
0
  def setupImportSegmentation(self):
    self.importSegmentationCollapsibleButton = ctk.ctkCollapsibleButton()
    self.importSegmentationCollapsibleButton.collapsed = True
    self.importSegmentationCollapsibleButton.enabled = False
    self.importSegmentationCollapsibleButton.text = "Import from segmentation"
    self.importSegmentsCollapsibleLayout = qt.QGridLayout(self.importSegmentationCollapsibleButton)

    self.segmentImportWidget = CopySegmentBetweenSegmentationsWidget()
    self.segmentImportWidget.addEventObserver(self.segmentImportWidget.FailedEvent, self.onImportFailed)
    self.segmentImportWidget.addEventObserver(self.segmentImportWidget.SuccessEvent, self.onImportFinished)
    self.segmentImportWidget.segmentationNodeSelectorEnabled = False
    self.importSegmentsCollapsibleLayout.addWidget(self.segmentImportWidget)
    self.mainModuleWidgetLayout.addWidget(self.importSegmentationCollapsibleButton)
Ejemplo n.º 29
0
    def setup(self):
        super(ProstateAblationTrainingPlugin, self).setup()
        self.collapsibleTrainingArea = ctk.ctkCollapsibleButton()
        self.collapsibleTrainingArea.collapsed = True
        self.collapsibleTrainingArea.text = "Training Incoming Data Simulation"

        self.simulateIntraopPhaseButton = self.createButton(
            "Simulate intraop reception", enabled=True)

        self.trainingsAreaLayout = qt.QGridLayout(self.collapsibleTrainingArea)
        self.trainingsAreaLayout.addWidget(
            self.createHLayout([self.simulateIntraopPhaseButton]))
        self.layout().addWidget(self.collapsibleTrainingArea)
Ejemplo n.º 30
0
 def setupRegistrationResultsPlugin(self):
   self.regResultsCollapsibleButton = ctk.ctkCollapsibleButton()
   self.regResultsCollapsibleButton.collapsed = True
   self.regResultsCollapsibleButton.text = "Registration Evaluation"
   self.regResultsCollapsibleButton.hide()
   self.regResultsCollapsibleLayout= qt.QGridLayout(self.regResultsCollapsibleButton)
   self.regResultsPlugin = SliceTrackerRegistrationResultsPlugin()
   self.regResultsPlugin.addEventObserver(self.regResultsPlugin.NoRegistrationResultsAvailable,
                                           self.onNoRegistrationResultsAvailable)
   self.regResultsPlugin.resultSelectorVisible = False
   self.regResultsPlugin.titleVisible = False
   self.regResultsPlugin.visualEffectsTitle = ""
   self.regResultsPlugin.registrationTypeButtonsVisible = False
   self.addPlugin(self.regResultsPlugin)
   self.regResultsCollapsibleLayout.addWidget(self.regResultsPlugin)