def setBrowserWidgetInDICOMLayout(self, browserWidget):
        """Set DICOM browser widget in the custom view layout"""
        if self.browserWidget == browserWidget:
            return

        if self.browserWidget is not None:
            self.browserWidget.closed.disconnect(self.onBrowserWidgetClosed)

        oldBrowserWidget = self.browserWidget
        self.browserWidget = browserWidget
        self.browserWidget.setAutoFillBackground(True)
        if slicer.util.mainWindow():
            # For some reason, we cannot disconnect this event connection if
            # main window, and not disconnecting would cause crash on application shutdown,
            # so we only connect when main window is present.
            self.browserWidget.closed.connect(self.onBrowserWidgetClosed)

        if self.viewWidget is None:
            self.viewWidget = qt.QWidget()
            self.viewWidget.setAutoFillBackground(True)
            self.viewFactory.setWidget(self.viewWidget)
            layout = qt.QVBoxLayout()
            self.viewWidget.setLayout(layout)

            label = qt.QLabel("DICOM database")
            label.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)
            layout.addWidget(label)
            font = qt.QFont()
            font.setBold(True)
            font.setPointSize(12)
            label.setFont(font)

        if oldBrowserWidget is not None:
            self.viewWidget.layout().removeWidget(oldBrowserWidget)

        if self.browserWidget:
            self.viewWidget.layout().addWidget(self.browserWidget)
示例#2
0
    def __init__(self, atlasPath):

        try:
            import h5py
        except:
            slicer.util.pip_install('h5py')
            import h5py

        with h5py.File(atlasPath, 'r') as atlasFile:
            names = self.readNames(atlasFile)
            colors = self.readColors(atlasFile)
            types = self.readTypes(atlasFile)
            showIndex = self.readShowIndex(atlasFile)
            pixdimTypes = self.readPixdimType(atlasFile)

        self.structures = []

        for i, pixdimType in enumerate(pixdimTypes):
            if pixdimType == 'numeric':
                structure = ModelStructure()
            elif pixdimType == 'fibers':
                structure = FibersStructure()
            elif pixdimType == 'discfibers':
                structure = DiscFibersStructure()
            if isinstance(structure, FibersStructure) and not hasattr(
                    slicer.modules, 'tractographydisplay'):
                qt.QMessageBox().warning(
                    qt.QWidget(), "Error",
                    "Install SlicerDMRI Extension to load fiber atlases")
                continue
            structure.atlasPath = atlasPath
            structure.index = i
            structure.name = names[i]
            structure.color = colors[i]
            structure.type = types[i]
            structure.visibility = i in showIndex
            self.structures.append(structure)
 def onSelectInputModels(self):
     InputModelsDirectory = self.GroupsInputModelsDirectory.directory.encode(
         'utf-8')
     self.InputModelsDirectory = InputModelsDirectory
     self.PropertiesNames = []
     listMesh = os.listdir(InputModelsDirectory)
     if listMesh.count(".DS_Store"):
         listMesh.remove(".DS_Store")
     #VTKfilepath = os.path.join( modelsDir, listMesh[0])
     VTKfilepath = InputModelsDirectory + '/' + listMesh[0]
     if os.path.exists(VTKfilepath):
         reader = vtk.vtkPolyDataReader()
         reader.SetFileName(VTKfilepath)
         reader.Update()
         polydata = reader.GetOutput()
         for i in range(polydata.GetPointData().GetNumberOfArrays()):
             self.PropertiesNames.append(
                 polydata.GetPointData().GetArrayName(i))
     row = 0
     for PropertyName in self.PropertiesNames:
         self.GroupsProperties.setRowCount(row + 1)
         # Column 0:
         labelPropertyName = qt.QLabel(PropertyName)
         labelPropertyName.setAlignment(0x84)
         self.GroupsProperties.setCellWidget(row, 0, labelPropertyName)
         # Column 1:
         widget = qt.QWidget()
         layout = qt.QHBoxLayout(widget)
         spinBox = qt.QSpinBox()
         spinBox.setMinimum(0)
         layout.addWidget(spinBox)
         layout.setAlignment(0x84)
         layout.setContentsMargins(0, 0, 0, 0)
         widget.setLayout(layout)
         self.GroupsProperties.setCellWidget(row, 1, widget)
         row = row + 1
    def __init__(self, workflow_configuration, parent=None):
        if not parent:
            self.parent = qt.QWidget()
            self.parent.setLayout(qt.QVBoxLayout())
        else:
            self.parent = parent

        self.workflow_configuration = workflow_configuration

        parent.connect(parent, 'mrmlSceneChanged(vtkMRMLScene*)',
                       self.workflow_configuration.setMRMLScene)
        self.workflow_configuration.setMRMLScene(slicer.mrmlScene)

        loader = qt.QUiLoader()

        self.steps = []

        def onEntryCallback(actual_step, comingFrom, transitionType):
            data = self.extract_data()

            method_name = 'on_entry_' + actual_step.id()
            if hasattr(self.workflow_configuration, method_name):
                on_entry = getattr(self.workflow_configuration, method_name)
                on_entry(actual_step, comingFrom, transitionType, data)
                self.update_data(data)

        def onExitCallback(actual_step, comingFrom, transitionType):
            data = self.extract_data()

            method_name = 'on_exit_' + actual_step.id()
            if hasattr(self.workflow_configuration, method_name):
                on_exit = getattr(self.workflow_configuration, method_name)
                on_exit(actual_step, comingFrom, transitionType, data)
                self.update_data(data)

        def validateCallback(actual_step, desiredBranchId):
            data = self.extract_data()

            method_name = 'validate_' + actual_step.id()
            if hasattr(self.workflow_configuration, method_name):
                validate = getattr(self.workflow_configuration, method_name)
                return validate(actual_step, data)
            else:
                return True

        self.callbacks = {
            'onEntryCallback': onEntryCallback,
            'onExitCallback': onExitCallback,
            'validateCallback': validateCallback
        }

        for step_widget_file in self.workflow_configuration.step_widget_files:
            path = os.path.join(os.path.dirname(__file__), 'Resources', 'UI',
                                step_widget_file + '.ui')

            qfile = qt.QFile(path)
            qfile.open(qt.QFile.ReadOnly)
            widget = loader.load(qfile)

            if hasattr(widget, 'setMRMLScene'):
                widget.connect(parent, 'mrmlSceneChanged(vtkMRMLScene*)',
                               widget.setMRMLScene)
                widget.setMRMLScene(slicer.mrmlScene)

            if hasattr(self.workflow_configuration, 'post_widget_init'):
                self.workflow_configuration.post_widget_init(
                    step_widget_file, widget)

            step = GeneralizedStep(step_widget_file,
                                   widget,
                                   onEntryCallback=onEntryCallback,
                                   onExitCallback=onExitCallback,
                                   validateCallback=validateCallback)

            self.steps.append((step_widget_file, step))

        self.workflow = ctk.ctkWorkflow(self.parent)
        self.workflowWidget = ctk.ctkWorkflowStackedWidget()

        self.workflowWidget.setWorkflow(self.workflow)
        self.parent.layout().addWidget(self.workflowWidget)

        for i in xrange(len(self.steps) - 1):
            self.workflow.addTransition(self.steps[i][1], self.steps[i + 1][1])

        self.workflow.start()
示例#5
0
    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)
示例#6
0
    def setup(self, showPreview=False):
        """
        main window is a frame with widgets from the app
        widget repacked into it along with slicer-specific
        extra widgets
        """

        self.setWindowTitle('DICOM Browser')
        self.setLayout(qt.QVBoxLayout())

        self.dicomBrowser.databaseDirectorySelectorVisible = False
        self.dicomBrowser.toolbarVisible = False
        self.dicomBrowser.sendActionVisible = True
        self.dicomBrowser.databaseDirectorySettingsKey = slicer.dicomDatabaseDirectorySettingsKey
        self.dicomBrowser.dicomTableManager().dynamicTableLayout = False
        horizontal = self.settings.setValue('DICOM/horizontalTables', 0)
        self.dicomBrowser.dicomTableManager(
        ).tableOrientation = qt.Qt.Horizontal if horizontal else qt.Qt.Vertical
        self.layout().addWidget(self.dicomBrowser)

        self.userFrame = qt.QWidget()
        self.preview = qt.QWidget()

        #
        # preview related column
        #
        self.previewLayout = qt.QVBoxLayout()
        if showPreview:
            self.previewLayout.addWidget(self.preview)
        else:
            self.preview.hide()

        #
        # action related column (interacting with slicer)
        #
        self.loadableTableFrame = qt.QWidget()
        self.loadableTableFrame.setMaximumHeight(200)
        self.loadableTableLayout = qt.QVBoxLayout(self.loadableTableFrame)
        self.layout().addWidget(self.loadableTableFrame)

        self.loadableTableLayout.addWidget(self.userFrame)
        self.userFrame.hide()

        self.loadableTable = DICOMLoadableTable(self.userFrame)
        self.loadableTable.itemChanged.connect(self.onLoadableTableItemChanged)

        #
        # button row for action column
        #
        self.actionButtonsFrame = qt.QWidget()
        self.actionButtonsFrame.setMaximumHeight(40)
        self.actionButtonsFrame.objectName = 'ActionButtonsFrame'
        self.layout().addWidget(self.actionButtonsFrame)

        self.actionButtonLayout = qt.QHBoxLayout()
        self.actionButtonsFrame.setLayout(self.actionButtonLayout)

        self.uncheckAllButton = qt.QPushButton('Uncheck All')
        self.actionButtonLayout.addWidget(self.uncheckAllButton)
        self.uncheckAllButton.connect('clicked()', self.uncheckAllLoadables)

        self.actionButtonLayout.addStretch(0.05)

        self.examineButton = qt.QPushButton('Examine')
        self.examineButton.setSizePolicy(qt.QSizePolicy.Expanding,
                                         qt.QSizePolicy.Fixed)
        self.actionButtonLayout.addWidget(self.examineButton)
        self.examineButton.enabled = False
        self.examineButton.connect('clicked()', self.examineForLoading)

        self.loadButton = qt.QPushButton('Load')
        self.loadButton.setSizePolicy(qt.QSizePolicy.Expanding,
                                      qt.QSizePolicy.Fixed)
        self.loadButton.toolTip = 'Load selected items into the scene'
        self.actionButtonLayout.addWidget(self.loadButton)
        self.loadButton.connect('clicked()', self.loadCheckedLoadables)

        self.actionButtonLayout.addStretch(0.05)

        self.advancedViewButton = qt.QCheckBox('Advanced')
        self.advancedViewButton.objectName = 'AdvancedViewCheckBox'
        self.actionButtonLayout.addWidget(self.advancedViewButton)
        self.advancedViewButton.checked = self.advancedView
        self.advancedViewButton.toggled.connect(self.onAdvancedViewButton)

        if self.advancedView:
            self.loadableTableFrame.visible = True
        else:
            self.loadableTableFrame.visible = False
            self.examineButton.visible = False
            self.uncheckAllButton.visible = False

        #
        # Series selection
        #
        self.dicomBrowser.dicomTableManager().connect(
            'seriesSelectionChanged(QStringList)', self.onSeriesSelected)

        #
        # Loadable table widget (advanced)
        # DICOM Plugins selection widget is moved to module panel
        #
        self.loadableTableLayout.addWidget(self.loadableTable)
        self.updateButtonStates()
