示例#1
0
    def getClassifierFile(self):
        filePath = None
        if self.ui.saveClassifierButton.checked:
            filePath = qt.QFileDialog().getSaveFileName(
                None, 'Create New File', 'classifier', '*.joblib')

        elif self.ui.loadClassifierButton.checked:
            filePath = qt.QFileDialog().getOpenFileName(
                None, 'Load File', 'classifier', '*.joblib')

        if not filePath:
            return False, None
        return True, filePath
示例#2
0
    def open_dialog(self, button):

        if 'DICOM' in button.accessibleDescription:
            path = str(qt.QFileDialog().getExistingDirectory())
        if 'Volume' in button.accessibleDescription:
            path = str(qt.QFileDialog().getOpenFileName())
        path = path.replace('\\', '/')
        print(path)

        if path:
            # modify text of button to show path
            self.modify_button(button, path)
            # store file location
            self.logic.update_locations({button.accessibleDescription: path})
示例#3
0
 def meshFolderSelected(self):
     self.Meshfolder = qt.QFileDialog().getExistingDirectory()
     self.LMText.setText(self.Meshfolder)
     try:
         self.loadButton.enabled = bool(self.Meshfolder)
     except AttributeError:
         self.loadButton.enable = False
示例#4
0
 def OndFClassSelector(self):
   fileDialog = qt.QFileDialog()
   fileDialog.setFileMode(qt.QFileDialog.ExistingFile)
   fileDialog.setNameFilter("displacement field (*.nrrd)")
   if fileDialog.exec_():
     text = fileDialog.selectedFiles()
     self.dFPathClass.setText(text[0])
示例#5
0
 def OnInputClass(self):
   fileDialog = qt.QFileDialog()
   fileDialog.setFileMode(qt.QFileDialog.ExistingFile)
   fileDialog.setNameFilter("input file (*.vtk *.vtp)")
   if fileDialog.exec_():
     text = fileDialog.selectedFiles()
     self.inputClass.setText(text[0])
示例#6
0
    def updateTranform(self, directory, antsApplyTransformsPath=None):
        #transformNode = slicer.util.loadTransform(os.path.join(directory,'glanatComposite.h5'))
        #self.saveAffineComponent(transformNode)
        #slicer.mrmlScene.RemoveNode(transformNode)
        # flatten
        if not antsApplyTransformsPath:
            w = qt.QWidget()
            fd = qt.QFileDialog(w, 'AntsApplyTransformsPath')
            if fd.exec():
                antsApplyTransformsPath = fd.selectedFiles()[0]
            else:
                return False

        for transform, reference in zip(
            ['glanatComposite', 'glanatInverseComposite'],
            ['glanat', 'anat_t1']):
            transformFullPath = os.path.join(
                directory, transform + '.h5')  # in case inverse doesnt exist
            if os.path.isfile(transformFullPath):
                command = antsApplyTransformsPath + " -r " + os.path.join(
                    directory, reference + '.nii'
                ) + " -t " + transformFullPath + " -o [" + os.path.join(
                    directory, transform + '.nii.gz') + ",1] -v 1"
                commandOut = call(command,
                                  env=slicer.util.startupEnvironment(),
                                  shell=True)  # run antsApplyTransforms
                os.remove(transformFullPath)
        return True
示例#7
0
 def onTrackingFileSelectButtonPressed(self):
     if not self.trackingFileDialog:
         self.trackingFileDialog = qt.QFileDialog(self.parent)
         self.initializeFileDialog(self.trackingFileDialog)
     self.trackingFileDialog.connect("fileSelected(QString)",
                                     self.onTrackingFileSelected)
     self.trackingFileDialog.show()
示例#8
0
 def selectMeshFolder(self):
     self.mesh_folder = qt.QFileDialog().getExistingDirectory()
     self.meshInputText.setText(self.mesh_folder)
     try:
         self.loadButton.enabled = bool(self.mesh_folder)
     except AttributeError:
         self.loadButton.enable = False
