def onSave(self):
     # todo: include a default filename such as HetergeneityCAD-Date
     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.selectFile("HeterogeneityCAD")
     self.fileDialog.show()
Exemple #2
0
 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()
Exemple #3
0
 def promptForDatabaseDirectory(self):
     fileDialog = qt.QFileDialog(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>The Slicer DICOM module stores a local database with an index to all datasets that are 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."
     )
     layout = fileDialog.layout()
     layout.addWidget(label, layout.rowCount(), 1, -1, -1)
     fileDialog.open()
    def configurationSetup(self):
        #### Create a Collapsible Button
        self.setupCB = ctk.ctkCollapsibleButton()
        self.setupCB.text = "ContactPositionEstimator - Configuration"
        self.setupCB.collapsed = True
        self.layout.addWidget(self.setupCB)

        #### Collapsible button layout
        self.setupFL = qt.QFormLayout(self.setupCB)

        #### Tool Box for changing deeto Executable
        self.deetoTB = qt.QToolButton()
        self.deetoTB.setText("...")
        self.deetoTB.toolTip = "Change deeto executable"
        self.deetoTB.enabled = True
        self.deetoTB.connect('clicked(bool)', self.ondeetoTB)

        #### Line Edit button, where the executable path is shown
        self.deetoLE = qt.QLineEdit(
            slicer.modules.ContactPositionEstimatorInstance.deetoExecutablePath
        )
        self.deetoLE.setDisabled(True)
        self.deetoLE.setMaximumWidth(100)
        self.deetoLE.setFixedWidth(400)

        #### Buttons Layout
        self.deetoButtonsHBL = qt.QHBoxLayout()
        self.deetoButtonsHBL.addWidget(self.deetoLE)
        self.deetoButtonsHBL.addWidget(self.deetoTB)

        #### Aggiungo il bottone al layout
        self.setupFL.addRow("ContactPositionEstimator executable: ",
                            self.deetoButtonsHBL)

        #### Button to change the deeto executable location
        #### It is called in ondeetoTB, when deetoTB is selected
        self.deetoFD = qt.QFileDialog()
        self.deetoFD.setFileMode(qt.QFileDialog.AnyFile)
        self.deetoFD.setToolTip("Pick the input to the algorithm.")
Exemple #5
0
    def onSaveMontageClick(self):
        # read the table
        # save it as brainstom compliant file
        fileDialog = qt.QFileDialog()
        fileDialog.setFileMode(0)

        basePath = fileDialog.getExistingDirectory()

        referencingSchemeNode = self.tableBox.currentNode()
        rows = referencingSchemeNode.GetNumberOfRows()

        fileName = os.path.join(basePath,
                                referencingSchemeNode.GetName() + '.mon')

        with open(fileName, 'w') as f:
            for rowIdx in range(0, rows):

                strLine = referencingSchemeNode.GetCellText(rowIdx,0)+":"+\
                          referencingSchemeNode.GetCellText(rowIdx,1)+","+\
                          referencingSchemeNode.GetCellText(rowIdx,2)+"\n"

                f.write(strLine)

        return True