示例#7
0
def checkMandatoryModules():
    try:
        from PyQt4 import QtGui, QtCore

        if os.name == "nt":
            pywin32IsAvailable = False
            try:
                import win32api, win32con, win32com

                pywin32IsAvailable = True
            except:
                pass
            if pywin32IsAvailable is False:
                app = QtGui.QApplication(sys.argv)
                w = QtGui.QWidget()
                l = QtGui.QVBoxLayout(w)
                pbtn = QtGui.QPushButton('Quit', w)
                pbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)
                lblAlert = QtGui.QLabel(
                    "<br><b><a href='https://sourceforge.net/projects/pywin32/'>'Python for Windows Extensions'</a> (pywin32) named module has NOT installed on your system.</b><br><br>You have to install it on your system to run Hamsi Manager.<br><br>",
                    w)
                lblAlert.setOpenExternalLinks(True)
                l.addWidget(lblAlert)
                l.addWidget(pbtn)
                w.setLayout(l)
                w.setWindowTitle('Critical Error!')
                w.show()
                w.setMinimumWidth(400)
                sys.exit(app.exec_())
        return True
    except:
        try:
            import qt

            qtHamsiManagerApp = qt.QApplication(sys.argv)
            panel = qt.QWidget()
            panel.vblMain = qt.QVBoxLayout(panel)
            lblInfo = qt.QLabel(
                "<br><b>PyQt4 is not installed:</b><br>You have to install \"PyQt4\" on your system to run Hamsi Manager.",
                panel)
            pbtnClose = qt.QPushButton("OK", panel)
            panel.connect(pbtnClose, qt.SIGNAL("clicked()"),
                          qtHamsiManagerApp.quit)
            hbox0 = qt.QHBoxLayout()
            hbox0.addStretch(2)
            hbox0.addWidget(pbtnClose, 1)
            vbox0 = qt.QVBoxLayout()
            vbox0.addWidget(lblInfo)
            vbox0.addLayout(hbox0)
            hbox1 = qt.QHBoxLayout()
            hbox1.addStretch(20)
            hbox1.addLayout(vbox0, 500)
            hbox1.addStretch(5)
            panel.vblMain.addLayout(hbox1)
            panel.setCaption("Critical Error!")
            panel.show()
            panel.setMinimumWidth(400)
            qtHamsiManagerApp.enter_loop()
        except:
            try:
                import gtk

                def destroy(widget, data=None):
                    gtk.main_quit()

                window = gtk.Window(gtk.WINDOW_TOPLEVEL)
                window.connect("destroy", destroy)
                window.set_title("Critical Error!")
                button = gtk.Button("OK")
                label = gtk.Label("PyQt4 is not installed.")
                label2 = gtk.Label(
                    "You have to install \"PyQt4\" on your system to run Hamsi Manager."
                )
                label2.set_line_wrap(True)
                button.connect("clicked", gtk.main_quit, None)
                vbox = gtk.VBox(False, 5)
                hbox = gtk.HBox(window)
                window.add(hbox)
                hbox.pack_start(vbox, False, False, 0)
                window.set_border_width(5)
                hbox0 = gtk.HBox(False)
                hbox0.pack_start(label, 0, 0, 0)
                hbox1 = gtk.HBox(False)
                label3 = gtk.Label("")
                hbox1.pack_start(label3, 0, 0, 0)
                hbox1.pack_start(button, 0, 0, 0)
                vbox.pack_start(hbox0, False, False, 0)
                vbox.pack_start(label2, False, False, 0)
                vbox.pack_start(hbox1, False, False, 0)
                layout = gtk.Layout(None, None)
                button.set_size_request(120, 25)
                label2.set_size_request(350, 35)
                label3.set_size_request(230, 25)
                window.show_all()
                gtk.main()
            except:
                try:
                    import Tkinter

                    tMainWindow = Tkinter.Tk()
                    tMainWindow.geometry("350x100")
                    tMainWindow.title("Critical Error!")
                    lbl1 = Tkinter.Label(text="PyQt4 is not installed.")
                    lbl1.pack()
                    lbl2 = Tkinter.Label(text="You have to install \"PyQt4\"")
                    lbl2.pack()
                    lbl3 = Tkinter.Label(
                        text="on your system to run HamsiManager.")
                    lbl3.pack()
                    btnClose = Tkinter.Button(text="OK",
                                              command=tMainWindow.quit)
                    btnClose.pack(side=Tkinter.RIGHT)
                    Tkinter.mainloop()
                except:
                    print("Critical Error!")
                    print(
                        "You have to install \"PyQt4\" on your system to run Hamsi Manager."
                    )
        return False
示例#8
0
    def __init__(self, parent = None, printer = None, name = "PrintPreview", \
                 modal = 0, fl = 0):
        """
        Constructor method:

        """
        qt.QDialog.__init__(self, parent, name, modal, fl)

        self.printer    = None

        # main layout 
        layout = qt.QVBoxLayout(self, 0, -1, "PrintPreview global layout")

        toolBar = qt.QWidget(self)

        # Margin
        marginLabel = qt.QLabel("Margins:", toolBar)    
        self.marginSpin = qt.QSpinBox(0, 50, 10, toolBar)
        self.connect(self.marginSpin, qt.SIGNAL("valueChanged(int)"),    \
                     self.__marginChanged)

        # Scale / Zoom
        scaleLabel = qt.QLabel("Zoom:", toolBar)
        scaleCombo = qt.QComboBox(toolBar)
        self.scaleValues = [20, 40, 60, 80, 100, 150, 200]

        for scale in self.scaleValues:
            scaleCombo.insertItem("%3d %%"%scale)
            
        self.scaleCombo = scaleCombo
        self.connect(self.scaleCombo, qt.SIGNAL("activated(int)"),        \
                     self.__scaleChanged)


        # --- command buttons
        buttonSize = 65
        
        hideBut   = qt.QPushButton("Hide", toolBar)
        hideBut.setFixedWidth(buttonSize-10)
        self.connect(hideBut, qt.SIGNAL("clicked()"), self.hide)

        cancelBut = qt.QPushButton("Clear All", toolBar)
        cancelBut.setFixedWidth(buttonSize+10)
        self.connect(cancelBut, qt.SIGNAL("clicked()"), self.__clearAll)

        removeBut = qt.QPushButton("Remove", toolBar)
        removeBut.setFixedWidth(buttonSize)
        self.connect(removeBut, qt.SIGNAL("clicked()"), self.__remove)

        setupBut  = qt.QPushButton("Setup", toolBar)
        setupBut.setFixedWidth(buttonSize-5)
        self.connect(setupBut, qt.SIGNAL("clicked()"), self.__setup)

        printBut  = qt.QPushButton("Print", toolBar)
        printBut.setFixedWidth(buttonSize-5)
        self.connect(printBut, qt.SIGNAL("clicked()"), self.__print)
        
        # a layout for the toolbar
        toolsLayout = qt.QHBoxLayout(toolBar, 0, -1, "Tools Layout")

        # now we put widgets in the toolLayout
        toolsLayout.addWidget(hideBut)
        toolsLayout.addWidget(printBut)
        toolsLayout.addWidget(cancelBut)
        toolsLayout.addWidget(removeBut)
        toolsLayout.addWidget(setupBut)
        toolsLayout.addStretch()
        toolsLayout.addWidget(marginLabel)
        toolsLayout.addWidget(self.marginSpin)    
        toolsLayout.addStretch()
        toolsLayout.addWidget(scaleLabel)
        toolsLayout.addWidget(scaleCombo)
        toolsLayout.addStretch()

        # canvas to display items to print
        self.canvas     = qtcanvas.QCanvas(self)
        self.canvasView = PrintCanvasView(self.canvas, self)

        # status bar
        statusBar = qt.QStatusBar(self)

        self.targetLabel = qt.QLabel( "???", statusBar, "targetLabel")
        statusBar.addWidget(self.targetLabel)

        # finally, building main widget.
        layout.addWidget(toolBar)
        layout.addWidget(self.canvasView)
        layout.addWidget(statusBar)
        
        # use user printer or a default QPrinter
        if printer == None:
            printer = qt.QPrinter()
            
        self.setPrinter(printer)
示例#9
0
    vp.Modified()


# TODO: how to get the test mode from the environment?
testMode = False
if testMode:
    import time
    vr1()
    slicer.app.processEvents()
    time.sleep(5)
    vr2()
    slicer.app.processEvents()
    time.sleep(5)
    exit()
else:
    control = qt.QWidget()
    layout = qt.QVBoxLayout()
    control.setLayout(layout)
    b0 = qt.QPushButton("0: VTK CPU ray cast")
    layout.addWidget(b0)
    b0.connect('clicked()', vr0)
    b1 = qt.QPushButton("1: VTK GPU ray cast")
    layout.addWidget(b1)
    b1.connect('clicked()', vr1)
    b2 = qt.QPushButton("2: VTK GPU texture mapping")
    layout.addWidget(b2)
    b2.connect('clicked()', vr2)
    b3 = qt.QPushButton("3: NCI GPU ray cast")
    layout.addWidget(b3)
    b3.connect('clicked()', vr3)
    b4 = qt.QPushButton("4: NCI GPU ray cast (multi-volume)")
