def build_execution_tools(self):
        self.executeButton = qt.QPushButton('Execute')
        self.executeButton.setFixedHeight(36)
        self.executeButton.connect('clicked(bool)', self.click_execute)
        self.statusLabel = qt.QLabel('Status: ')
        self.statusLabel.enabled = False
        self.progressBar = qt.QProgressBar()
        self.progressBar.setFixedHeight(36)
        self.progressBar.minimum = 0
        self.progressBar.maximum = 100
        self.progressBar.value = 0
        self.progressBar.visible = False
        self.finishButton = qt.QPushButton('Finish')
        self.finishButton.visible = False
        self.finishButton.connect('clicked(bool)', self.click_finish)
        self.finishButton.setFixedHeight(36)
        box = qt.QHBoxLayout()
        box.addWidget(self.progressBar)
        box.addWidget(self.finishButton)

        layout = qt.QVBoxLayout()
        layout.addWidget(self.build_configuration_tools())
        layout.addWidget(self.statusLabel)
        layout.addWidget(self.executeButton)
        layout.addLayout(box)
        layout.setMargin(10)
        return layout
 def build_progress(self):
     self.currentProgressLabel = qt.QLabel("Status:")
     self.currentlyRunningLabel = qt.QLabel(
         "Parameters: Elastix Rigid Registration")
     self.progressBar = qt.QProgressBar()
     self.progressBar.minimum = 0
     self.progressBar.maximum = 100
     self.progressBar.value = 0
     self.progressBar.setFixedHeight(36)
     self.cancelButton = qt.QPushButton("Cancel Execution")
     self.cancelButton.connect('clicked(bool)', self.click_cancel)
     self.cancelButton.setFixedHeight(36)
     self.finishButton = qt.QPushButton("Finish")
     self.finishButton.visible = False
     self.finishButton.connect('clicked(bool)', self.click_finish)
     self.finishButton.setFixedHeight(36)
     # FRAME
     self.progressBox = qt.QFrame()
     self.progressBox.hide()
     row = qt.QHBoxLayout()
     row.addWidget(self.progressBar)
     row.addWidget(self.cancelButton)
     row.addWidget(self.finishButton)
     layout = qt.QVBoxLayout(self.progressBox)
     layout.addWidget(self.currentlyRunningLabel)
     layout.addWidget(self.currentProgressLabel)
     layout.addLayout(row)
     layout.setContentsMargins(10, 0, 10, 20)
     return self.progressBox
Exemple #3
0
    def setup(self):
        self.setLayout(qt.QGridLayout())
        self.statusLabel = qt.QLabel("Status:")
        self.textLabel = qt.QLabel()
        self.layout().addWidget(self.statusLabel, 0, 0)
        self.layout().addWidget(self.textLabel, 0, 1, 1, 2)

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

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

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

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

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

        self.setupConnections()
 def setup(self):
   self.textLabel = qt.QLabel()
   self.progress = qt.QProgressBar()
   self.maximumHeight = slicer.util.mainWindow().statusBar().height
   rowLayout = qt.QHBoxLayout()
   self.setLayout(rowLayout)
   rowLayout.addWidget(self.textLabel, 1)
   rowLayout.addWidget(self.progress, 1)
   self.setStyleSheet(self.STYLE)
   self.refreshProgressVisibility()
   slicer.util.mainWindow().statusBar().addWidget(self, 1)