示例#9
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        #[TODO]
        # Si potrebbe avere un file di configurazione che contiene eventualmente un path alla colorlut
        # Se non e'vuoto allora lo prendo se no prendo questo di default
        self.lutPath = os.path.join(
            slicer.app.slicerHome,
            'share/FreeSurfer/FreeSurferColorLUT20120827.txt')
        print self.lutPath
        #[END TODO]

        self.zonedetectionCB = ctk.ctkCollapsibleButton()
        self.zonedetectionCB.text = "Brain Zone Detection"

        self.layout.addWidget(self.zonedetectionCB)

        self.zoneDetectionLayout = qt.QFormLayout(self.zonedetectionCB)

        ### Select Atlas
        self.atlasInputSelector = slicer.qMRMLNodeComboBox()
        self.atlasInputSelector.nodeTypes = (("vtkMRMLScalarVolumeNode"), "")
        self.atlasInputSelector.addAttribute("vtkMRMLScalarVolumeNode",
                                             "LabelMap", 0)
        self.atlasInputSelector.selectNodeUponCreation = True
        self.atlasInputSelector.addEnabled = False
        self.atlasInputSelector.removeEnabled = False
        self.atlasInputSelector.noneEnabled = True
        self.atlasInputSelector.showHidden = False
        self.atlasInputSelector.showChildNodeTypes = False
        self.atlasInputSelector.setMRMLScene(slicer.mrmlScene)
        self.atlasInputSelector.setToolTip("Pick the volumetric Atlas.")
        self.zoneDetectionLayout.addRow("Volumetric parcels: ",
                                        self.atlasInputSelector)

        self.dialog = qt.QFileDialog()
        self.dialog.setFileMode(qt.QFileDialog.AnyFile)
        self.dialog.setToolTip("Pick the input to the algorithm.")

        self.fidsSelectorZone = slicer.qMRMLNodeComboBox()
        self.fidsSelectorZone.nodeTypes = (("vtkMRMLMarkupsFiducialNode"), "")
        self.fidsSelectorZone.selectNodeUponCreation = False
        self.fidsSelectorZone.addEnabled = False
        self.fidsSelectorZone.removeEnabled = False
        self.fidsSelectorZone.noneEnabled = True
        self.fidsSelectorZone.setMRMLScene(slicer.mrmlScene)
        self.fidsSelectorZone.setToolTip("Select a fiducial list")
        self.zoneDetectionLayout.addRow("Fiducial : ", self.fidsSelectorZone)

        # Run Zone Detection button
        self.zoneButton = qt.QPushButton("Apply")
        self.zoneButton.toolTip = "Run the algorithm."
        self.zoneButton.enabled = True

        #### Aggiungo il bottone al layout
        self.zoneDetectionLayout.addRow(self.zoneButton)

        # connections
        self.zoneButton.connect('clicked(bool)', self.onZoneButton)
示例#10
0
 def addSemiByBrowsing(self):
     self.semiFileTable.clear()
     self.semiFilePaths = []
     filter = "landmark files (*.fcsv *.json)"
     self.semiFilePaths = qt.QFileDialog().getOpenFileNames(
         None, "Window name", "", filter)
     self.semiFileTable.plainText = '\n'.join(self.semiFilePaths)
     self.clearButton.enabled = True
示例#11
0
 def addByBrowsing(self):
     filePaths = qt.QFileDialog().getOpenFileNames()
     for filePath in filePaths:
         item = qt.QStandardItem()
         item.setText(filePath)
         self.fileModel.setItem(self.fileModel.rowCount(), 0, item)
     properties = self.logic.calculateProperties(filePaths)
     self.updateFileProperties(properties)
示例#12
0
 def onSave(self):
     saveDialog = qt.QFileDialog(self.parent)
     saveDialog.options = saveDialog.DontUseNativeDialog
     saveDialog.acceptMode = saveDialog.AcceptSave
     saveDialog.defaultSuffix = "qss"
     saveDialog.setNameFilter("Qt Style Sheet (*.qss)")
     saveDialog.connect("fileSelected(QString)", self.onSaveFileSelected)
     saveDialog.show()