示例#10
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        self.logic = NeoGuidanceLogic()

        #
        # Parameters Area
        #
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "Parameters"
        self.layout.addWidget(parametersCollapsibleButton)
        self.layout.setContentsMargins(8, 8, 8, 8)

        # Layout within the collapsible button
        parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)
        parametersFormLayout.setContentsMargins(8, 8, 8, 8)

        frame = qt.QWidget()
        layout = qt.QHBoxLayout(frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        layout.addWidget(qt.QLabel("Transforms"))
        layout.addStretch()
        parametersFormLayout.addRow(frame)

        #
        # 6DOF transform selector
        #
        self.sixDOFTransformSelector = slicer.qMRMLNodeComboBox()
        self.sixDOFTransformSelector.nodeTypes = ["vtkMRMLLinearTransformNode"]
        self.sixDOFTransformSelector.selectNodeUponCreation = True
        self.sixDOFTransformSelector.addEnabled = False
        self.sixDOFTransformSelector.removeEnabled = False
        self.sixDOFTransformSelector.noneEnabled = True
        self.sixDOFTransformSelector.showHidden = False
        self.sixDOFTransformSelector.showChildNodeTypes = False
        self.sixDOFTransformSelector.setMRMLScene(slicer.mrmlScene)
        self.sixDOFTransformSelector.setToolTip(
            "Pick the transform describing the 6DOF sensor.")
        parametersFormLayout.addRow("6DOF Transform: ",
                                    self.sixDOFTransformSelector)

        #
        # 6DOFModel to 6DOF transform selector
        #
        self.sixDOFModelTo6DOFTransformSelector = slicer.qMRMLNodeComboBox()
        self.sixDOFModelTo6DOFTransformSelector.nodeTypes = [
            "vtkMRMLLinearTransformNode"
        ]
        self.sixDOFModelTo6DOFTransformSelector.selectNodeUponCreation = True
        self.sixDOFModelTo6DOFTransformSelector.addEnabled = False
        self.sixDOFModelTo6DOFTransformSelector.removeEnabled = False
        self.sixDOFModelTo6DOFTransformSelector.noneEnabled = True
        self.sixDOFModelTo6DOFTransformSelector.showHidden = False
        self.sixDOFModelTo6DOFTransformSelector.showChildNodeTypes = False
        self.sixDOFModelTo6DOFTransformSelector.setMRMLScene(slicer.mrmlScene)
        self.sixDOFModelTo6DOFTransformSelector.setToolTip(
            "Pick the transform describing the 6DOF model offset.")
        parametersFormLayout.addRow("6DOF Model Transform: ",
                                    self.sixDOFModelTo6DOFTransformSelector)

        #
        # 5DOF transform selector
        #
        self.fiveDOFTransformSelector = slicer.qMRMLNodeComboBox()
        self.fiveDOFTransformSelector.nodeTypes = [
            "vtkMRMLLinearTransformNode"
        ]
        self.fiveDOFTransformSelector.selectNodeUponCreation = True
        self.fiveDOFTransformSelector.addEnabled = False
        self.fiveDOFTransformSelector.removeEnabled = False
        self.fiveDOFTransformSelector.noneEnabled = True
        self.fiveDOFTransformSelector.showHidden = False
        self.fiveDOFTransformSelector.showChildNodeTypes = False
        self.fiveDOFTransformSelector.setMRMLScene(slicer.mrmlScene)
        self.fiveDOFTransformSelector.setToolTip(
            "Pick the transform describing the 5DOF sensor.")
        parametersFormLayout.addRow("5DOF Transform: ",
                                    self.fiveDOFTransformSelector)

        #
        # 5DOFModel to 5DOFCalculated transform selector
        #
        self.fiveDOFModelTo5DOFCalculatedTransformSelector = slicer.qMRMLNodeComboBox(
        )
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.nodeTypes = [
            "vtkMRMLLinearTransformNode"
        ]
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.selectNodeUponCreation = True
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.addEnabled = False
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.removeEnabled = False
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.noneEnabled = True
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.showHidden = False
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.showChildNodeTypes = False
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.setMRMLScene(
            slicer.mrmlScene)
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.setToolTip(
            "Pick the transform describing the 5DOF model offset.")
        parametersFormLayout.addRow(
            "5DOF Model Transform: ",
            self.fiveDOFModelTo5DOFCalculatedTransformSelector)

        # Separator
        frame = qt.QWidget()
        layout = qt.QHBoxLayout(frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        layout.addWidget(qt.QLabel("Images"))
        layout.addStretch()
        parametersFormLayout.addRow(frame)

        #
        # ICE volume selector
        #
        self.iceVolumeSelector = slicer.qMRMLNodeComboBox()
        self.iceVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.iceVolumeSelector.selectNodeUponCreation = True
        self.iceVolumeSelector.addEnabled = False
        self.iceVolumeSelector.removeEnabled = False
        self.iceVolumeSelector.noneEnabled = True
        self.iceVolumeSelector.showHidden = False
        self.iceVolumeSelector.showChildNodeTypes = False
        self.iceVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.iceVolumeSelector.setToolTip(
            "Pick the volume from the ICE transducer.")
        parametersFormLayout.addRow("ICE Image: ", self.iceVolumeSelector)

        #
        # mask volume selector
        #
        self.maskVolumeSelector = slicer.qMRMLNodeComboBox()
        self.maskVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.maskVolumeSelector.selectNodeUponCreation = True
        self.maskVolumeSelector.addEnabled = False
        self.maskVolumeSelector.removeEnabled = False
        self.maskVolumeSelector.noneEnabled = True
        self.maskVolumeSelector.showHidden = False
        self.maskVolumeSelector.showChildNodeTypes = False
        self.maskVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.maskVolumeSelector.setToolTip(
            "Pick the volume with the mask image for the ICE transducer.")
        parametersFormLayout.addRow("ICE Mask: ", self.maskVolumeSelector)

        #
        # TEE volume selector
        #
        self.teeVolumeSelector = slicer.qMRMLNodeComboBox()
        self.teeVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.teeVolumeSelector.selectNodeUponCreation = True
        self.teeVolumeSelector.addEnabled = False
        self.teeVolumeSelector.removeEnabled = False
        self.teeVolumeSelector.noneEnabled = True
        self.teeVolumeSelector.showHidden = False
        self.teeVolumeSelector.showChildNodeTypes = False
        self.teeVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.teeVolumeSelector.setToolTip(
            "Pick the volume from the TEE transducer.")
        parametersFormLayout.addRow("TEE Image: ", self.teeVolumeSelector)

        #
        # output volume selector
        #
        self.maskedICEVolumeSelector = slicer.qMRMLNodeComboBox()
        self.maskedICEVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.maskedICEVolumeSelector.selectNodeUponCreation = True
        self.maskedICEVolumeSelector.addEnabled = True
        self.maskedICEVolumeSelector.renameEnabled = True
        self.maskedICEVolumeSelector.removeEnabled = False
        self.maskedICEVolumeSelector.noneEnabled = True
        self.maskedICEVolumeSelector.showHidden = False
        self.maskedICEVolumeSelector.showChildNodeTypes = False
        self.maskedICEVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.maskedICEVolumeSelector.setToolTip(
            "Pick the volume for the masked output.")
        parametersFormLayout.addRow("Masked Output: ",
                                    self.maskedICEVolumeSelector)

        # Separator
        frame = qt.QWidget()
        layout = qt.QHBoxLayout(frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        layout.addWidget(qt.QLabel("Models"))
        layout.addStretch()
        parametersFormLayout.addRow(frame)

        #
        # nose model selector
        #
        self.noseModelSelector = slicer.qMRMLNodeComboBox()
        self.noseModelSelector.nodeTypes = ["vtkMRMLModelNode"]
        self.noseModelSelector.selectNodeUponCreation = True
        self.noseModelSelector.addEnabled = False
        self.noseModelSelector.renameEnabled = False
        self.noseModelSelector.removeEnabled = False
        self.noseModelSelector.noneEnabled = True
        self.noseModelSelector.showHidden = False
        self.noseModelSelector.showChildNodeTypes = False
        self.noseModelSelector.setMRMLScene(slicer.mrmlScene)
        self.noseModelSelector.setToolTip("Select the nose model.")
        parametersFormLayout.addRow("Nose Model: ", self.noseModelSelector)

        #
        # jaw model selector
        #
        self.jawModelSelector = slicer.qMRMLNodeComboBox()
        self.jawModelSelector.nodeTypes = ["vtkMRMLModelNode"]
        self.jawModelSelector.selectNodeUponCreation = True
        self.jawModelSelector.addEnabled = False
        self.jawModelSelector.renameEnabled = False
        self.jawModelSelector.removeEnabled = False
        self.jawModelSelector.noneEnabled = True
        self.jawModelSelector.showHidden = False
        self.jawModelSelector.showChildNodeTypes = False
        self.jawModelSelector.setMRMLScene(slicer.mrmlScene)
        self.jawModelSelector.setToolTip("Select the jaw model.")
        parametersFormLayout.addRow("Jaw Model: ", self.jawModelSelector)

        #
        # Actions Area
        #
        actionsCollapsibleButton = ctk.ctkCollapsibleButton()
        actionsCollapsibleButton.text = "Actions"
        self.layout.addWidget(actionsCollapsibleButton)

        # Layout within the collapsible button
        actionsFormLayout = qt.QFormLayout(actionsCollapsibleButton)
        actionsFormLayout.setContentsMargins(8, 8, 8, 8)

        #
        # Zero Button
        #
        self.zeroButton = qt.QPushButton("Zero")
        self.zeroButton.toolTip = "Calibrate the jaws to the home position."
        self.zeroButton.enabled = False

        frame = qt.QWidget()
        layout = qt.QHBoxLayout(frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(qt.QLabel("Zero Jaws:"))
        layout.addStretch()
        layout.addWidget(self.zeroButton)
        actionsFormLayout.addRow(frame)

        #
        # UI Buttons
        #
        self.minUIButton = qt.QPushButton("Minimal UI")
        self.minUIButton.toolTip = "Show minimal UI."

        self.normalUIButton = qt.QPushButton("Normal UI")
        self.normalUIButton.toolTip = "Show normal UI."

        frame = qt.QWidget()
        layout = qt.QHBoxLayout(frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        layout.addWidget(self.minUIButton)
        layout.addWidget(self.normalUIButton)
        actionsFormLayout.addRow(frame)

        #
        # On/Off Button
        #
        self.onOffButton = qt.QPushButton("Turn On")
        self.onOffButton.toolTip = "Toggle guidance."
        self.onOffButton.enabled = False
        self.onOffButton.icon = self._loadPixmap("off")

        frame = qt.QWidget()
        layout = qt.QHBoxLayout(frame)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(qt.QLabel("Guidance:"))
        layout.addStretch()
        layout.addWidget(self.onOffButton)
        actionsFormLayout.addRow(frame)

        # connections
        self.zeroButton.connect('clicked(bool)', self.onZeroButtonClicked)
        self.onOffButton.connect('clicked(bool)',
                                 self.onOffToggleButtonClicked)
        self.minUIButton.connect('clicked(bool)', self.onMinUIButtonClicked)
        self.normalUIButton.connect('clicked(bool)',
                                    self.onNormUIButtonClicked)
        self.sixDOFTransformSelector.connect(
            "currentNodeChanged(vtkMRMLNode*)", self.onSixDOFSelectorChanged)
        self.fiveDOFTransformSelector.connect(
            "currentNodeChanged(vtkMRMLNode*)", self.onFiveDOFSelectorChanged)
        self.maskVolumeSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                        self.onMaskSelectorChanged)
        self.teeVolumeSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                       self.onTEEVolumeSelectorChanged)
        self.iceVolumeSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                       self.onICESelectorChanged)
        self.maskedICEVolumeSelector.connect(
            "currentNodeChanged(vtkMRMLNode*)",
            self.onMaskedICEVolumeSelectorChanged)
        self.jawModelSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                      self.onJawModelSelectorChanged)
        self.noseModelSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                       self.onNoseModelSelectorChanged)
        self.sixDOFModelTo6DOFTransformSelector.connect(
            "currentNodeChanged(vtkMRMLNode*)",
            self.on6DOFModelTo6DOFSelectorChanged)
        self.fiveDOFModelTo5DOFCalculatedTransformSelector.connect(
            "currentNodeChanged(vtkMRMLNode*)",
            self.on5DOFModelTo5DOFCalculatedSelectorChanged)

        # Add vertical spacer
        self.layout.addStretch(1)

        # Refresh button state
        self.onSelect()
示例#11
0
    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)