Exemple #5
0
    def open(self):
        self.studyLabel = qt.QLabel('Send %d items to destination' %
                                    len(self.files))
        self.layout().addWidget(self.studyLabel)

        # Send Parameters
        self.dicomFrame = qt.QFrame(self)
        self.dicomFormLayout = qt.QFormLayout()
        self.dicomFrame.setLayout(self.dicomFormLayout)

        self.settings = qt.QSettings()

        self.protocolSelectorCombobox = qt.QComboBox()
        self.protocolSelectorCombobox.addItems(["DIMSE", "DICOMweb"])
        self.protocolSelectorCombobox.setCurrentText(
            self.settings.value('DICOM/Send/Protocol', 'DIMSE'))
        self.protocolSelectorCombobox.currentIndexChanged.connect(
            self.onProtocolSelectorChange)
        self.dicomFormLayout.addRow("Protocol: ",
                                    self.protocolSelectorCombobox)

        self.serverAETitleEdit = qt.QLineEdit()
        self.serverAETitleEdit.setToolTip("AE Title")
        self.serverAETitleEdit.text = self.settings.value(
            'DICOM/Send/AETitle', 'CTK')
        self.dicomFormLayout.addRow("AE Title: ", self.serverAETitleEdit)
        # Enable AET only for DIMSE
        self.serverAETitleEdit.enabled = self.protocolSelectorCombobox.currentText == 'DIMSE'

        self.serverAddressLineEdit = qt.QLineEdit()
        self.serverAddressLineEdit.setToolTip(
            "Address includes hostname and port number in standard URL format (hostname:port)."
        )
        self.serverAddressLineEdit.text = self.settings.value(
            'DICOM/Send/URL', '')
        self.dicomFormLayout.addRow("Destination Address: ",
                                    self.serverAddressLineEdit)

        self.layout().addWidget(self.dicomFrame)

        # button box
        self.bbox = qt.QDialogButtonBox(self)
        self.bbox.addButton(self.bbox.Ok)
        self.bbox.addButton(self.bbox.Cancel)
        self.bbox.accepted.connect(self.onOk)
        self.bbox.rejected.connect(self.onCancel)
        self.layout().addWidget(self.bbox)

        self.progressBar = qt.QProgressBar(self.parent().window())
        self.progressBar.hide()
        self.dicomFormLayout.addRow(self.progressBar)

        qt.QDialog.open(self)
Exemple #6
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

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

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

        # label(mask) value
        self.labelROISpin = qt.QSpinBox()
        self.labelROISpin.setMinimum(0)
        self.labelROISpin.setMaximum(2048)
        self.labelROISpin.setToolTip("Valor do Label (cor) para o ROI.")
        mainFormLayout.addRow("ROI Label Value", self.labelROISpin)

        # label(mask) value
        self.labelCortSpin = qt.QSpinBox()
        self.labelCortSpin.setMinimum(0)
        self.labelCortSpin.setMaximum(2048)
        self.labelCortSpin.setToolTip("valor do Label (cor) para o Osso Cortical")
        mainFormLayout.addRow("Osso Cortical Label Value", self.labelCortSpin)

        # Apply Button
        self.applyButton = qt.QPushButton("Iniciar")
        self.applyButton.toolTip = "Inicie o processamento."
        #self.applyButton.enabled = False
        mainFormLayout.addRow(self.applyButton)

        # Progress Bar
        self.progressBar = qt.QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(100)
        self.progressBar.setVisible(False)
        mainFormLayout.addRow(self.progressBar)

        self.resultButton = qt.QPushButton("Salvar imagens")
        #self.resultButton.enabled = False
        mainFormLayout.addRow(self.resultButton)

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

        # Conexoes
        self.applyButton.connect('clicked(bool)', self.onApplyButton)
        self.resultButton.connect('clicked(bool)', self.onResultButton)

        # Refresh Apply button state
        self.onSelect()
 def setup(self):
   ScriptedLoadableModuleWidget.setup(self)
   
   self.logic = EAMapReaderLogic()
   self.logic.logCallback = self.addLog
   self.logic.progressCallback = self.updateProgress
   self.loadingInProgress = False
   
   # Instantiate and connect widgets ...
   self.buttonVelocity = qt.QPushButton("Ensite Velocity / Precision")
   self.buttonVelocity.toolTip = "Import Ensite map."
   self.buttonVelocity.enabled = True
   self.layout.addWidget(self.buttonVelocity)
   
   self.buttonCarto = qt.QPushButton("CARTO 3")
   self.buttonCarto.toolTip = "Import CARTO 3 map."
   self.buttonCarto.enabled = True
   self.layout.addWidget(self.buttonCarto)
   
   self.buttonRhythmia = qt.QPushButton("RHYTHMIA")
   self.buttonRhythmia.toolTip = "Import RHYTHMIA Map."
   self.buttonRhythmia.enabled = True
   self.layout.addWidget(self.buttonRhythmia)
   
   self.statusLabel = qt.QPlainTextEdit()
   self.statusLabel.setTextInteractionFlags(qt.Qt.TextSelectableByMouse)
   self.statusLabel.setCenterOnScroll(True)
   self.layout.addWidget(self.statusLabel)
   
   self.progressBar=qt.QProgressBar()
   self.progressBar.setRange(0, 100) 
   self.progressBar.setValue(0)
   self.layout.addWidget(self.progressBar)
   
   # connections
   self.buttonVelocity.connect('clicked(bool)', self.onButtonVelocity)
   self.buttonCarto.connect('clicked(bool)', self.onButtonCarto)
   self.buttonRhythmia.connect('clicked(bool)', self.onButtonRhythmia)
