コード例 #1
0
ファイル: DICOM.py プロジェクト: viper65/Slicer
 def promptForDatabaseDirectory(self):
     """Ask the user to pick a database directory.
 But, if the application is in testing mode, just pick
 a temp directory
 """
     commandOptions = slicer.app.commandOptions()
     if commandOptions.testingEnabled:
         databaseDirectory = slicer.app.temporaryPath + '/tempDICOMDatbase'
         qt.QDir().mkpath(databaseDirectory)
         self.onDatabaseDirectoryChanged(databaseDirectory)
     else:
         settings = qt.QSettings()
         databaseDirectory = settings.value('DatabaseDirectory')
         if databaseDirectory:
             self.onDatabaseDirectoryChanged(databaseDirectory)
         else:
             fileDialog = ctk.ctkFileDialog(slicer.util.mainWindow())
             fileDialog.setWindowModality(1)
             fileDialog.setWindowTitle("Select DICOM Database Directory")
             fileDialog.setFileMode(2)  # prompt for directory
             fileDialog.connect('fileSelected(QString)',
                                self.onDatabaseDirectoryChanged)
             label = qt.QLabel(
                 "<p><p>The Slicer DICOM module stores a local database with an index to all datasets that are <br>pushed to slicer, retrieved from remote dicom servers, or imported.<p>Please select a location for this database where you can store the amounts of data you require.<p>Be sure you have write access to the selected directory.",
                 fileDialog)
             fileDialog.setBottomWidget(label)
             fileDialog.exec_()
コード例 #2
0
 def findFile():
     dialog = ctk.ctkFileDialog()
     if _type == 'file':
         selected = dialog.getOpenFileName()
     if _type == 'folder':
         selected = dialog.getExistingDirectory()
     if selected:
         self.labels[label_id].text = selected
コード例 #3
0
ファイル: PyRegPipe.py プロジェクト: sunyu0410/PyRegPipe
 def getPath(self):
     '''Choose the project folder'''
     dialog = ctk.ctkFileDialog()
     selected = dialog.getExistingDirectory()
     if selected:
         self.prjPath = selected
         self.setting_path = path.join(self.prjPath, 'setting')
         self.labPrjpath.text = '\t' + selected
コード例 #4
0
ファイル: DICOM.py プロジェクト: benjaminlong/Slicer
 def promptForDatabaseDirectory(self):
   fileDialog = ctk.ctkFileDialog(slicer.util.mainWindow())
   fileDialog.setWindowModality(1)
   fileDialog.setWindowTitle("Select DICOM Database Directory")
   fileDialog.setFileMode(2) # prompt for directory
   fileDialog.connect('fileSelected(QString)', self.onDatabaseDirectoryChanged)
   label = qt.QLabel("<p><p>The Slicer DICOM module stores a local database with an index to all datasets that are <br>pushed to slicer, retrieved from remote dicom servers, or imported.<p>Please select a location for this database where you can store the amounts of data you require.<p>Be sure you have write access to the selected directory.", fileDialog)
   fileDialog.setBottomWidget(label)
   fileDialog.open()
コード例 #5
0
 def promptForDatabaseDirectory(self):
     fileDialog = ctk.ctkFileDialog(slicer.util.mainWindow())
     fileDialog.setWindowModality(1)
     fileDialog.setWindowTitle("Select DICOM Database Directory")
     fileDialog.setFileMode(2)  # prompt for directory
     fileDialog.connect('fileSelected(QString)',
                        self.onDatabaseDirectoryChanged)
     label = qt.QLabel(
         "<p><p>The Slicer DICOM module stores a local database with an index to all datasets that are <br>pushed to slicer, retrieved from remote dicom servers, or imported.<p>Please select a location for this database where you can store the amounts of data you require.<p>Be sure you have write access to the selected directory.",
         fileDialog)
     fileDialog.setBottomWidget(label)
     fileDialog.open()
コード例 #6
0
    def onOpenDialogSaveJson(self):
        if self.verbose:
            print("onSave")
            print("Current path", self.inputJsonFn.currentPath)

        fileDialog = ctk.ctkFileDialog(slicer.util.mainWindow())
        fileDialog.setDirectory(self.inputJsonFn.currentPath)
        fileDialog.setWindowModality(1)
        fileDialog.setWindowTitle("Select Json File")
        fileDialog.setFileMode(3)  # prompt for files
        fileDialog.connect('fileSelected(QString)', self.onSaveJson)
        fileDialog.open()

        ctk.ctkFileDialog.get
コード例 #7
0
    def onSave(self):
        dlg = ctk.ctkFileDialog()
        CSVpath = dlg.getSaveFileName(
            None, "Export CSV file for Classification groups",
            os.path.join(qt.QDir.homePath(), "Desktop"), "CSV File (*.csv)")

        if CSVpath == '' or CSVpath == ' ':
            return

        if self.logic.checkExtension(CSVpath, '.csv'):
            print('saving ...', end=' ')
            self.logic.saveResults(CSVpath)
            slicer.util.delayDisplay("Exploration saved")
            print('Done!')
コード例 #8
0
ファイル: DICOM.py プロジェクト: LJWilliams/Neuroimaging
 def promptForDatabaseDirectory(self):
   """Ask the user to pick a database directory.
   But, if the application is in testing mode, just pick
   a temp directory
   """
   commandOptions = slicer.app.commandOptions()
   if commandOptions.testingEnabled:
     databaseDirectory = slicer.app.temporaryPath + '/tempDICOMDatbase'
     qt.QDir().mkpath(databaseDirectory)
     self.onDatabaseDirectoryChanged(databaseDirectory)
   else:
     settings = qt.QSettings()
     databaseDirectory = settings.value('DatabaseDirectory')
     if databaseDirectory:
       self.onDatabaseDirectoryChanged(databaseDirectory)
     else:
       fileDialog = ctk.ctkFileDialog(slicer.util.mainWindow())
       fileDialog.setWindowModality(1)
       fileDialog.setWindowTitle("Select DICOM Database Directory")
       fileDialog.setFileMode(2) # prompt for directory
       fileDialog.connect('fileSelected(QString)', self.onDatabaseDirectoryChanged)
       label = qt.QLabel("<p><p>The Slicer DICOM module stores a local database with an index to all datasets that are <br>pushed to slicer, retrieved from remote dicom servers, or imported.<p>Please select a location for this database where you can store the amounts of data you require.<p>Be sure you have write access to the selected directory.", fileDialog)
       fileDialog.setBottomWidget(label)
       fileDialog.exec_()
コード例 #9
0
 def getSaveFile():
     '''Choose a file'''
     dialog = ctk.ctkFileDialog()
     selected = dialog.getSaveFileName()
     return selected
コード例 #10
0
 def getPath():
     '''Choose the folder'''
     dialog = ctk.ctkFileDialog()
     selected = dialog.getExistingDirectory()
     return selected
コード例 #11
0
ファイル: WarpImg.py プロジェクト: sunyu0410/PyRegPipe
 def getPath(self):
     '''Choose the project folder'''
     dialog = ctk.ctkFileDialog()
     selected = dialog.getExistingDirectory()
     return os.path.realpath(selected) if selected else None