示例#12
0
  def __init__(self):

    QToolBar.__init__(self)
    VTKObservationMixin.__init__(self)

    self.parameterNode = SmudgeModule.SmudgeModuleLogic().getParameterNode()
    self.addObserver(self.parameterNode, vtk.vtkCommand.ModifiedEvent, self.updateToolbarFromMRML)
    
    self.setWindowTitle(qt.QObject().tr("LeadDBS"))
    self.name = 'LeadDBS'
  

    #
    # Modality
    #
    self.addWidget(qt.QLabel('Modality:'))
    self.modalityComboBox = qt.QComboBox()
    self.modalityComboBox.addItem('t1')
    self.modalityComboBox.view().pressed.connect(self.onModalityPressed)
    self.addWidget(self.modalityComboBox)

    #
    # B <-> F slider
    #
    self.addSeparator()
    self.addWidget(qt.QLabel('Template:'))
    templateSlider = qt.QSlider(1)
    templateSlider.singleStep = 10
    templateSlider.minimum = 0
    templateSlider.maximum = 100
    templateSlider.value = 0
    templateSlider.setFixedWidth(120)
    templateSlider.connect('valueChanged(int)', lambda value: slicer.util.setSliceViewerLayers(foregroundOpacity = value / 100.0))
    self.addWidget(templateSlider)

    #
    # Resolution
    #
    self.addSeparator()
    self.addWidget(qt.QLabel('Warp Resolution: '))
    self.resolutionComboBox = qt.QComboBox()
    avalibaleResolutions = [0.5, 1, 2, 5, 10]
    self.resolutionComboBox.addItems([str(r)+'mm' for r in avalibaleResolutions])
    self.resolutionComboBox.setCurrentIndex(avalibaleResolutions.index(float(self.parameterNode.GetParameter("resolution"))))
    self.resolutionComboBox.connect('currentIndexChanged(int)', self.onResolutionChanged)

    self.addWidget(self.resolutionComboBox)

    #
    # Space Separator
    #

    empty = qt.QWidget()
    empty.setSizePolicy(qt.QSizePolicy.Expanding,qt.QSizePolicy.Preferred)
    self.addWidget(empty)

    #
    # Subject
    #

    self.subjectNameLabel = qt.QLabel('Subject: ')    
    self.addWidget(self.subjectNameLabel)

    #
    # Save
    #
    self.saveButton = qt.QPushButton("Finish and Exit")
    self.saveButton.setFixedWidth(200)
    self.saveButton.setStyleSheet("background-color: green")
    self.addWidget(self.saveButton)
    ImportAtlas.ImportAtlasLogic().run(os.path.join(self.parameterNode.GetParameter("MNIAtlasPath"), 'DISTAL Minimal (Ewert 2017)'))
    self.saveButton.connect("clicked(bool)", self.onSaveButton)

    #
    # Update
    #

    self.updateModalities(self.parameterNode.GetParameter("subjectPath"))
    reducedToolbarLogic().loadSubjectTransforms()
    self.onModalityPressed([],self.modalityComboBox.currentText)
    self.updateToolbarFromMRML()
示例#13
0
    def __init__(self, logic):
        super(VisualizationWidget, self).__init__()
        self.rockCount = 0
        self.rocking = False
        self.rockTimer = None
        self.flickerTimer = None
        self.logic = logic
        self.revealCursor = None
        self.volumes = (
            "Fixed",
            "Moving",
            "Transformed",
        )
        self.layoutOptions = (
            "Axial",
            "Coronal",
            "Sagittal",
            "Axi/Sag/Cor",
        )
        self.layoutOption = 'Axi/Sag/Cor'
        self.volumeDisplayCheckboxes = {}

        # mimic the structure of the LandmarksWidget for visual
        # consistency (it needs sub widget so it can delete and refresh the internals)
        self.widget = qt.QWidget()
        self.layout = qt.QFormLayout(self.widget)
        self.boxHolder = qt.QWidget()
        self.boxHolder.setLayout(qt.QVBoxLayout())
        self.layout.addRow(self.boxHolder)
        self.groupBox = qt.QGroupBox("Visualization")
        self.groupBoxLayout = qt.QFormLayout(self.groupBox)
        self.boxHolder.layout().addWidget(self.groupBox)

        #
        # layout selection
        #
        layoutHolder = qt.QWidget()
        layout = qt.QHBoxLayout()
        layoutHolder.setLayout(layout)
        for layoutOption in self.layoutOptions:
            layoutButton = qt.QPushButton(layoutOption)
            layoutButton.connect('clicked()',
                                 lambda lo=layoutOption: self.selectLayout(lo))
            layout.addWidget(layoutButton)
        self.groupBoxLayout.addRow("Layout", layoutHolder)

        #
        # Volume display selection
        #
        checkboxHolder = qt.QWidget()
        layout = qt.QHBoxLayout()
        checkboxHolder.setLayout(layout)
        for volume in self.volumes:
            checkBox = qt.QCheckBox()
            checkBox.text = volume
            checkBox.checked = True
            checkBox.connect('toggled(bool)', self.updateVisualization)
            layout.addWidget(checkBox)
            self.volumeDisplayCheckboxes[volume] = checkBox
        checkBox = qt.QCheckBox()
        checkBox.text = "RevealCursor"
        checkBox.checked = False
        checkBox.connect('toggled(bool)', self.revealToggled)
        layout.addWidget(checkBox)
        self.groupBoxLayout.addRow("Display", checkboxHolder)

        #
        # fade slider
        #
        fadeHolder = qt.QWidget()
        fadeLayout = qt.QHBoxLayout()
        fadeHolder.setLayout(fadeLayout)
        self.fadeSlider = ctk.ctkSliderWidget()
        self.fadeSlider.minimum = 0
        self.fadeSlider.maximum = 1.0
        self.fadeSlider.value = 0.5
        self.fadeSlider.singleStep = 0.05
        self.fadeSlider.connect('valueChanged(double)', self.onFadeChanged)
        fadeLayout.addWidget(self.fadeSlider)

        #
        # Rock and Flicker
        #
        animaHolder = qt.QWidget()
        animaLayout = qt.QVBoxLayout()
        animaHolder.setLayout(animaLayout)
        fadeLayout.addWidget(animaHolder)
        # Rock
        checkBox = qt.QCheckBox()
        checkBox.text = "Rock"
        checkBox.checked = False
        checkBox.connect('toggled(bool)', self.onRockToggled)
        animaLayout.addWidget(checkBox)
        # Flicker
        checkBox = qt.QCheckBox()
        checkBox.text = "Flicker"
        checkBox.checked = False
        checkBox.connect('toggled(bool)', self.onFlickerToggled)
        animaLayout.addWidget(checkBox)

        self.groupBoxLayout.addRow("Fade", fadeHolder)

        #
        # zoom control
        #
        zoomHolder = qt.QWidget()
        layout = qt.QHBoxLayout()
        zoomHolder.setLayout(layout)
        zooms = {
            "+": 0.7,
            "-": 1.3,
            "Fit": "Fit",
        }
        for zoomLabel, zoomFactor in zooms.items():
            zoomButton = qt.QPushButton(zoomLabel)
            zoomButton.connect('clicked()',
                               lambda zf=zoomFactor: self.onZoom(zf))
            layout.addWidget(zoomButton)
        self.groupBoxLayout.addRow("Zoom", zoomHolder)