示例#13
0
 def visualizationselectMeshFolder(self):
     self.visualizationmesh_folder = qt.QFileDialog().getExistingDirectory()
     self.visualizationmeshInputText.setText(self.visualizationmesh_folder)
     MST = slicer.app.coreIOManager().loadFile(
         self.visualizationmesh_folder + "/MSTmatrix.csv/MSTmatrix.csv")
     Distancematrix = slicer.app.coreIOManager().loadFile(
         self.visualizationmesh_folder + "/distancematrix.csv")
     print(self.visualizationmesh_folder)
示例#14
0
 def onLoad(self):
     fileDialog = qt.QFileDialog(self.parent)
     fileDialog.options = fileDialog.DontUseNativeDialog
     fileDialog.acceptMode = fileDialog.AcceptOpen
     fileDialog.fileMode = fileDialog.ExistingFile
     fileDialog.defaultSuffix = "qss"
     fileDialog.setNameFilter("Qt Style Sheet (*.qss)")
     fileDialog.connect("fileSelected(QString)", self.onLoadFileSelected)
     fileDialog.show()
示例#15
0
    def onSetIDEButton(self, clicked):
        dialog = qt.QFileDialog()
        self.arduinoIDEExe = dialog.getOpenFileName(None,
                                                    "Arduino IDE executable",
                                                    os.path.expanduser("~"))
        self.ui.IDEPathText.setText(self.arduinoIDEExe)

        # Update config
        self.config["IDEExe"] = self.arduinoIDEExe
        self.writeConfig()
 def onSave(self):
   """save the label statistics
   """
   if not self.fileDialog:
     self.fileDialog = qt.QFileDialog(self.parent)
     self.fileDialog.options = self.fileDialog.DontUseNativeDialog
     self.fileDialog.acceptMode = self.fileDialog.AcceptSave
     self.fileDialog.defaultSuffix = "csv"
     self.fileDialog.setNameFilter("Comma Separated Values (*.csv)")
     self.fileDialog.connect("fileSelected(QString)", self.onFileSelected)
   self.fileDialog.show()
示例#17
0
    def _browse_clicked(self):
        get_dir = qt.QFileDialog(self)
        given_dir = self._base_image_dir

        d = str(
            get_dir.getExistingDirectory(given_dir, self, "",
                                         "Select a directory", True, False))
        d = os.path.dirname(d)

        if d is not None and len(d) > 0:
            self.set_directory(d)
示例#18
0
    def openDialogBox(self):

        dlg = qt.QFileDialog()
        dlg.setFileMode(qt.QFileDialog.AnyFile)
        dlg.setNameFilter("TSV files (*.tsv)")
        dlg.setAcceptMode(qt.QFileDialog.AcceptOpen)

        if dlg.exec_():
            filename = dlg.selectedFiles()[0]
            print(filename)

            self.fileLineEdit.text = filename
示例#19
0
    def getFeatureStorageFile(self):
        valid = None
        filePath = None
        if self.ui.createFeatureStorageButton.checked:
            filePath = qt.QFileDialog().getSaveFileName(
                None, 'Create New File', 'feature_storage', '*.pickle')
            if not filePath:
                return False, None
            return True, filePath

        if self.ui.addToFeatureStorageButton.checked:
            valid, filePath = self.getFeatureStorageFileName()

        elif self.ui.loadFeatureStorageButton.checked:
            valid, filePath = self.getFeatureStorageFileName()

        if not valid:
            return False, None

        return True, filePath
示例#20
0
 def selectOutputFolder(self):
     self.outputFolder = qt.QFileDialog().getExistingDirectory()
     self.meshOutputText.setText(self.outputFolder)
 def selectFile(self):
     fileName = qt.QFileDialog().getOpenFileName()
     self.configFile.setText(fileName)
     self.updateGui()
示例#22
0
 def addByBrowsing(self):
   filePaths = qt.QFileDialog().getOpenFileNames()
   for filePath in filePaths:
     item = qt.QStandardItem()
     item.setText(filePath)
     self.fileModel.setItem(self.fileModel.rowCount(), 0, item)
示例#23
0
 def getFeatureStorageFileName(self):
     filePath = qt.QFileDialog().getOpenFileName(None, 'Open File', '',
                                                 '*.pickle')
     if not filePath:
         return False, None
     return True, filePath