Exemple #8
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.collect_hwobj = None

        self.addProperty("mnemonic", "string", "")
        self.addProperty("appearance", "combo", ("simple", "normal"), "normal")
        self.addProperty("title", "string", "")
        self.addProperty("timeFormat", "string", "%H:%M:%S")

        self.executing = None
        self.time_total_sec = 0
        self.time_remaining_sec = 0
        self.time_format = None
        self.progress_task = None

        self.container_hbox = qt.QHGroupBox(self)
        self.container_hbox.setInsideMargin(4)
        self.container_hbox.setInsideSpacing(2)

        self.time_total_label = qt.QLabel("Total:", self.container_hbox)
        self.time_total_value_label = qt.QLabel("??:??:??",
                                                self.container_hbox)
        self.progressBar = qt.QProgressBar(self.container_hbox)
        self.progressBar.setCenterIndicator(True)
        self.time_remaining_label = qt.QLabel("Remaining:",
                                              self.container_hbox)
        self.time_remaining_value_label = qt.QLabel("??:??:??",
                                                    self.container_hbox)

        qt.QVBoxLayout(self)
        self.setSizePolicy(qt.QSizePolicy.MinimumExpanding,
                           qt.QSizePolicy.Fixed)
        self.layout().addWidget(self.container_hbox)

        self.setEnabled(False)
        self.instanceSynchronize("")
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.collect_hwobj = None

        self.addProperty('mnemonic', 'string', '')
        self.addProperty('appearance', 'combo', ('simple', 'normal'), 'normal')
        self.addProperty('title', 'string', '')
        self.addProperty('timeFormat', 'string', '%H:%M:%S')

        self.executing = None
        self.time_total_sec = 0
        self.time_remaining_sec = 0
        self.time_format = None
        self.progress_task = None

        self.container_hbox = qt.QHGroupBox(self)
        self.container_hbox.setInsideMargin(4)
        self.container_hbox.setInsideSpacing(2)

        self.time_total_label = qt.QLabel('Total:', self.container_hbox)
        self.time_total_value_label = qt.QLabel('??:??:??',
                                                self.container_hbox)
        self.progressBar = qt.QProgressBar(self.container_hbox)
        self.progressBar.setCenterIndicator(True)
        self.time_remaining_label = qt.QLabel('Remaining:',
                                              self.container_hbox)
        self.time_remaining_value_label = qt.QLabel('??:??:??',
                                                    self.container_hbox)

        qt.QVBoxLayout(self)
        self.setSizePolicy(qt.QSizePolicy.MinimumExpanding,
                           qt.QSizePolicy.Fixed)
        self.layout().addWidget(self.container_hbox)

        self.setEnabled(False)
        self.instanceSynchronize("")
  def setup(self):
    self.CsvInputGroupBox = qt.QGroupBox('CSV input for local files')

    CsvInputLayout = qt.QFormLayout(self.CsvInputGroupBox)

    #
    # Input CSV Path
    #
    self.batchTableSelector = slicer.qMRMLNodeComboBox()
    self.batchTableSelector.nodeTypes = ['vtkMRMLTableNode']
    self.batchTableSelector.addEnabled = True
    self.batchTableSelector.selectNodeUponCreation = True
    self.batchTableSelector.renameEnabled = True
    self.batchTableSelector.removeEnabled = True
    self.batchTableSelector.noneEnabled = False
    self.batchTableSelector.setMRMLScene(slicer.mrmlScene)
    self.batchTableSelector.toolTip = 'Select the table representing the cases to process.'
    CsvInputLayout.addRow(self.batchTableSelector)

    #
    # Parameters Area
    #
    self.parametersCollapsibleButton = ctk.ctkCollapsibleButton()
    self.parametersCollapsibleButton.text = 'Table view and attribute properties'
    CsvInputLayout.addWidget(self.parametersCollapsibleButton)

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

    self.batchTableView = slicer.qMRMLTableView()
    parametersFormLayout.addRow(self.batchTableView)
    self.batchTableView.show()

    #
    # Input parameters GroupBox
    #
    self.inputParametersGroupBox = qt.QGroupBox('Input parameters')
    parametersFormLayout.addRow(self.inputParametersGroupBox)

    inputParametersFormLayout = qt.QFormLayout(self.inputParametersGroupBox)

    #
    # Root Path
    #
    self.rootSelector = qt.QLineEdit()
    self.rootSelector.text = 'path'
    self.rootSelector.toolTip = 'Location of the root directory to load from, or the column name specifying said ' \
                                'directory in the input CSV'
    inputParametersFormLayout.addRow('Root Column', self.rootSelector)

    #
    # Image Path
    #
    self.imageSelector = qt.QLineEdit()
    self.imageSelector.text = 'image'
    self.imageSelector.toolTip = 'Name of the column specifying main image files in input CSV'
    inputParametersFormLayout.addRow('Image Column', self.imageSelector)

    #
    # GroundTruth masks
    #
    self.inputGTMaskColumnNames = qt.QLineEdit()
    self.inputGTMaskColumnNames.text = 'gt_0,gt_1,gt_2'
    self.inputGTMaskColumnNames.toolTip = 'Comma separated names of the columns specifying groundtruth mask files in input CSV'
    inputParametersFormLayout.addRow('Groundtruth masks Column(s)', self.inputGTMaskColumnNames)

    #
    # Predicted masks
    #
    self.inputPredMaskColumnNames = qt.QLineEdit()
    self.inputPredMaskColumnNames.text = 'pred_0,pred_1,pred_2'
    self.inputPredMaskColumnNames.toolTip = 'Comma separated names of the columns specifying predicted mask files in input CSV'
    inputParametersFormLayout.addRow('Predicted masks Column(s)', self.inputPredMaskColumnNames)

    self.iterationParametersGroupBox = qt.QGroupBox('Iteration parameters')
    parametersFormLayout.addRow(self.iterationParametersGroupBox)

    iterationParametersFormLayout = qt.QFormLayout(self.iterationParametersGroupBox)

    #
    # Cache Cases
    #
    self.cacheCases = qt.QCheckBox()
    self.cacheCases.checked = True
    self.cacheCases.toolTip = 'Cache cases for faster reload'
    iterationParametersFormLayout.addRow('Cache cases', self.cacheCases)

    #
    # Preload Cases
    #
    self.preloadCases = qt.QCheckBox()
    self.preloadCases.checked = False
    self.preloadCases.toolTip = 'Preloading all cases'
    iterationParametersFormLayout.addRow('Preload cases', self.preloadCases)

    #
    # Output Case Table Directory
    #
    self.tableOutputDirectory = ctk.ctkPathLineEdit()
    self.tableOutputDirectory.filters = ctk.ctkPathLineEdit.Dirs
    iterationParametersFormLayout.addRow('Case tables output dir', self.tableOutputDirectory)

    #
    # Progressbar
    #
    self.progressBar = qt.QProgressBar()
    self.progressBar.setFormat("%v/%m")
    self.progressBar.visible = False
    iterationParametersFormLayout.addWidget(self.progressBar)

    #
    # Connect Event Handlers
    #
    self.batchTableSelector.connect('nodeActivated(vtkMRMLNode*)', self.onChangeTable)
    self.imageSelector.connect('textEdited(QString)', self.onChangeImageColumn)
    self.preloadCases.stateChanged.connect(self.onPreloadCasesChanged)

    return self.CsvInputGroupBox
