Skip to content
Snippets Groups Projects
LaunchBatchPrediction.py 2.38 KiB
Newer Older
  • Learn to ignore specific revisions
  • lpbsscientist's avatar
    lpbsscientist committed
    # -*- coding: utf-8 -*-
    """
    Created on Tue Nov 19 17:38:58 2019
    """
    
    
    mattminder's avatar
    mattminder committed
    from PyQt5.QtWidgets import (QDialog, QDialogButtonBox, QLineEdit, QFormLayout, 
                                 QLabel, QListWidget, QAbstractItemView, QCheckBox)
    
    lpbsscientist's avatar
    lpbsscientist committed
    from PyQt5 import QtGui
    
    
    mattminder's avatar
    mattminder committed
    
    class CustomDialog(QDialog):
    
    lpbsscientist's avatar
    lpbsscientist committed
        def __init__(self, *args, **kwargs):
            super(CustomDialog, self).__init__(*args, **kwargs)
            
            app, = args
            maxtimeindex = app.reader.sizet
            
            self.setWindowTitle("Launch NN")
            self.setGeometry(100,100, 500,200)
            
            self.entry1 = QLineEdit()
            self.entry1.setValidator(QtGui.QIntValidator(0,int(maxtimeindex-1)))
            self.entry2 = QLineEdit()
            self.entry2.setValidator(QtGui.QIntValidator(0,int(maxtimeindex-1)))
            
    
    mattminder's avatar
    mattminder committed
            # FOV dialog
    
    lpbsscientist's avatar
    lpbsscientist committed
            self.listfov = QListWidget()
            self.listfov.setSelectionMode(QAbstractItemView.MultiSelection)
            for f in range(0, app.reader.Npos):
                self.listfov.addItem('Field of View {}'.format(f+1))
    
            self.labeltime = QLabel("Enter range ({}-{}) for time axis".format(0, app.reader.sizet-1))
            
            self.entry_threshold = QLineEdit()
            self.entry_threshold.setValidator(QtGui.QDoubleValidator())
    
    lpbsscientist's avatar
    lpbsscientist committed
            self.entry_threshold.setText('0.5')
            
    
    lpbsscientist's avatar
    lpbsscientist committed
            self.entry_segmentation = QLineEdit()
            self.entry_segmentation.setValidator(QtGui.QIntValidator())
    
    lpbsscientist's avatar
    lpbsscientist committed
            self.entry_segmentation.setText('10')
            
            self.tracking_checkbox = QCheckBox()
    
            self.tracking_checkbox.setChecked(True)
    
    lpbsscientist's avatar
    lpbsscientist committed
            flo = QFormLayout()
            flo.addWidget(self.labeltime)
            flo.addRow('Lower Boundary for time axis', self.entry1)
    
    mattminder's avatar
    mattminder committed
            flo.addRow('Upper Boundary for time axis', self.entry2)        
    
    lpbsscientist's avatar
    lpbsscientist committed
            flo.addRow('Select Field(s) of fiew from  the list', self.listfov)
    
    lpbsscientist's avatar
    lpbsscientist committed
            flo.addRow('Enter a threshold value', self.entry_threshold)
            flo.addRow('Enter a segmentation value', self.entry_segmentation)
    
    lpbsscientist's avatar
    lpbsscientist committed
            flo.addRow('Apply Cell Tracker', self.tracking_checkbox)
            
    
    lpbsscientist's avatar
    lpbsscientist committed
            QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
            
            self.buttonBox = QDialogButtonBox(QBtn)
            self.buttonBox.accepted.connect(self.accept)
            self.buttonBox.rejected.connect(self.reject)
    
            flo.addWidget(self.buttonBox)
            self.setLayout(flo)