示例#24
0
    def run(self):
        key = {}
        self.emit(qt.PYSIGNAL('getView'), (key, ))
        try:
            view = key['view']
            drawing = key['drawing']

            self.__snapAction = QubToolButtonAction(name='MosaicSnap',
                                                    iconName='snapshot',
                                                    toolButtonStyle=True,
                                                    place='toolbar',
                                                    group='image',
                                                    autoConnect=True)
            qt.QObject.connect(self.__snapAction, qt.PYSIGNAL('ButtonPressed'),
                               self.__snapCBK)
            view.addAction([self.__snapAction])
        except KeyError:
            logging.getLogger().error(
                'getView is not connected to CameraOffLineImageManager!!!')

        mosaicKey = {}
        self.emit(qt.PYSIGNAL('getMosaicView'), (mosaicKey, ))
        try:
            self.mosaicView = mosaicKey['view']
            self.drawing = mosaicKey['drawing']

            class _openDialog(QubOpenDialogAction):
                def __init__(self, *args, **keys):
                    QubOpenDialogAction.__init__(self, *args, **keys)

                def setCanvas(self, canvas):
                    self.__canvas = canvas

                def _showDialog(self):
                    if self._dialog.exec_loop() == qt.QDialog.Accepted:
                        file_path = self._dialog.selectedFile().ascii()
                        dirName, file_name = os.path.split(file_path)
                        base, ext = os.path.splitext(file_name)
                        QubImageSave.save(
                            os.path.join(dirName, '%s.svg' % base), None,
                            self.__canvas, 1, 'svg', True)

            self.__saveMosaicAction = _openDialog(parent=self,
                                                  label='Save image',
                                                  name="save",
                                                  iconName='save',
                                                  group="admin")
            saveMosaicDialogue = qt.QFileDialog('.', 'Mosaic Images (*.svg)',
                                                self, 'Save mosaic Images',
                                                True)
            saveMosaicDialogue.setMode(saveMosaicDialogue.AnyFile)
            self.__saveMosaicAction.setDialog(saveMosaicDialogue)
            self.__saveMosaicAction.setCanvas(self.drawing.canvas())

            self.__imageMosaicPosition = QubRulerAction(name='Motor Position',
                                                        place='toolbar',
                                                        group='Tools')

            self.__mouseMotorPosition = _MouseOrMotorPosition(
                name='mouse motor position',
                place='statusbar',
                group='info',
                mouseFlag=True)

            self.__currentMotorPosition = _MouseOrMotorPosition(
                name='current motor position', place='statusbar', group='info')

            self.mosaicView.addAction([
                self.__imageMosaicPosition, self.__saveMosaicAction,
                self.__currentMotorPosition, self.__mouseMotorPosition
            ])

            if self.__vMotor is not None:
                self.__imageMosaicPosition.setLabel(
                    QubRulerAction.VERTICAL, 0,
                    self.__vMotor.getMotorMnemonic())
                self.__imageMosaicPosition.setCursorPosition(
                    QubRulerAction.VERTICAL, 0, self.__vMotor.getPosition())
                limits = self.__vMotor.getLimits()
                self.__imageMosaicPosition.setLimits(QubRulerAction.VERTICAL,
                                                     0, *limits)
                self.__imageMosaicPosition.setLimits(QubRulerAction.VERTICAL,
                                                     1, *limits)

                self.__imageMosaicPosition.setLabel(QubRulerAction.VERTICAL, 1,
                                                    '')
                for label in [
                        self.__mouseMotorPosition, self.__currentMotorPosition
                ]:
                    label.setMotyName(self.__vMotor.getMotorMnemonic())
                    label.setYValue(self.__vMotor.getPosition())

            if self.__hMotor is not None:
                self.__imageMosaicPosition.setLabel(
                    QubRulerAction.HORIZONTAL, 0,
                    self.__hMotor.getMotorMnemonic())
                limits = self.__hMotor.getLimits()
                self.__imageMosaicPosition.setLimits(QubRulerAction.HORIZONTAL,
                                                     0, *limits)
                self.__imageMosaicPosition.setLimits(QubRulerAction.HORIZONTAL,
                                                     1, *limits)

                self.__imageMosaicPosition.setCursorPosition(
                    QubRulerAction.HORIZONTAL, 0, self.__hMotor.getPosition())
                self.__imageMosaicPosition.setLabel(QubRulerAction.HORIZONTAL,
                                                    1, '')

                for label in [
                        self.__mouseMotorPosition, self.__currentMotorPosition
                ]:
                    label.setMotxName(self.__hMotor.getMotorMnemonic())
                    label.setXValue(self.__hMotor.getPosition())

            for ruler in self.__imageMosaicPosition._QubRulerAction__ruler:
                ruler.setZ(99)  # upper layer

            #Add a follow mulot
            class _MouseFollow(_DrawingEventNDrawingMgr):
                def __init__(self, aDrawingMgr, oneShot, **keys):
                    _DrawingEventNDrawingMgr.__init__(self, aDrawingMgr, False)

                def mouseMove(self, x, y):
                    d = self._drawingMgr()
                    if d:
                        d.move(x, y)
                        d.endDraw()

            self.__followPointMouse, _ = QubAddDrawing(
                self.drawing, QubMosaicPointDrawingMgr, QubCanvasTarget)
            self.__followPointMouse.setDrawingEvent(_MouseFollow)
            self.__followPointMouse.setExclusive(False)
            self.__followPointMouse.startDrawing()
            self.__followPointMouse.setEndDrawCallBack(
                self.__displayMotorsPositionUnderMouse)
        except KeyError:
            pass

        if self.__camDecompNPlug:
            camera, decomp, plug = self.__camDecompNPlug
            try:
                plug.addImage()
                try:
                    plug.move(self.__hMotor.getPosition(),
                              self.__vMotor.getPosition())
                except:
                    pass
                else:
                    try:
                        plug.setCalibration(*self.__currentCalib)
                        plug.setBeamPosition(*self.__currentBeamPos)
                    except (AttributeError, TypeError):
                        pass
            except AttributeError:
                liveCheckBox = self.child('__liveCheckBox')
                liveCheckBox.hide()