示例#14
0
    def onCSVFile(self):
        self.dictShapeModels = dict()
        '''if not os.path.exists(self.lineEdit_covariateType.currentPath):
            self.stateCSVMeansShape = False
            return'''
        if not os.path.exists(self.lineEdit_csv.currentPath):
            self.stateCSVMeansShape = False
            self.tableWidget.clearContents()
            self.tableWidget.setRowCount(0)
            return
        
        condition1 = self.logic.checkExtension(self.lineEdit_csv.currentPath, ".csv")

        if condition1:
            f = open(self.lineEdit_csv.currentPath)
            headers = [ x.strip() for x in f.readline().split(',') ]
            self.tableWidget.setColumnCount(len(headers))
            self.tableWidget.setHorizontalHeaderLabels(headers)
            row = 0
            for line in f.readlines():
                vals = [ x.strip() for x in line.split(',') ]
                self.tableWidget.insertRow(row)
                for col in range(len(vals)):
                    widget = qt.QWidget()
                    layout = qt.QHBoxLayout(widget)
                    label = qt.QLabel()
                    label.setText(vals[col])
                    
                    layout.addWidget(label)
                    layout.setAlignment(0x84)
                    layout.setContentsMargins(0,0,0,0)
                    widget.setLayout(layout)
                    self.tableWidget.setCellWidget(row,col,widget)
                row = row + 1
        else:
            self.lineEdit_csv.setCurrentPath(" ")
            self.stateCSVDataset = False
            self.tableWidget.clearContents()
            self.tableWidget.setRowCount(0)
            return

        if not os.path.exists(self.lineEdit_template.currentPath):
            self.stateCSVMeansShape = False
            return
        if not os.path.exists(self.lineEdit_output.directory):
            self.stateCSVMeansShape = False
            return
        """if not os.path.exists(self.lineEdit_CovariateNames.currentPath):
            self.stateCSVMeansShape = False
            return"""
        
        condition2 = self.logic.checkExtension(self.lineEdit_template.currentPath, ".vtk")
        condition3 = self.lineEdit_output.directory != '.'

        if not condition2:
            self.lineEdit_template.setCurrentPath(" ")
            self.stateCSVDataset = False
            return
        if not condition3:
            self.stateCSVDataset = False
            return
        PathOutput=os.path.dirname(self.lineEdit_csv.currentPath)+'/'

        print(self.lineEdit_template.currentPath)
        print(self.lineEdit_csv.currentPath)
        print(self.lineEdit_output.directory) 
        print(PathOutput)

        self.param = {}
        self.param["shapeData"] = self.lineEdit_csv.currentPath
        self.param["coordData"] = self.lineEdit_template.currentPath
        self.param["outputDir"] = self.lineEdit_output.directory


        self.starting_time = time.time()
        MFSDAmodule = slicer.modules.mfsda_run
        self.MFSDAThread = slicer.cli.run(MFSDAmodule, None, self.param, wait_for_completion=False)


        self.checkThreadTimer=qt.QTimer()
        self.checkThreadTimer.connect('timeout()', self.onComputationState)
        self.checkThreadTimer.start(1000)

        self.pushButton_run.disconnect('clicked(bool)', self.onCSVFile)
        self.pushButton_run.connect('clicked(bool)', self.onKillComputation)

        return
 
        '''        self.param = {}
    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)
示例#16
0
import qt
import __main__

def onModuleSelected(modulename):
  global tabWidget
  widgetRepresentation = getattr(slicer.modules, modulename.lower()).createNewWidgetRepresentation()
  widgetRepresentation.setMRMLScene(slicer.app.mrmlScene())
  #print(widgetRepresentation)
  tabWidget.addTab(widgetRepresentation, modulename)
  widgetRepresentation.enter() #update the panel

#splitter
splitter = qt.QSplitter()

leftWidget = qt.QWidget()
rightWidget = qt.QWidget()

splitter.addWidget(leftWidget)
splitter.addWidget(rightWidget)

#left layout for [add data,save data,search modules] and modules(tab)
leftLayout = qt.QVBoxLayout()
leftWidget.setLayout(leftLayout)

#right layout for 2d/3d viewer
rightLayout = qt.QVBoxLayout()
rightWidget.setLayout(rightLayout)

#top left layout: add data, save data,search modules
topleftLayout = qt.QHBoxLayout()
示例#17
0
    def __init__(self, logic, applyButton, buttonsList):
        super(ILSVisualizationWidget, self).__init__()
        self.logic = logic
        self.applyButton = applyButton
        self.fiducialButtonsList = buttonsList

        self.widget = qt.QWidget()
        self.layout = qt.QFormLayout(self.widget)
        self.boxHolder = qt.QWidget()
        self.boxHolder.setLayout(qt.QVBoxLayout())
        self.layout.addRow(self.boxHolder)

        self.groupBox = qt.QFrame()
        self.groupBox.setLayout(qt.QHBoxLayout())

        self.fiducialsCollapsibleButton = ctk.ctkCollapsibleButton()
        self.fiducialsCollapsibleButton.text = "Show Fiducials"
        self.fiducialsCollapsibleButton.hide()
        self.fiducialsFormLayout = qt.QFormLayout(
            self.fiducialsCollapsibleButton)

        # Table Widget Definition
        self.tableWidget = qt.QTableWidget()
        self.tableWidget.sortingEnabled = False
        self.tableWidget.hide()
        self.tableWidget.setColumnCount(3)
        self.tableWidget.setColumnWidth(0, 190)
        self.tableWidget.setColumnWidth(1, 190)
        self.tableWidget.setColumnWidth(2, 190)
        self.tableWidget.setMaximumWidth(590)
        horizontalBar = self.tableWidget.horizontalScrollBar()
        horizontalBar.setDisabled(True)
        horizontalBar.hide()
        self.tableWidget.setHorizontalHeaderLabels([
            "Left Oblique Fiducials", "Right Oblique Fiducials",
            "Right Horizontal Fiducials"
        ])
        behavior = qt.QAbstractItemView()
        self.tableWidget.setSelectionBehavior(behavior.SelectItems)
        self.tableWidget.setSelectionMode(behavior.SingleSelection)
        self.tableWidget.setContextMenuPolicy(3)
        self.tableWidget.customContextMenuRequested.connect(self.onRightClick)

        self.groupBox.layout().addWidget(self.tableWidget)

        self.fiducialsFormLayout.addWidget(self.groupBox)
        self.boxHolder.layout().addWidget(self.fiducialsCollapsibleButton)

        self.pendingUpdate = False
        self.updatingFiducials = False
        self.observerTags = []

        self.leftRow = 0
        self.rightObliqueRow = 0
        self.rightHorizontalRow = 0

        self.tableItems = []

        self.deletionGroupBox = qt.QFrame()
        self.deletionGroupBox.setLayout(qt.QHBoxLayout())
        self.fiducialsFormLayout.addWidget(self.deletionGroupBox)

        #
        # Delete Selected Fiducials Button
        #
        self.deleteButton = qt.QPushButton("Delete Selected Fiducial")
        self.deleteButton.toolTip = "Select a fiducial from the table and push this button to delete the selected fiducial from the scene."
        self.deleteButton.enabled = True
        selectedIcon = qt.QIcon(":/Icons/MarkupsDelete.png")
        self.deleteButton.setIcon(selectedIcon)
        self.deleteButton.setFixedSize(220, 30)
        self.deletionGroupBox.layout().addWidget(self.deleteButton)
        self.deleteButton.connect('clicked(bool)',
                                  self.onDeleteOneFiducialButton)

        #
        # Delete All Fiducials Button
        #
        self.deleteAllButton = qt.QPushButton("Delete All Fiducials")
        self.deleteAllButton.toolTip = "Delete all fiducials in the scene."
        self.deleteAllButton.enabled = True
        allIcon = qt.QIcon(":/Icons/MarkupsDeleteAllRows.png")
        self.deleteAllButton.setIcon(allIcon)
        self.deleteAllButton.setFixedSize(220, 30)
        self.deletionGroupBox.layout().addWidget(self.deleteAllButton)
        # self.fiducialsFormLayout.addRow(self.deleteAllButton)
        self.deleteAllButton.connect('clicked(bool)', self.dialogBoxFunction)
示例#18
0
    def updateLandmarkArray(self):
        """Rebuild the list of buttons based on current landmarks"""
        # reset the widget
        if self.landmarkGroupBox:
            self.landmarkGroupBox.setParent(None)
        self.landmarkGroupBox = qt.QGroupBox("Landmarks")
        self.landmarkGroupBox.setLayout(qt.QFormLayout())
        # add the action buttons at the top
        actionButtons = qt.QHBoxLayout()
        # add button - http://www.clipartbest.com/clipart-jTxpEM8Bc
        self.addButton = qt.QPushButton("Add")
        self.addButton.setIcon(
            qt.QIcon(
                os.path.join(
                    os.path.dirname(slicer.modules.landmarkregistration.path),
                    'Resources/Icons/', "icon_Add.png")))
        self.addButton.connect('clicked()', self.addLandmark)
        actionButtons.addWidget(self.addButton)
        self.renameButton = qt.QPushButton("Rename")
        self.renameButton.connect('clicked()', self.renameLandmark)
        self.renameButton.enabled = False
        actionButtons.addWidget(self.renameButton)
        self.landmarkGroupBox.layout().addRow(actionButtons)

        # for now, hide
        self.renameButton.hide()

        # make a button for each current landmark
        self.labels = {}
        landmarks = self.logic.landmarksForVolumes(self.volumeNodes)
        keys = sorted(landmarks.keys())
        for landmarkName in keys:
            row = qt.QWidget()
            rowLayout = qt.QHBoxLayout()
            rowLayout.setMargin(0)

            label = qt.QLabel(landmarkName)
            rowLayout.addWidget(label, 8)

            # active button - https://thenounproject.com/term/crosshair/4434/
            activeButton = qt.QPushButton()
            activeButton.setIcon(
                qt.QIcon(
                    os.path.join(
                        os.path.dirname(
                            slicer.modules.landmarkregistration.path),
                        'Resources/Icons/', "icon_Active.png")))
            activeButton.connect('clicked()',
                                 lambda l=landmarkName: self.pickLandmark(l))
            rowLayout.addWidget(activeButton, 1)

            if landmarkName == self.selectedLandmark:
                label.setStyleSheet("QWidget{font-weight: bold;}")
                activeButton.setEnabled(False)

            # remove button - http://findicons.com/icon/158288/trash_recyclebin_empty_closed_w
            removeButton = qt.QPushButton()
            removeButton.setIcon(
                qt.QIcon(
                    os.path.join(
                        os.path.dirname(
                            slicer.modules.landmarkregistration.path),
                        'Resources/Icons/', "icon_Trash.png")))
            removeButton.connect('clicked()',
                                 lambda l=landmarkName: self.removeLandmark(l))
            rowLayout.addWidget(removeButton, 1)

            row.setLayout(rowLayout)

            self.landmarkGroupBox.layout().addRow(row)
            self.labels[landmarkName] = [label, activeButton]
        self.landmarkArrayHolder.layout().addWidget(self.landmarkGroupBox)

        # observe manipulation of the landmarks
        self.addLandmarkObservers()
示例#19
0
  def setup(self):

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

    
    #INTENSIDAD Vs VOLUMEN
    #BOTON
    self.VolumenCollapsibleButton = ctk.ctkCollapsibleButton()
    self.VolumenCollapsibleButton.text = "Intensidad Vs Volumen"
    self.layout.addWidget(self.VolumenCollapsibleButton)
    #LAYOUT
    self.VolumenFormLayout = qt.QFormLayout(self.VolumenCollapsibleButton)


    # BOTON GRAFICAR VOLUMEN
    VolumenButton = qt.QPushButton("Graficar")
    VolumenButton.toolTip = ""
    self.VolumenFormLayout.addWidget(VolumenButton)
    VolumenButton.connect('clicked(bool)', self.grafVolumen)

    self.VolumenButton = VolumenButton

    #INTENSIDAD Vs TIEMPO
    #BOTON
    self.TiempoCollapsibleButton = ctk.ctkCollapsibleButton()
    self.TiempoCollapsibleButton.text = "Intensidad Vs Tiempo"
    self.layout.addWidget(self.TiempoCollapsibleButton)
    # LAYOUT
    self.TiempoFormLayout = qt.QFormLayout(self.TiempoCollapsibleButton)

    self.plotRDFrame = ctk.ctkCollapsibleButton();
    self.plotRDFrame.text = "Grafica";
    self.plotRDFrame.collapsed = 0;
    plotRDFrameLayout = qt.QGridLayout(self.plotRDFrame);
    self.layout.addWidget(self.plotRDFrame);


    #BOTON GRAFICAR TIEMPO
    TiempoButton = qt.QPushButton("Graficar")
    TiempoButton.toolTip = ""
    self.TiempoFormLayout.addWidget(TiempoButton)
    TiempoButton.connect('clicked(bool)', self.grafTiempo)

    self.TiempoButton = TiempoButton
    
    self.chartRDView = ctk.ctkVTKChartView(w);
    plotRDFrameLayout.addWidget(self.chartRDView,3,0,1,3);

    self.chartRD = self.chartRDView.chart();

    self.xArrayRD = vtk.vtkFloatArray();
    self.yArrayRD = vtk.vtkFloatArray();
    self.yArrayRI = vtk.vtkFloatArray();
    self.yArrayA = vtk.vtkFloatArray();

    self.xArrayRD.SetName('');
    self.yArrayRD.SetName('signal intesity RD');
    self.yArrayRI.SetName('signal intesity RI');
    self.yArrayA.SetName('signal intesity A');
        
    self.tableRD = vtk.vtkTable()

    self.tableRD.AddColumn(self.xArrayRD)
    self.tableRD.AddColumn(self.yArrayRD)
    self.tableRD.AddColumn(self.yArrayRI)
    self.tableRD.AddColumn(self.yArrayA)
示例#20
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        self.layout.setContentsMargins(6, 6, 6, 6)

        # Init Button
        self.initButton = qt.QPushButton("Initialize")
        self.initButton.toolTip = "Initialize VR system, controllers, and room."
        self.layout.addWidget(self.initButton)

        # Calibration buttons
        self.calibrateGroupBox = qt.QGroupBox("Calibrations")
        self.calibrateGroupBox.enabled = False
        layout = qt.QHBoxLayout(self.calibrateGroupBox)
        layout.setContentsMargins(0, 0, 0, 0)
        self.floorButton = qt.QPushButton("Floor")
        self.floorButton.toolTip = "Calibrate the floor."
        self.faceButton = qt.QPushButton("Face")
        self.faceButton.toolTip = "Calibrate the face."
        layout.addWidget(self.floorButton)
        layout.addWidget(self.faceButton)
        self.layout.addWidget(self.calibrateGroupBox)

        # Inputs Area
        self.inputsGroupBox = qt.QGroupBox("Inputs")
        self.inputsGroupBox.enabled = False
        layout = qt.QFormLayout(self.inputsGroupBox)
        layout.setContentsMargins(0, 0, 0, 0)
        self.participantIdLineEdit = qt.QLineEdit()
        self.participantIdLineEdit.text = "000"
        self.conditionComboBox = qt.QComboBox()
        self.conditionComboBox.addItem("Motion")
        self.conditionComboBox.addItem("No motion")
        self.conditionComboBox.addItem("Replay")
        self.trialNumberSpinBox = qt.QSpinBox()
        self.trialNumberSpinBox.setValue(1)
        self.trialNumberSpinBox.setSingleStep(1)
        self.trialNumberSpinBox.setMinimum(1)
        layout.addRow("Participant ID:", self.participantIdLineEdit)
        layout.addRow("Condition:", self.conditionComboBox)
        layout.addRow("Trial Number:", self.trialNumberSpinBox)
        self.layout.addWidget(self.inputsGroupBox)

        # Sequences loading
        self.sequenceGroupBox = qt.QGroupBox("Target Sequences")
        layout = qt.QHBoxLayout(self.sequenceGroupBox)
        self.motionSequenceButton = qt.QPushButton("Load Motion")
        self.nomotionSequenceButton = qt.QPushButton("Load No-motion")
        self.replaySequenceButton = qt.QPushButton("Load Replay")
        layout.addWidget(self.motionSequenceButton)
        layout.addWidget(self.nomotionSequenceButton)
        layout.addWidget(self.replaySequenceButton)
        self.layout.addWidget(self.sequenceGroupBox)

        # Control UI
        self.controlGroupBox = qt.QGroupBox("Controls")
        layout = qt.QFormLayout(self.controlGroupBox)
        self.showControllerCheckBox = qt.QCheckBox()
        self.showNeedleCheckBox = qt.QCheckBox()
        self.showSphereCheckBox = qt.QCheckBox()
        layout.addRow("Show controller: ", self.showControllerCheckBox)
        layout.addRow("Show needle: ", self.showNeedleCheckBox)
        layout.addRow("Show sphere: ", self.showSphereCheckBox)
        self.layout.addWidget(self.controlGroupBox)

        # Capture related buttons
        widget = qt.QWidget()
        layout = qt.QHBoxLayout(widget)
        layout.setContentsMargins(0, 0, 0, 0)
        self.startButton = qt.QPushButton("Start")
        self.startButton.toolTip = "Start the capture sequence."
        self.startButton.enabled = False
        self.previousButton = qt.QPushButton("Previous")
        self.previousButton.toolTip = "Capture previous point."
        self.previousButton.enabled = False
        self.nextButton = qt.QPushButton("Next")
        self.nextButton.toolTip = "Capture next point."
        self.nextButton.enabled = False
        self.captureButton = qt.QPushButton("Go!")
        self.captureButton.toolTip = "Capture a data point."
        self.captureButton.enabled = False
        self.saveButton = qt.QPushButton("Save")
        self.saveButton.toolTip = "Save the current data set to file."
        self.saveButton.enabled = False
        self.resetButton = qt.QPushButton("Reset")
        self.resetButton.toolTip = "Reset the capture."
        self.resetButton.enabled = False
        layout.addWidget(self.startButton)
        layout.addWidget(self.previousButton)
        layout.addWidget(self.nextButton)
        layout.addWidget(self.captureButton)
        layout.addWidget(self.saveButton)
        layout.addWidget(self.resetButton)
        self.layout.addWidget(widget)

        # Results box
        self.resultGroupBox = qt.QGroupBox("Results")
        layout = qt.QHBoxLayout(self.resultGroupBox)
        self.resultLabel = qt.QLabel("")
        layout.addWidget(self.resultLabel)
        self.layout.addWidget(self.resultGroupBox)

        self.doConnect()

        # Add vertical spacer
        self.layout.addStretch(1)
示例#21
0
    def __init__(self):

        QToolBar.__init__(self)
        VTKObservationMixin.__init__(self)

        self.parameterNode = WarpDrive.WarpDriveLogic().getParameterNode()
        self.addObserver(self.parameterNode, vtk.vtkCommand.ModifiedEvent,
                         self.updateToolbarFromParameterNode)

        self.setWindowTitle(qt.QObject().tr("LeadDBS"))
        self.name = 'LeadDBS'

        #
        # Modality
        #
        self.addWidget(qt.QLabel('Modality:'))
        self.modalityComboBox = qt.QComboBox()
        self.modalityComboBox.addItem('T1w')
        self.modalityComboBox.view().pressed.connect(self.onModalityPressed)
        self.addWidget(self.modalityComboBox)

        #
        # B <-> F slider
        #
        self.addSeparator()
        self.addWidget(qt.QLabel('Template:'))
        templateSlider = qt.QSlider(1)
        templateSlider.singleStep = 10
        templateSlider.minimum = 0
        templateSlider.maximum = 100
        templateSlider.value = 0
        templateSlider.setFixedWidth(120)
        templateSlider.connect(
            'valueChanged(int)', lambda value: slicer.util.
            setSliceViewerLayers(foregroundOpacity=value / 100.0))
        self.addWidget(templateSlider)

        #
        # Space Separator
        #
        self.addSeparator()
        empty = qt.QWidget()
        empty.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Preferred)
        self.addWidget(empty)

        #
        # Subject
        #

        self.subjectNameLabel = qt.QLabel('Subject: ')
        self.addWidget(self.subjectNameLabel)

        #
        # Harden Changes
        #
        self.addSeparator()
        self.hardenChangesCheckBox = qt.QCheckBox("Harden Changes")
        self.hardenChangesCheckBox.checked = True
        self.addWidget(self.hardenChangesCheckBox)

        #
        # Save
        #
        self.nextButton = qt.QPushButton("Exit")
        self.nextButton.setFixedWidth(75)
        self.nextButton.setStyleSheet("background-color: green")
        self.addWidget(self.nextButton)
        self.nextButton.connect("clicked(bool)", self.onNextButton)

        #
        # Update
        #

        self.updateModalities(self.parameterNode.GetParameter("subjectPath"))
        self.initSubject()
        self.updateToolbarFromParameterNode()
示例#22
0
    def onLayoutChanged(self, layoutID):
        self.ui.undockSliceViewButton.setChecked(
            layoutID == NeuroSegmentWidget.NEURO_SEGMENT_WIDGET_LAYOUT_ID)
        if layoutID != NeuroSegmentWidget.NEURO_SEGMENT_WIDGET_LAYOUT_ID:
            self.previousLayout = layoutID
            if self.sliceViewWidget:
                self.removeSecondaryViewClickObservers()
                self.sliceViewWidget.close()
                self.ui.segmentEditorWidget.installKeyboardShortcuts()
        elif layoutID == NeuroSegmentWidget.NEURO_SEGMENT_WIDGET_LAYOUT_ID:
            self.sliceViewWidget = UndockedViewWidget(qt.Qt.Horizontal)
            self.sliceViewWidget.setAttribute(qt.Qt.WA_DeleteOnClose)
            self.sliceViewWidget.closed.connect(self.onUndockedViewClosed)
            self.ui.segmentEditorWidget.installKeyboardShortcuts(
                self.sliceViewWidget)

            mainViewPanel = qt.QWidget()
            mainViewLayout = qt.QHBoxLayout()
            mainViewLayout.setContentsMargins(0, 0, 0, 0)
            mainViewPanel.setLayout(mainViewLayout)
            # The slice view becomes unhidden if the slice intersection is modified (shift + move in other views).
            # By adding it to a parent widget, we can show/hide that widget instead
            sliceViewContainer = qt.QWidget()
            sliceViewContainerLayout = qt.QHBoxLayout()
            sliceViewContainer.setLayout(sliceViewContainerLayout)
            sliceViewContainerLayout.addWidget(
                slicer.app.layoutManager().sliceWidget(self.mainSliceViewName))
            sliceViewContainerLayout.setContentsMargins(0, 0, 0, 0)
            mainViewLayout.addWidget(sliceViewContainer)
            mainViewLayout.addWidget(slicer.app.layoutManager().threeDWidget(
                self.main3DViewName))
            self.sliceViewWidget.addWidget(mainViewPanel)

            secondaryViewPanel = qt.QWidget()
            secondaryViewLayout = qt.QVBoxLayout()
            secondaryViewLayout.setContentsMargins(0, 0, 0, 0)
            secondaryViewPanel.setLayout(secondaryViewLayout)
            for secondaryViewName in self.secondarySliceViewNames:
                secondaryViewLayout.addWidget(
                    slicer.app.layoutManager().sliceWidget(secondaryViewName))
            self.sliceViewWidget.addWidget(secondaryViewPanel)

            # Find the first screen that is not the main screen
            # Otherwise default to the main screen
            mainScreen = slicer.util.mainWindow().windowHandle().screen()
            widgetScreen = mainScreen
            screens = slicer.app.screens()
            if len(screens) > 1:
                for screen in screens:
                    if mainScreen != screen:
                        widgetScreen = screen
                        break

            self.sliceViewWidget.setStretchFactor(0, 3)
            self.sliceViewWidget.setStretchFactor(1, 1)
            self.sliceViewWidget.showFullScreen(
            )  # Will not move to the other monitor with just setScreen. showFullScreen moves the window
            self.sliceViewWidget.windowHandle().setScreen(widgetScreen)
            self.sliceViewWidget.showMaximized()
            self.sliceViewWidget.show()

            self.addSecondaryViewClickObservers()

            self.updateMainView()
            masterVolumeNode = self.ui.segmentEditorWidget.masterVolumeNode()
            if masterVolumeNode is not None:
                self.onMasterVolumeNodeChanged(masterVolumeNode)
示例#23
0
    def __init__(self, parent=None, name="xrf_spectrum_tab_widget"):
        qt.QWidget.__init__(self, parent, name)

        # Data Attributes
        self.xrf_spectrum_hwobj = None
        self.xrf_spectrum = queue_model_objects.XRFSpectrum()
        self._tree_view_item = None

        self.data_path_widget = DataPathWidget(self)
        self.other_parameters_gbox = qt.QHGroupBox("Other parameters", self)
        self.count_time_label = qt.QLabel("Count time:", self.other_parameters_gbox)
        self.count_time_ledit = qt.QLineEdit(
            self.other_parameters_gbox, "count_time_ledit"
        )
        self.count_time_ledit.setFixedWidth(50)

        spacer = qt.QWidget(self.other_parameters_gbox)
        spacer.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed)

        widget_ui = os.path.join(
            os.path.dirname(__file__), "ui_files/snapshot_widget_layout.ui"
        )
        widget = qtui.QWidgetFactory.create(widget_ui)
        widget.reparent(self, qt.QPoint(0, 0))
        self.position_widget = widget
        self.position_widget.setFixedSize(457, 350)
        # self.position_widget.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Fixed)

        self.mca_spectrum = McaSpectrumBrick(self)
        self.mca_spectrum.setSizePolicy(
            qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding
        )
        self.mca_spectrum.setMinimumHeight(700)

        v_layout = qt.QVBoxLayout(self)
        rone_hlayout = qt.QHBoxLayout(v_layout)
        rone_vlayout = qt.QVBoxLayout(rone_hlayout)
        rone_sv_layout = qt.QVBoxLayout(rone_hlayout)

        rone_vlayout.addWidget(self.data_path_widget)
        rone_vlayout.addWidget(self.other_parameters_gbox)
        rone_vlayout.addStretch()

        rone_sv_layout.addWidget(self.position_widget)
        rone_sv_layout.addStretch()

        v_layout.addWidget(self.mca_spectrum)
        v_layout.addStretch()

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child("prefix_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change,
        )

        qt.QObject.connect(
            self.data_path_widget.data_path_widget_layout.child("run_number_ledit"),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change,
        )

        qt.QObject.connect(
            self.count_time_ledit,
            qt.SIGNAL("textChanged(const QString &)"),
            self._count_time_ledit_change,
        )

        qt.QObject.connect(qt.qApp, qt.PYSIGNAL("tab_changed"), self.tab_changed)
示例#24
0
    def updatePreview(self,
                      container_cfg,
                      window_id,
                      container_ids=[],
                      selected_item=""):
        # remove additional windows
        for (w, m) in self.additionalWindows.itervalues():
            w.close()

        # reset colors
        if callable(self.__putBackColors):
            self.__putBackColors()
            self.__putBackColors = None

        #print 'updating', container_cfg["name"], container_ids

        if self.currentWindow is not None and self.currentWindow != window_id:
            # remove all bricks and destroy all other items
            previewItems = self.previewItems[self.currentWindow]

            for container_id, itemsList in previewItems.iteritems():
                for widget in itemsList:
                    if isinstance(widget, BlissWidget):
                        i = itemsList.index(widget)

                        widget.hide()
                        widget.reparent(None, 0, qt.QPoint(0, 0))

            self.previewItems = {}

            self.centralWidget.close(True)
            self.centralWidget = qt.QWidget(self.viewport())
            self.addChild(self.centralWidget)
            qt.QVBoxLayout(self.centralWidget)
            self.centralWidget.show()

        self.currentWindow = window_id
        self.containerNum = -1

        try:
            previewItems = self.previewItems[window_id]
        except KeyError:
            # new window
            previewItems = {}
            self.previewItems[window_id] = previewItems

        #print previewItems

        try:
            parent = previewItems[container_ids[0]][0]
        except:
            #print 'except ! parent of', container_cfg["name"], 'will be central widget'
            parent = self.centralWidget
        else:
            #print 'parent of', container_cfg["name"], 'will be', parent
            pass

        # reparent bricks to prevent them from being deleted,
        # and remove them from the previewItems list
        for container_id in container_ids:
            for widget in previewItems.get(container_id, ()):
                if isinstance(widget, BlissWidget):
                    i = previewItems[container_id].index(widget)
                    widget.hide()
                    widget.reparent(None, 0, qt.QPoint(0, 0))

                    previewItems[container_id][i] = None

        try:
            for w in filter(None, previewItems[container_ids[0]][1:]):
                w.close(True)
        except Exception:
            pass

        if isinstance(container_cfg, WindowCfg):
            # update entire window
            previewItems = {}

            self.setName(container_cfg["name"])

            # update menubar ?
            if container_cfg.properties["menubar"]:
                if not window_id in self.additionalWindows:
                    menubar = MenuBar(self,
                                      container_cfg.properties["menudata"],
                                      container_cfg.properties["expertPwd"],
                                      executionMode=self.executionMode)
                    #self._menuBar = menubar
                    BlissWidget._menuBar = menubar
                    self.additionalWindows[window_id] = (
                        container_cfg.menuEditor(), menubar)

                # this is to show menu configuration - NOT DONE YET
                #if not self.executionMode:
                #    self.additionalWindows[window_id][0].show()
                self.additionalWindows[window_id][1].show()
            else:
                try:
                    self.additionalWindows[window_id][1].hide()
                except:
                    pass
        else:
            try:
                del previewItems[container_ids[0]][1:]
            except KeyError:
                # preview items does not exist, no need to delete it
                pass

        self.makeItem(container_cfg, parent, container_ids)

        if len(selected_item):
            for item_list in previewItems.itervalues():
                for item in item_list:
                    if item.name() == selected_item:
                        self.selectWidget(item)
                        return

        if isinstance(container_cfg, WindowCfg):
            if container_cfg.properties["statusbar"]:
                StatusBar(self)
示例#25
0
    def __init__(self, topText = None, bottomText = None, \
                 parent = None, name = "TextEditor", modal = 1, fl = 0): 
        """
        Constructor method
        topText .. : text appearing in the top of the item (title ?)
        bottomText : text appearing in the bottom of the item (legend ?)
        parent ... : 
        name ..... : name of the dialog widget
        modal .... : is the dialog modal ?
        fl ....... : qt flag
        """
        qt.QDialog.__init__(self, parent, name, modal, fl)
        self.setCaption(name)

        # placing
        layout = qt.QVBoxLayout(self)
        gridg  = qt.QHGroupBox(self)
        
        gridw  = qt.QWidget(gridg)
        grid   = qt.QGridLayout(gridw, 2, 4)

        grid.setColStretch(1, 4)

        # Top Text
        topLabel     = qt.QLabel("Top Text", gridw)   # self. ?
        self.topText = qt.QLineEdit(gridw)
        
        if topText is not None:
            self.topText.setText(topText[0])
            self.topFont  = topText[1]
            self.topColor = topText[2]
        else:
            self.topFont  = self.topText.font()
            self.topColor = self.topText.paletteForegroundColor()

        topFontButton = qt.QPushButton("Font" , gridw)
        self.topColorButton = QubColorToolButton (gridw)
        self.topColorButton.setAutoRaise(False)
        self.topColorButton.setIconColor(self.topColor)
        
        self.connect(topFontButton , qt.SIGNAL("clicked()"), self.__topFont)
        self.connect(self.topColorButton, qt.PYSIGNAL("colorSelected"),
                     self.__setTopColor)
        
        grid.addWidget(topLabel, 0, 0)
        grid.addWidget(self.topText, 0, 1)
        grid.addWidget(topFontButton, 0, 2)
        grid.addWidget(self.topColorButton, 0, 3)
        

        # Bottom Text
        botLabel     = qt.QLabel("Bottom Text", gridw)
        self.botText = qt.QLineEdit(gridw)

        if bottomText is not None:
            self.botText.setText(bottomText[0])
            self.botFont  = bottomText[1]
            self.botColor = bottomText[2]
        else:
            self.botFont  = self.botText.font()
            self.botColor = self.botText.paletteForegroundColor()

        botFontButton = qt.QPushButton("Font", gridw)
        self.botColorButton = QubColorToolButton (gridw)
        self.botColorButton.setAutoRaise(False)
        self.botColorButton.setIconColor(self.botColor)
            
        self.connect(botFontButton,  qt.SIGNAL("clicked()"), self.__botFont)
        self.connect(self.botColorButton, qt.PYSIGNAL("colorSelected"),
                     self.__setBotColor)

        grid.addWidget(botLabel, 1, 0)
        grid.addWidget(self.botText, 1, 1)
        grid.addWidget(botFontButton, 1, 2)
        grid.addWidget(self.botColorButton, 1, 3)

        # dialog buttons
        butw = qt.QHButtonGroup(self)
        cancelBut = qt.QPushButton("Cancel", butw)
        okBut     = qt.QPushButton("OK", butw)
        okBut.setDefault(1)
        self.connect(cancelBut, qt.SIGNAL("clicked()"), self.reject)
        self.connect(okBut,     qt.SIGNAL("clicked()"), self.accept)

        layout.addWidget(gridg)
        layout.addWidget(butw)
  def onInputShapesDirectoryChanged(self):
    
    inputShapesDirectory = self.shapeInputDirectory.directory.encode('utf-8')
    # Set this directory as the default output directory as well
    self.outputDirectory.directory = str(inputShapesDirectory)
    
    row = 0
    
    allShapeSigmaWs = []
    
    for curFile in sorted(os.listdir(inputShapesDirectory)):
        
        if not (curFile.endswith(".vtk")):
          continue 
          
        self.tableWidget_inputShapeParameters.setRowCount(row + 1)

        # Read the vtk file to set a default kernel width
        shapeFile = '%s/%s' %(inputShapesDirectory, curFile)
        polyReader = vtk.vtkPolyDataReader()
        polyReader.SetFileName(shapeFile)
        polyReader.Update()
        shape = polyReader.GetOutput()
        shapeBounds = shape.GetBounds()
        xRange = shapeBounds[1] - shapeBounds[0]
        yRange = shapeBounds[3] - shapeBounds[2]
        zRange = shapeBounds[5] - shapeBounds[4]
        smallestRange = min(xRange, yRange, zRange)
        initSigmaW = int(smallestRange*0.50)
        allShapeSigmaWs.append(initSigmaW)
        
        # Try to extract the time point as a suffix
        curTimePoint = 0.0
        numsInFilename = re.findall(r'[-+]?\d*\.\d+|\d+', curFile)
        if (len(numsInFilename) > 0):
          curTimePoint = numsInFilename[-1]   # We assume the final number in the filename is the time point
        
        # Column 0:
        #rootname = os.path.basename(curFile).split(".")[0]
        rootname = os.path.splitext(os.path.basename(curFile))[0]
        labelVTKFile = qt.QLabel(rootname)
        labelVTKFile.setAlignment(0x84)
        self.tableWidget_inputShapeParameters.setCellWidget(row, 0, labelVTKFile)

        # Column 1-2-3-4: (Time Point, Sigma W, Tris, Weight)
        # We might want to consider using different UI elements for Time Point and Kernel Width that do not have explicit ranges
        for column in range(1,5):
          widget = qt.QWidget()
          layout = qt.QHBoxLayout(widget)
          
          # If this is the 'Shape Index' column we limit this to an integer
          if (column == 3):
            spinBox = qt.QSpinBox()
            spinBox.setRange(0,1000)
            spinBox.value = 0
          # The rest of the columns are doubles 
          else:
            spinBox = qt.QDoubleSpinBox()
            
            if column == 1: # Time Point
              spinBox.value = float(curTimePoint)
              spinBox.connect('valueChanged(double)', self.onSetTimePointRange)
              spinBox.setRange(-1e10, 1e10)
            if column == 2: # Kernel Width
              spinBox.setRange(0.001, 1e10)
              spinBox.value = initSigmaW
            if column == 4: # Weight
              spinBox.value = 1
              spinBox.setRange(0,1)
              spinBox.setSingleStep(0.1);

          layout.addWidget(spinBox)
          layout.setAlignment(0x84)
          layout.setContentsMargins(0, 0, 0, 0)
          widget.setLayout(layout)
          self.tableWidget_inputShapeParameters.setCellWidget(row, column, widget)

        row = row + 1

    # We can set a default for deformation kernel width as smallest shape kernel
    self.defKernelWidth.value = min(allShapeSigmaWs)
    
    # Update the time range (if time point suffixes provided initialization)
    self.onSetTimePointRange()
 def build_vertical_space(height=18):
     s = qt.QWidget()
     s.setFixedSize(10, height)
     return s
示例#28
0
  def create(self,widgetType='window',showHeader=False,showPreview=False):
    """
    main window is a frame with widgets from the app
    widget repacked into it along with slicer-specific
    extra widgets
    """

    # find internals of widget for reference and repacking
    self.toolBar = slicer.util.findChildren(self.dicomBrowser, 'ToolBar')[0]
    self.databaseNameLabel = slicer.util.findChildren(self.dicomBrowser, 'DatabaseNameLabel')[0]
    self.databaseDirectoryButton = slicer.util.findChildren(self.dicomBrowser, 'DirectoryButton')[0]
    self.tableDensityLabel = qt.QLabel('Density: ')
    self.tableDensityLabel.objectName = 'tablesDensityLabel'
    self.tableDensityComboBox = slicer.util.findChildren(self.dicomBrowser, 'tableDensityComboBox')[0]
    self.tableDensityComboBox.connect('currentIndexChanged(QString)', self.onTableDensityComboBox)
    index = self.tableDensityComboBox.findText(self.tableDensity)
    if  (index != -1) :
      self.tableDensityComboBox.setCurrentIndex(index)

    #
    # create and configure the Slicer browser widget - this involves
    # reaching inside and manipulating the widget hierarchy
    # - TODO: this configurability should be exposed more natively
    #   in the CTK code to avoid the findChildren calls
    #
    self.tables = slicer.util.findChildren(self.dicomBrowser, 'dicomTableManager')[0]
    patientTable = slicer.util.findChildren(self.tables, 'patientsTable')[0]
    patientTableView = slicer.util.findChildren(patientTable, 'tblDicomDatabaseView')[0]
    patientSearchBox = slicer.util.findChildren(patientTable, 'leSearchBox')[0]
    studyTable = slicer.util.findChildren(self.tables, 'studiesTable')[0]
    studyTableView = slicer.util.findChildren(studyTable, 'tblDicomDatabaseView')[0]
    studySearchBox = slicer.util.findChildren(studyTable, 'leSearchBox')[0]
    seriesTable = slicer.util.findChildren(self.tables, 'seriesTable')[0]
    seriesTableView = slicer.util.findChildren(seriesTable, 'tblDicomDatabaseView')[0]
    seriesSearchBox = slicer.util.findChildren(seriesTable, 'leSearchBox')[0]
    self.tableSplitter = qt.QSplitter()
    self.tableSplitter.addWidget(patientTableView)
    self.tableSplitter.addWidget(studyTableView)
    self.tableSplitter.addWidget(seriesTableView)

    # TODO: Move to this part to CTK
    patientTableView.resizeColumnsToContents()
    studyTableView.resizeColumnsToContents()
    seriesTableView.resizeColumnsToContents()

    self.userFrame = qt.QWidget()
    self.preview = qt.QWidget()

    self.widgetType = widgetType
    if widgetType == 'dialog':
      self.window = qt.QDialog(self.dicomBrowser)
    elif widgetType == 'window':
      self.window = qt.QWidget()
    elif widgetType == 'popup':
      self.window = ctk.ctkPopupWidget(self.dicomBrowser)
      self.window.orientation = 1
      self.window.horizontalDirection = 0
      self.window.alignment = 0x82
    elif widgetType == 'dock':
      self.dock = qt.QDockWidget(slicer.util.mainWindow())
      self.dock.setFeatures( qt.QDockWidget.DockWidgetFloatable |
                                qt.QDockWidget.DockWidgetMovable |
                                qt.QDockWidget.DockWidgetClosable )
      slicer.util.mainWindow().addDockWidget(0x15, self.dock)
      self.window = qt.QFrame()
      self.dock.setWidget(self.window)
    else:
      raise "Unknown widget type - should be dialog, window, dock or popup"

    self.window.objectName = 'SlicerDICOMBrowser'

    self.setModality(not self.browserPersistent)

    self.window.setWindowTitle('DICOM Browser')

    self.layout = qt.QVBoxLayout(self.window)

    # tool row at top, with commands and database
    self.toolFrame = qt.QWidget()
    self.toolFrame.setMaximumHeight(40)
    self.toolFrame.setContentsMargins(-5,-5,-5,-5)
    self.toolLayout = qt.QHBoxLayout(self.toolFrame)
    self.layout.addWidget(self.toolFrame)
    self.toolLayout.addWidget(self.toolBar)
    self.settingsButton = ctk.ctkExpandButton()
    self.toolLayout.addWidget(self.settingsButton)
    self.toolLayout.addWidget(self.databaseNameLabel)
    self.databaseNameLabel.visible = False
    self.toolLayout.addWidget(self.databaseDirectoryButton)
    self.databaseDirectoryButton.visible = False
    self.toolLayout.addWidget(self.tableDensityLabel)
    self.tableDensityLabel.visible = False
    self.toolLayout.addWidget(self.tableDensityComboBox)
    self.tableDensityComboBox.visible = False
    self.settingsButton.connect('toggled(bool)', self.onSettingsButton)

    # enable export button and make new connection
    self.actionExport = self.dicomBrowser.findChildren('QAction', 'ActionExport')[0]
    self.actionExport.enabled = 1
    self.actionExport.connect('triggered()', self.onExportAction)

    # search row
    self.searchFrame = qt.QWidget()
    self.searchFrame.setMaximumHeight(40)
    self.searchLayout = qt.QHBoxLayout(self.searchFrame)
    self.layout.addWidget(self.searchFrame)
    patinetsLabel = qt.QLabel('Patients: ')
    self.searchLayout.addWidget(patinetsLabel)
    self.searchLayout.addWidget(patientSearchBox)
    studiesLabel = qt.QLabel('Studies: ')
    self.searchLayout.addWidget(studiesLabel)
    self.searchLayout.addWidget(studySearchBox)
    seriesLabel = qt.QLabel('Series: ')
    self.searchLayout.addWidget(seriesLabel)
    self.searchLayout.addWidget(seriesSearchBox)

    # tables goes next, spread across 1 row, 2 columns
    if self.horizontalTables:
      self.tableSplitter.setOrientation(1)
    else:
      self.tableSplitter.setOrientation(0)
    self.layout.addWidget(self.tableSplitter)

    #
    # preview related column
    #
    self.previewLayout = qt.QVBoxLayout()
    if showPreview:
      self.previewLayout.addWidget(self.preview)
    else:
      self.preview.hide()

    #
    # action related column (interacting with slicer)
    #
    self.loadableTableFrame = qt.QWidget()
    self.loadableTableFrame.setMaximumHeight(200)
    self.loadableTableLayout = qt.QFormLayout(self.loadableTableFrame)
    self.layout.addWidget(self.loadableTableFrame)

    self.loadableTableLayout.addWidget(self.userFrame)
    self.userFrame.hide()

    tableWidth = 350 if showHeader else 600
    self.loadableTable = DICOMLoadableTable(self.userFrame,width=tableWidth)

    #
    # button row for action column
    #
    self.actionButtonsFrame = qt.QWidget()
    self.actionButtonsFrame.setMaximumHeight(40)
    self.actionButtonsFrame.objectName = 'ActionButtonsFrame'
    self.layout.addWidget(self.actionButtonsFrame)

    self.actionButtonLayout = qt.QHBoxLayout()
    self.actionButtonsFrame.setLayout(self.actionButtonLayout)

    self.loadButton = qt.QPushButton('Load')
    self.loadButton.enabled = True
    self.loadButton.toolTip = 'Load Selection to Slicer'
    self.actionButtonLayout.addWidget(self.loadButton)
    self.loadButton.connect('clicked()', self.loadCheckedLoadables)

    self.headerPopup = DICOMLib.DICOMHeaderPopup()

    self.viewMetadataButton = qt.QPushButton('Metadata')
    self.viewMetadataButton.objectName = 'ActionViewMetadata'
    self.viewMetadataButton.toolTip = 'Display Metadata of the Selected Series'
    self.viewMetadataButton.enabled = False
    self.actionButtonLayout.addWidget(self.viewMetadataButton)
    self.viewMetadataButton.connect('clicked()', self.onViewHeaderButton)
    self.viewMetadataButton.connect('clicked()', self.headerPopup.open)
    self.actionButtonLayout.addStretch(1)

    self.examineButton = qt.QPushButton('Examine')
    self.actionButtonLayout.addWidget(self.examineButton)
    self.examineButton.enabled = False
    self.examineButton.connect('clicked()', self.examineForLoading)

    self.uncheckAllButton = qt.QPushButton('Uncheck All')
    self.actionButtonLayout.addWidget(self.uncheckAllButton)
    self.uncheckAllButton.connect('clicked()', self.uncheckAllLoadables)
    self.actionButtonLayout.addStretch(1)

    self.advancedViewButton = qt.QCheckBox('Advanced')
    self.advancedViewButton.objectName = 'AdvancedViewCheckBox'
    self.actionButtonLayout.addWidget(self.advancedViewButton)
    self.advancedViewButton.enabled = True
    self.advancedViewButton.checked = self.advancedView
    self.advancedViewButton.connect('clicked()', self.onAdvanedViewButton)

    self.horizontalViewCheckBox = qt.QCheckBox('Horizontal')
    self.horizontalViewCheckBox.objectName = 'HorizontalViewCheckBox'
    self.horizontalViewCheckBox.checked = self.horizontalTables
    self.horizontalViewCheckBox.connect('clicked()', self.onHorizontalViewCheckBox)
    self.actionButtonLayout.addWidget(self.horizontalViewCheckBox)
    self.toolLayout.addStretch(1)

    self.browserPersistentButton = qt.QCheckBox('Browser Persistent')
    self.browserPersistentButton.objectName = 'BrowserPersistentCheckBox'
    self.browserPersistentButton.toolTip = 'When enabled, DICOM Browser remains open after loading data or switching to another module'
    self.browserPersistentButton.checked = self.browserPersistent
    self.actionButtonLayout.addWidget(self.browserPersistentButton)
    self.browserPersistentButton.connect('stateChanged(int)', self.setBrowserPersistence)

    if self.advancedView:
      self.loadableTableFrame.visible = True
    else:
      self.loadableTableFrame.visible = False
      self.examineButton.visible = False
      self.uncheckAllButton.visible = False
    #
    # header related column (more details about the selected file)
    #
    if showHeader:
      self.headerLayout = qt.QVBoxLayout()
      self.layout.addLayout(self.headerLayout,selectionRow,2)
      self.header = DICOMHeaderWidget(self.window)
      self.headerLayout.addWidget(self.header.widget)

    #
    # Series selection
    #
    self.tables.connect('seriesSelectionChanged(QStringList)', self.onSeriesSelected)

    #
    # Plugin selection widget
    #
    self.pluginSelector = DICOMPluginSelector(self.window)
    self.loadableTableLayout.addRow(self.pluginSelector.widget,self.loadableTable.widget)
    self.checkBoxByPlugins = []

    for pluginClass in slicer.modules.dicomPlugins:
      self.checkBox = self.pluginSelector.checkBoxByPlugin[pluginClass]
      self.checkBox.connect('stateChanged(int)', self.onPluginStateChanged)
      self.checkBoxByPlugins.append(self.checkBox)
示例#29
0
    def __init__(self, *args):
        Qt.QMainWindow.__init__(self, *args)

        self.plot = BodePlot(self)
        self.plot.setMargin(5)

        self.zoomers = []
        zoomer = Qwt.QwtPlotZoomer(
            Qwt.QwtPlot.xBottom,
            Qwt.QwtPlot.yLeft,
            Qwt.QwtPicker.DragSelection,
            Qwt.QwtPicker.AlwaysOff,
            self.plot.canvas())
        zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green))
        self.zoomers.append(zoomer)

        zoomer = Qwt.QwtPlotZoomer(
            Qwt.QwtPlot.xTop,
            Qwt.QwtPlot.yRight,
            Qwt.QwtPicker.PointSelection | Qwt.QwtPicker.DragSelection,
            Qwt.QwtPicker.AlwaysOff,
            self.plot.canvas())
        zoomer.setRubberBand(Qwt.QwtPicker.NoRubberBand)
        self.zoomers.append(zoomer)

        self.picker = Qwt.QwtPlotPicker(
            Qwt.QwtPlot.xBottom,
            Qwt.QwtPlot.yLeft,
            Qwt.QwtPicker.PointSelection | Qwt.QwtPicker.DragSelection,
            Qwt.QwtPlotPicker.CrossRubberBand,
            Qwt.QwtPicker.AlwaysOn,
            self.plot.canvas())
        self.picker.setRubberBandPen(Qt.QPen(Qt.Qt.green))
        self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))
 
        self.setCentralWidget(self.plot)

        toolBar = Qt.QToolBar(self)
        
        btnZoom = Qt.QToolButton(toolBar)
        btnZoom.setTextLabel("Zoom")
        btnZoom.setPixmap(Qt.QPixmap(zoom_xpm))
        btnZoom.setToggleButton(True)
        btnZoom.setUsesTextLabel(True)

        btnPrint = Qt.QToolButton(toolBar)
        btnPrint.setTextLabel("Print")
        btnPrint.setPixmap(Qt.QPixmap(print_xpm))
        btnPrint.setUsesTextLabel(True)

        toolBar.addSeparator()

        dampBox = Qt.QWidget(toolBar)
        dampLayout = Qt.QHBoxLayout(dampBox)
        dampLayout.setSpacing(0)
        dampLayout.addWidget(Qt.QWidget(dampBox), 10) # spacer
        dampLayout.addWidget(Qt.QLabel("Damping Factor", dampBox), 0)
        dampLayout.addSpacing(10)

        self.cntDamp = Qwt.QwtCounter(dampBox)
        self.cntDamp.setRange(0.01, 5.0, 0.01)
        self.cntDamp.setValue(0.01)
        dampLayout.addWidget(self.cntDamp, 10)

        toolBar.setStretchableWidget(dampBox)

        self.statusBar()
        
        self.zoom(False)
        self.showInfo()
        
        self.connect(
            self.cntDamp,
            Qt.SIGNAL('valueChanged(double)'),
            self.plot.setDamp)
        self.connect(
            btnPrint,
            Qt.SIGNAL('clicked()'),
            self.print_)
        self.connect(
            btnZoom,
            Qt.SIGNAL('toggled(bool)'),
            self.zoom)
        self.connect(
            self.picker,
            Qt.SIGNAL('moved(const QPoint &)'),
            self.moved)
        self.connect(
            self.picker,
            Qt.SIGNAL('selected(const QwtPolygon &)'),
            self.selected)
示例#30
0
    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
        }