Exemple #11
0
 def __init__(self):
     # Create a Progress Bar
     self.pb = qt.QProgressBar()
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # Instantiate and connect widgets ...

        self.dockerGroupBox = ctk.ctkCollapsibleGroupBox()
        self.dockerGroupBox.setTitle('Docker Settings')
        self.layout.addWidget(self.dockerGroupBox)
        dockerForm = qt.QFormLayout(self.dockerGroupBox)
        self.dockerPath = ctk.ctkPathLineEdit()
        # self.dockerPath.setMaximumWidth(300)
        if platform.system() == 'Darwin':
            self.dockerPath.setCurrentPath('/usr/local/bin/docker')
        if platform.system() == 'Linux':
            self.dockerPath.setCurrentPath('/usr/bin/docker')
        if platform.system() == 'Windows':
            self.dockerPath.setCurrentPath(
                "C:/Program Files/Docker/Docker/resources/bin/docker.exe")

        ### use nvidia-docker if it is installed
        nvidiaDockerPath = self.dockerPath.currentPath.replace(
            'bin/docker', 'bin/nvidia-docker')
        if os.path.isfile(nvidiaDockerPath):
            self.dockerPath.setCurrentPath(nvidiaDockerPath)

        self.downloadButton = qt.QPushButton('Download')
        self.downloadButton.connect('clicked(bool)', self.onDownloadButton)
        dockerForm.addRow("Docker Executable Path:", self.dockerPath)
        dockerForm.addRow("Download the docker image:", self.downloadButton)
        self.progressDownload = qt.QProgressBar()
        self.progressDownload.setRange(0, 100)
        self.progressDownload.setValue(0)
        self.progressDownload.hide()

        self.dockerVolumePath = ctk.ctkPathLineEdit()
        defaultVolumePath = os.path.join(expanduser("~"), ".dockerVolume")
        if not os.path.exists(defaultVolumePath):
            os.makedirs(defaultVolumePath)
        self.dockerVolumePath.setCurrentPath(defaultVolumePath)
        dockerForm.addRow("Docker Volume Directory:", self.dockerVolumePath)

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

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

        #
        # input volume selector
        #
        self.inputVolumeSelector = slicer.qMRMLNodeComboBox()
        self.inputVolumeSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.inputVolumeSelector.selectNodeUponCreation = True
        self.inputVolumeSelector.addEnabled = False
        self.inputVolumeSelector.removeEnabled = False
        self.inputVolumeSelector.noneEnabled = False
        self.inputVolumeSelector.showHidden = False
        self.inputVolumeSelector.showChildNodeTypes = False
        self.inputVolumeSelector.setMRMLScene(slicer.mrmlScene)
        self.inputVolumeSelector.setCurrentNode(None)
        self.inputVolumeSelector.setToolTip("Pick the input to the algorithm.")
        parametersFormLayout.addRow("Input Volume: ", self.inputVolumeSelector)

        #
        # Apply Button
        #
        self.applyButton = qt.QPushButton("Generate Probablity Map")
        self.applyButton.toolTip = "Generate the probablity map."
        self.applyButton.enabled = False
        parametersFormLayout.addRow(self.applyButton)

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

        #
        # threshold value
        #
        self.imageThresholdSliderWidget = ctk.ctkSliderWidget()
        self.imageThresholdSliderWidget.singleStep = 0.01
        self.imageThresholdSliderWidget.minimum = 0.5
        self.imageThresholdSliderWidget.maximum = 1.0
        self.imageThresholdSliderWidget.value = 0.9
        self.imageThresholdSliderWidget.setToolTip(
            "Set threshold value for computing the output image. Voxels that have intensities lower than this value will set to zero."
        )
        parametersFormLayout.addRow("Image threshold",
                                    self.imageThresholdSliderWidget)

        self.createVesselModelButton = qt.QPushButton("Create Vessel Model")
        self.createVesselModelButton.toolTip = "Generate the vessel model."
        self.createVesselModelButton.enabled = False
        parametersFormLayout.addRow(self.createVesselModelButton)

        # connections
        self.applyButton.connect('clicked(bool)', self.onApplyButton)
        self.createVesselModelButton.connect('clicked(bool)',
                                             self.onCreateModelWithThreshold)
        self.inputVolumeSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                         self.onSelectVolume)
        self.outputModelSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                         self.onSelectModel)

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

        self.logic = DockerVesselSegLogic()