示例#25
0
 def OnBrowseDirectory(self, dir):
   fileDialog = qt.QFileDialog()
   fileDialog.setFileMode(qt.QFileDialog.DirectoryOnly)
   if fileDialog.exec_():
     text = fileDialog.selectedFiles()
     dir.setText(text[0])
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        ####################
        # For debugging
        #
        # Reload and Test area
        reloadCollapsibleButton = ctk.ctkCollapsibleButton()
        reloadCollapsibleButton.text = "Reload && Test"
        self.layout.addWidget(reloadCollapsibleButton)
        reloadFormLayout = qt.QFormLayout(reloadCollapsibleButton)

        # reload button
        # (use this during development, but remove it when delivering
        #  your module to users)
        self.reloadButton = qt.QPushButton("Reload")
        self.reloadButton.toolTip = "Reload this module."
        self.reloadButton.name = "CurveMaker Reload"
        reloadFormLayout.addWidget(self.reloadButton)
        self.reloadButton.connect('clicked()', self.onReload)
        #
        ####################

        # Instantiate and connect widgets ...

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

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

        #
        # Input sequence node selector
        #
        self.inputSelector = slicer.qMRMLNodeComboBox()
        self.inputSelector.nodeTypes = ["vktMRMLSequenceNode"]
        self.inputSelector.selectNodeUponCreation = True
        self.inputSelector.addEnabled = False
        self.inputSelector.removeEnabled = False
        self.inputSelector.noneEnabled = False
        self.inputSelector.showHidden = False
        self.inputSelector.showChildNodeTypes = False
        self.inputSelector.setMRMLScene(slicer.mrmlScene)
        self.inputSelector.setToolTip(
            "Select a sequence node that contains a serial image.")
        parametersFormLayout.addRow("Input Image Sequence: ",
                                    self.inputSelector)

        #
        # Input Label node selector
        #
        self.inputLabelSelector = slicer.qMRMLNodeComboBox()
        self.inputLabelSelector.nodeTypes = ["vtkMRMLLabelMapVolumeNode"]
        self.inputLabelSelector.selectNodeUponCreation = True
        self.inputLabelSelector.addEnabled = False
        self.inputLabelSelector.removeEnabled = False
        self.inputLabelSelector.noneEnabled = False
        self.inputLabelSelector.showHidden = False
        self.inputLabelSelector.showChildNodeTypes = False
        self.inputLabelSelector.setMRMLScene(slicer.mrmlScene)
        self.inputLabelSelector.setToolTip(
            "Select a sequence node that contains a serial image.")
        parametersFormLayout.addRow("Input Label: ", self.inputLabelSelector)

        ##
        ## output file Selector
        ##
        outputFileLayout = qt.QHBoxLayout()

        self.outputFileEdit = qt.QLineEdit()
        self.outputFileEdit.text = ''
        self.outputFileEdit.readOnly = True
        self.outputFileEdit.frame = True
        self.outputFileEdit.styleSheet = "QLineEdit { background:transparent; }"
        self.outputFileEdit.cursor = qt.QCursor(qt.Qt.IBeamCursor)

        self.outputFileBrowserButton = qt.QPushButton()
        self.outputFileBrowserButton.setText("...")

        self.outputFileDialog = qt.QFileDialog()

        outputFileLayout.addWidget(self.outputFileEdit)
        outputFileLayout.addWidget(self.outputFileBrowserButton)
        parametersFormLayout.addRow("Output File (CSV): ", outputFileLayout)

        #self.outputSelector = slicer.qMRMLNodeComboBox()
        #self.outputSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        #self.outputSelector.selectNodeUponCreation = True
        #self.outputSelector.addEnabled = True
        #self.outputSelector.removeEnabled = True
        #self.outputSelector.noneEnabled = True
        #self.outputSelector.showHidden = False
        #self.outputSelector.showChildNodeTypes = False
        #self.outputSelector.setMRMLScene( slicer.mrmlScene )
        #self.outputSelector.setToolTip( "Pick the output to the algorithm." )
        #parametersFormLayout.addRow("Output Volume: ", self.outputSelector)

        ##
        ## check box to trigger taking screen shots for later use in tutorials
        ##
        #self.enableScreenshotsFlagCheckBox = qt.QCheckBox()
        #self.enableScreenshotsFlagCheckBox.checked = 0
        #self.enableScreenshotsFlagCheckBox.setToolTip("If checked, take screen shots for tutorials. Use Save Data to write them to disk.")
        #parametersFormLayout.addRow("Enable Screenshots", self.enableScreenshotsFlagCheckBox)

        #
        # Apply Button
        #
        self.applyButton = qt.QPushButton("Apply")
        self.applyButton.toolTip = "Run the algorithm."
        self.applyButton.enabled = False
        parametersFormLayout.addRow(self.applyButton)

        # connections
        self.applyButton.connect('clicked(bool)', self.onApplyButton)
        self.inputSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                   self.onSelect)
        #self.outputSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSelect)
        self.outputFileBrowserButton.connect('clicked(bool)',
                                             self.onInputFileBrowser)

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

        # Refresh Apply button state
        self.onSelect()
示例#27
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)
        # print(slicer.app.slicerHome)

        # [TODO]
        # Si potrebbe avere un file di configurazione che contiene eventualmente un path alla colorlut
        # Se non e' vuoto allora lo prendo se no prendo questo di default
        self.lutPath = (os.path.join(slicer.app.slicerHome, 'Extensions-29402/SEEGA/FreeSurferColorLUT20120827.txt'),\
                       os.path.join(slicer.app.slicerHome, 'Extensions-29402/SEEGA/Yeo2011_7Networks_ColorLUT.txt'))

        # print (self.lutPath)
        # [END TODO]

        atlasNode = slicer.mrmlScene.GetNodesByName('aparc*').GetItemAsObject(
            0)
        reconFileNode = slicer.mrmlScene.GetNodesByName(
            'recon').GetItemAsObject(0)

        self.zonedetectionCB = ctk.ctkCollapsibleButton()
        self.zonedetectionCB.text = "Brain Zone Detection"

        self.layout.addWidget(self.zonedetectionCB)

        self.zoneDetectionLayout = qt.QFormLayout(self.zonedetectionCB)

        ### Select Atlas
        self.atlasInputSelector = slicer.qMRMLNodeComboBox()
        self.atlasInputSelector.nodeTypes = [
            "vtkMRMLLabelMapVolumeNode", "vtkMRMLScalarVolumeNode"
        ]
        #   self.atlasInputSelector.addAttribute("vtkMRMLScalarVolumeNode", "LabelMap", 0)
        self.atlasInputSelector.selectNodeUponCreation = True
        self.atlasInputSelector.addEnabled = False
        self.atlasInputSelector.removeEnabled = False
        self.atlasInputSelector.noneEnabled = True
        self.atlasInputSelector.showHidden = False
        self.atlasInputSelector.showChildNodeTypes = False
        self.atlasInputSelector.setMRMLScene(slicer.mrmlScene)
        self.atlasInputSelector.setToolTip("Pick the volumetric Atlas.")
        self.zoneDetectionLayout.addRow("Volumetric parcels: ",
                                        self.atlasInputSelector)

        self.dialog = qt.QFileDialog()
        self.dialog.setFileMode(qt.QFileDialog.AnyFile)
        self.dialog.setToolTip("Pick the input to the algorithm.")

        self.fidsSelectorZone = slicer.qMRMLNodeComboBox()
        self.fidsSelectorZone.nodeTypes = [("vtkMRMLMarkupsFiducialNode"), ""]
        self.fidsSelectorZone.selectNodeUponCreation = False
        self.fidsSelectorZone.addEnabled = False
        self.fidsSelectorZone.removeEnabled = False
        self.fidsSelectorZone.noneEnabled = True
        self.fidsSelectorZone.setMRMLScene(slicer.mrmlScene)
        self.fidsSelectorZone.setToolTip("Select a fiducial list")
        self.zoneDetectionLayout.addRow("Fiducial : ", self.fidsSelectorZone)

        self.lutSelector = qt.QComboBox()
        # instead of filling hardwired values
        # we can check share/Freesurfer folder and
        # fill selector with available files
        self.lutSelector.addItem('FreesurferColorLUT')
        self.lutSelector.addItem('Yeo7')

        self.ROISize = qt.QLineEdit("7")
        self.ROISize.setToolTip(
            "Define side length of cubic region centered in contact centroid")
        self.ROISize.setInputMask("D")

        # Run Zone Detection button
        self.zoneButton = qt.QPushButton("Apply")
        self.zoneButton.toolTip = "Run the algorithm."
        self.zoneButton.enabled = True

        self.zoneDetectionLayout.addRow("Spherical Region Side Length:",
                                        self.ROISize)
        self.zoneDetectionLayout.addRow(self.lutSelector)
        self.zoneDetectionLayout.addRow(self.zoneButton)

        if atlasNode:
            self.atlasInputSelector.setCurrentNode(atlasNode)
        if reconFileNode:
            self.fidsSelectorZone.setCurrentNode(reconFileNode)

        # connections
        self.zoneButton.connect('clicked(bool)', self.onZoneButton)