Exemple #13
0
    def __init__(self, hassub, parent=None):
        Progress.__init__(self)
        qt.QDialog.__init__(self, parent)

        self._hassub = hassub
        self._shorturl = ShortURL(50)
        self._ticking = False
        self._stopticking = False
        self._fetcher = None

        self._beenshown = False
        self._mainthread = None

        if hassub:
            self.setMinimumSize(500, 400)
        else:
            self.setMinimumSize(300, 80)

        self.setIcon(getPixmap("smart"))
        self.setCaption(_("Operation Progress"))

        vbox = qt.QVBoxLayout(self, 10, 10)
        vbox.setResizeMode(qt.QLayout.FreeResize)
        vbox.setMargin(10)
        vbox.setSpacing(10)

        self._topic = qt.QLabel(self)
        vbox.addWidget(self._topic)

        self._progressbar = qt.QProgressBar(self)
        self._progressbar.setPercentageVisible(True)
        self._progressbar.show()
        vbox.addWidget(self._progressbar)

        if hassub:
            self._listview = qt.QListView(self)
            self._listview.setSorting(-1, False)
            self._listview.setSelectionMode(qt.QListView.NoSelection)
            self._listview.show()
            vbox.addWidget(self._listview)

            column = self._listview.addColumn(_("Progress"))
            self._listview.setColumnWidthMode(column, qt.QListView.Manual)
            self._listview.setColumnWidth(column, 55)
            column = self._listview.addColumn(_("Current"))
            self._currentcolumn = column
            column = self._listview.addColumn(_("Total"))
            self._totalcolumn = column
            column = self._listview.addColumn(_("Speed"))
            self._speedcolumn = column
            column = self._listview.addColumn(_("ETA"))
            self._etacolumn = column
            column = self._listview.addColumn(_("Description"))
            self._listview.setColumnWidthMode(column, qt.QListView.Manual)
            self._listview.setColumnWidth(column, 165)
            self._desccolumn = column

            self._subiters = {}
            self._subindex = 0

            self._bbox = qt.QHBox(self)
            self._bbox.setSpacing(10)
            self._bbox.layout().addStretch(1)
            vbox.addWidget(self._bbox)

            button = qt.QPushButton(_("Cancel"), self._bbox)
            button.show()
            qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._cancel)
Exemple #14
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # 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)

        # Seletor do primeiro volume TOF
        self.firstSelector = slicer.qMRMLNodeComboBox()
        self.firstSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.firstSelector.selectNodeUponCreation = True
        self.firstSelector.addEnabled = False
        self.firstSelector.removeEnabled = False
        self.firstSelector.noneEnabled = False
        self.firstSelector.showHidden = False
        self.firstSelector.showChildNodeTypes = False
        self.firstSelector.setMRMLScene(slicer.mrmlScene)
        self.firstSelector.setToolTip("Insira o exame mais antigo.")
        parametersFormLayout.addRow("Primeiro exame: ", self.firstSelector)

        # Seletor da ROI (LabelMap)
        self.ROISelector = slicer.qMRMLNodeComboBox()
        self.ROISelector.nodeTypes = ["vtkMRMLLabelMapVolumeNode"]
        self.ROISelector.selectNodeUponCreation = True
        self.ROISelector.addEnabled = False
        self.ROISelector.removeEnabled = False
        self.ROISelector.noneEnabled = True
        self.ROISelector.showHidden = False
        self.ROISelector.showChildNodeTypes = False
        self.ROISelector.setMRMLScene(slicer.mrmlScene)
        self.ROISelector.setToolTip("Insira A ROI.")
        parametersFormLayout.addRow("ROI: ", self.ROISelector)

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

        # Progress Bar
        self.progressBar = qt.QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(0)
        self.progressBar.setVisible(False)
        parametersFormLayout.addRow(self.progressBar)

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

        # connections
        self.applyButton.connect('clicked(bool)', self.onApplyButton)
        self.firstSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                   self.onSelect)
        self.ROISelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                 self.onSelect)

        # Refresh Apply button state
        self.onSelect()