示例#28
0
  def __init__(self, parent, developerMode=False, widgetClass=None):
    VTKObservationMixin.__init__(self)
    # Set up main frame
    self.parent = parent
    self.parent.setLayout(qt.QHBoxLayout())

    self.layout = self.parent.layout()
    self.layout.setMargin(0)
    self.layout.setSpacing(0)

    self.sliceletPanel = qt.QFrame(self.parent)
    self.sliceletPanelLayout = qt.QVBoxLayout(self.sliceletPanel)
    self.sliceletPanelLayout.setMargin(4)
    self.sliceletPanelLayout.setSpacing(0)
    self.layout.addWidget(self.sliceletPanel,1)

    #Set Advanced Parameters Collapsible Button
    self.parametersCollapsibleButton = ctk.ctkCollapsibleButton()
    self.parametersCollapsibleButton.text = "Set Advanced Segmentation Parameters"
    self.parametersCollapsibleButton.collapsed = True
    self.sliceletPanelLayout.addWidget(self.parametersCollapsibleButton)
    # Layout within the collapsible button
    self.parametersLayout = qt.QFormLayout(self.parametersCollapsibleButton)
    # Set Minimum Threshold of Percentage Increase to First Post-Contrast Image
    self.inputMinimumThreshold = qt.QLabel("Minimum Threshold of Increase", self.parametersCollapsibleButton)
    self.inputMinimumThreshold.setToolTip('Minimum Threshold of Percentage Increase (Pre- to First Post-contrast (Range: 10% to 150%)')
    self.inputSelectorMinimumThreshold = qt.QDoubleSpinBox(self.parametersCollapsibleButton)
    self.inputSelectorMinimumThreshold.setSuffix("%")
    self.inputSelectorMinimumThreshold.singleStep = (1)
    self.inputSelectorMinimumThreshold.minimum = (10)
    self.inputSelectorMinimumThreshold.maximum = (150)
    self.inputSelectorMinimumThreshold.value = (75)
    self.inputSelectorMinimumThreshold.setToolTip('Minimum Threshold of Percentage Increase (Pre- to First Post-contrast (Range: 10% to 150%)')
    self.parametersLayout.addRow(self.inputMinimumThreshold, self.inputSelectorMinimumThreshold)
    # Curve 1 Type Parameters (Slopes from First to Fourth Post-Contrast Images)
    self.inputCurve1 = qt.QLabel("Type 1 (Persistent) Curve Minimum Slope", self.parametersCollapsibleButton)
    self.inputCurve1.setToolTip('Minimum Slope of Delayed Curve to classify as Persistent (Range: 0.02 to 0.3)')
    self.inputSelectorCurve1 = qt.QDoubleSpinBox(self.parametersCollapsibleButton)
    self.inputSelectorCurve1.singleStep = (0.02)
    self.inputSelectorCurve1.minimum = (0.02)
    self.inputSelectorCurve1.maximum = (0.30)
    self.inputSelectorCurve1.value = (0.20)
    self.inputSelectorCurve1.setToolTip('Minimum Slope of Delayed Curve to classify as Persistent (Range: 0.02 to 0.3)')
    self.parametersLayout.addRow(self.inputCurve1, self.inputSelectorCurve1)
    # Curve 3 Type Parameters (Slopes from First to Fourth Post-Contrast Images)
    self.inputCurve3 = qt.QLabel("Type 3 (Washout) Curve Maximum Slope", self.parametersCollapsibleButton)
    self.inputCurve3.setToolTip('Maximum Slope of Delayed Curve to classify as Washout (Range: -0.02 to -0.3)')
    self.inputSelectorCurve3 = qt.QDoubleSpinBox(self.parametersCollapsibleButton)
    self.inputSelectorCurve3.singleStep = (0.02)
    self.inputSelectorCurve3.setPrefix("-")
    self.inputSelectorCurve3.minimum = (0.02)
    self.inputSelectorCurve3.maximum = (0.30)
    self.inputSelectorCurve3.value = (0.20)
    self.inputSelectorCurve3.setToolTip('Maximum Slope of Delayed Curve to classify as Washout (Range: -0.02 to -0.3)')
    self.parametersLayout.addRow(self.inputCurve3, self.inputSelectorCurve3)

    # Path input for dicom data to analyze
    self.inputPath = qt.QFileDialog()
    self.inputPath.setFileMode(qt.QFileDialog.Directory)
    self.sliceletPanelLayout.addWidget(self.inputPath)
    self.inputPath.connect('accepted()', self.createLogic)


    ##############
    self.layoutWidget = slicer.qMRMLLayoutWidget()
    self.layoutWidget.setMRMLScene(slicer.mrmlScene)
    self.layoutWidget.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView)
    self.layout.addWidget(self.layoutWidget,2)


    if widgetClass:
      self.widget = widgetClass(self.parent)
    self.parent.show()
示例#29
0
 def addByBrowsing(self):
     self.onClear()
     filePaths = qt.QFileDialog().getOpenFileNames()
     self.setFilePaths(filePaths)
示例#30
0
 def selectArchetype(self):
     filePath = qt.QFileDialog().getOpenFileName()
     self.archetypeText.text = filePath