Exemple #15
0
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        # Instantiate and connect widgets ...
        # Parameters Area
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "Parametros"
        self.layout.addWidget(parametersCollapsibleButton)

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

        # input volume selector
        self.baseSelector = slicer.qMRMLNodeComboBox()
        self.baseSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        self.baseSelector.selectNodeUponCreation = False
        self.baseSelector.addEnabled = False
        self.baseSelector.removeEnabled = False
        self.baseSelector.noneEnabled = False
        self.baseSelector.showHidden = False
        self.baseSelector.showChildNodeTypes = False
        self.baseSelector.setMRMLScene(slicer.mrmlScene)
        self.baseSelector.setToolTip("Volume base para comparacao")
        parametersFormLayout.addRow("Volume Base: ", self.baseSelector)

        # input fiducial selector
        self.fiducialSelector = slicer.qMRMLNodeComboBox()
        self.fiducialSelector.nodeTypes = ["vtkMRMLMarkupsFiducialNode"]
        self.fiducialSelector.selectNodeUponCreation = True
        self.fiducialSelector.addEnabled = False
        self.fiducialSelector.removeEnabled = False
        self.fiducialSelector.noneEnabled = False
        self.fiducialSelector.showHidden = False
        self.fiducialSelector.showChildNodeTypes = False
        self.fiducialSelector.setMRMLScene(slicer.mrmlScene)
        self.fiducialSelector.setToolTip(
            "Ponto fiducial base para criacao da ROI")
        parametersFormLayout.addRow("Ponto Fiducial: ", self.fiducialSelector)

        # Buttons
        self.setROIButton = qt.QPushButton("Criar ROI")
        self.setROIButton.toolTip = ""
        self.setROIButton.enabled = False
        parametersFormLayout.addRow(self.setROIButton)

        self.applyButton = qt.QPushButton("Iniciar")
        self.applyButton.toolTip = "Executar."
        self.applyButton.enabled = False
        parametersFormLayout.addRow(self.applyButton)

        # Progress Bar
        self.progressBar = qt.QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(0)
        self.progressBar.setVisible(False)
        parametersFormLayout.addRow(self.progressBar)

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

        # connections
        self.applyButton.connect('clicked(bool)', self.onApplyButton)
        self.setROIButton.connect('clicked(bool)', self.createROI)
        self.fiducialSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                      self.onSelect)
        self.baseSelector.connect("currentNodeChanged(vtkMRMLNode*)",
                                  self.setBackground)

        # Refresh Apply button state
        self.onSelect()
    def setup(self):
        ScriptedLoadableModuleWidget.setup(self)

        self.setupViewSettingsArea()

        # Setup a logger for the extension log messages
        self.logger = logging.getLogger('SlicerCaseIterator')

        self.logic = None

        # These variables hold connections to other parts of Slicer, such as registered keyboard shortcuts and
        # Event observers
        self.shortcuts = []
        self.observers = []

        # Instantiate and connect widgets ...

        #
        # ComboBox for mode selection
        #
        self.modeGroup = qt.QGroupBox("Mode Selection")
        self.modeGroup.setLayout(qt.QFormLayout())
        self.layout.addWidget(self.modeGroup)

        modes = IteratorFactory.getImplementationNames()
        self.modeComboBox = qt.QComboBox()
        self.modeComboBox.addItems([""] + modes)
        self.modeGroup.layout().addWidget(self.modeComboBox)

        #
        # Select and Load input data section
        #
        self.inputDataCollapsibleButton = ctk.ctkCollapsibleButton()
        self.inputDataCollapsibleButton.text = 'Select and Load case data'
        self.layout.addWidget(self.inputDataCollapsibleButton)

        #
        # Parameters Area
        #
        self.parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        self.parametersCollapsibleButton.text = 'Case iteration parameters'
        self.layout.addWidget(self.parametersCollapsibleButton)

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

        #
        # Reader Name
        #
        self.txtReaderName = qt.QLineEdit()
        self.txtReaderName.text = ''
        self.txtReaderName.toolTip = 'Name of the current reader; if not empty, this name will be added to the filename ' \
                                     'of saved masks'
        parametersFormLayout.addRow('Reader name', self.txtReaderName)

        #
        # Start position
        #
        self.npStart = qt.QSpinBox()
        self.npStart.minimum = 1
        self.npStart.maximum = 999999
        self.npStart.value = 1
        self.npStart.toolTip = 'Start position in the CSV file (1 = first patient)'
        parametersFormLayout.addRow('Start position', self.npStart)

        #
        # Visualization Properties
        #
        self.visualizationPropertiesCollapsibleButton = ctk.ctkCollapsibleButton(
        )
        self.visualizationPropertiesCollapsibleButton.text = 'Visualization properties'
        self.layout.addWidget(self.visualizationPropertiesCollapsibleButton)

        visualizationPropertiesFormLayout = qt.QVBoxLayout(
            self.visualizationPropertiesCollapsibleButton)

        #
        # Mask Groupbox
        #
        self.maskGroup = qt.QGroupBox("Mask")
        self.maskGroup.setLayout(qt.QFormLayout())
        visualizationPropertiesFormLayout.addWidget(self.maskGroup)

        self.sliceFill2DSlider = slicer.qMRMLSliderWidget()
        self.sliceFill2DSlider.minimum = 0.0
        self.sliceFill2DSlider.maximum = 1.0
        self.sliceFill2DSlider.singleStep = 0.1
        self.maskGroup.layout().addRow("Slice 2D fill:",
                                       self.sliceFill2DSlider)

        self.sliceOutline2DSlider = slicer.qMRMLSliderWidget()
        self.sliceOutline2DSlider.minimum = 0.0
        self.sliceOutline2DSlider.maximum = 1.0
        self.sliceOutline2DSlider.singleStep = 0.1
        self.sliceOutline2DSlider.value = 1.0
        self.maskGroup.layout().addRow("Slice 2D outline:",
                                       self.sliceOutline2DSlider)

        #
        # Progressbar
        #
        self.progressBar = qt.QProgressBar()
        self.progressBar.setFormat("%v/%m")
        self.progressBar.visible = False
        self.layout.addWidget(self.progressBar)

        #
        # Case Button Row
        #
        self.caseButtonWidget = qt.QWidget()
        self.caseButtonWidget.setLayout(qt.QHBoxLayout())
        self.layout.addWidget(self.caseButtonWidget)

        #
        # Reset
        #
        self.resetButton = qt.QPushButton('Start Batch')
        self.resetButton.enabled = False
        self.caseButtonWidget.layout().addWidget(self.resetButton)

        #
        # Previous Case
        #
        self.previousButton = qt.QPushButton('Previous Case')
        self.previousButton.enabled = False
        self.previousButton.toolTip = '(Ctrl+P) Press this button to go to the previous case, previous new masks are not reloaded'
        self.caseButtonWidget.layout().addWidget(self.previousButton)

        #
        # Load CSV / Next Case
        #
        self.nextButton = qt.QPushButton('Next Case')
        self.nextButton.enabled = False
        self.nextButton.toolTip = '(Ctrl+N) Press this button to go to the next case'
        self.caseButtonWidget.layout().addWidget(self.nextButton)

        #
        # Collapsible Button group for enabling only one at a time
        #
        self.collapsibleButtonGroup = qt.QButtonGroup()
        self.collapsibleButtonGroup.setExclusive(True)
        self.collapsibleButtonGroup.addButton(self.inputDataCollapsibleButton)
        self.collapsibleButtonGroup.addButton(self.parametersCollapsibleButton)
        self.collapsibleButtonGroup.addButton(
            self.visualizationPropertiesCollapsibleButton)

        self.layout.addStretch(1)

        #
        # Connect buttons to functions
        #
        self.modeComboBox.currentTextChanged.connect(self.onModeSelected)
        self.previousButton.connect('clicked(bool)', self.onPrevious)
        self.nextButton.connect('clicked(bool)', self.onNext)
        self.resetButton.connect('clicked(bool)', self.onReset)
        self.sliceFill2DSlider.valueChanged.connect(
            lambda value: self.updateSegmentationProperties())
        self.sliceOutline2DSlider.valueChanged.connect(
            lambda value: self.updateSegmentationProperties())

        if len(modes) == 1:
            self.modeComboBox.hide()
            self.onModeSelected(modes[1])

        self._setGUIstate(csv_loaded=False)