示例#1
0
    def __init__(self, data, parent=None, liveplot=None):

        # Init Feature
        Feature.__init__(self, 'Baseline', data, parent, liveplot)

        self.liveplot_container, self.liveplot = self.liveplot

        # data
        self.input = {'y': None, 'object_source': None}
        self.output = {'baseline': None, 'y': None}

        # methods
        # 1 Polynomial Fitting
        self.addMethod('Polynomial Fitting', bl_polynomial_fitting_params, self.polyFit)
        self.markerItems = []
        # 2 Asymmetric Least Squares
        self.addMethod('Asymmetric Least Squares', bl_asymmetric_ls_params, self.alsWrapper)
        # 3 Top Hat
        self.addMethod('Top Hat', bl_top_hat_params, self.topHatWrapper)
        # 4 Moving Average
        self.addMethod('Moving Average', bl_moving_average_params, self.movingAverageWrapper)

        self.activateFunc = self.showMarkers

        self.initMethodUI()
        self.initParametersUI()
示例#2
0
 def __init__(self, name: str, description: str, count_index: int):
     Feature.__init__(self,
                      name=name,
                      description=description,
                      count_index=count_index)
     self._wavelength_count = 0
     self._count = 0
示例#3
0
 def __init__(self, name: str, description: str, count_index: int):
     Feature.__init__(self,
                      name=name,
                      description=description,
                      count_index=count_index)
     self._amplitude_count = 0
     self._count = 0
示例#4
0
    def __init__(self, data, parent=None, liveplot=None):

        # Init Feature
        Feature.__init__(self, 'Background Subtraction', data, parent,
                         liveplot)

        # data
        self.input = {
            'y': None,
            'roi_params': None,
            'roi_image': None,
            'cell': None,
            'roi_ellipse_mode': None
        }
        self.output = {'background mean': None, 'y': None}

        self.imv = self.liveplot
        self.activateFunc = self.showGUI

        ## METHODS ##

        # 1 ROI Background Subtraction
        self.addMethod('ROI', bs_roi_params, self.ROIBackgroundSubtraction)

        # 2 Perisomatic Background Subtraction
        self.addMethod('Perisomatic', bs_perisomatic_params,
                       self.perisomaticBackgroundSubtraction)

        self.initMethodUI()
        self.initParametersUI()

        self.undisplayPlots()
示例#5
0
    def __init__(self, data, parent=None, liveplot=None):

        # Init Feature
        Feature.__init__(self, 'Event Shape', data, parent, liveplot)

        # data
        self.input = {
            'y': None,
            'burst_time': None,
            'spike_time': None,
            'object_source_frequency': None
        }
        self.output = {
            'shapes': None,
            'mean shape': None,
            'mean shape smoothed': None
        }

        ## METHODS ##

        # 1 Mean Amplitude
        self.addMethod('Spike Shape', es_params, self.spikeShapeCalculation)
        self.addMethod('Burst Shape', es_params, self.burstShapeCalculation)

        self.initMethodUI()
        self.initParametersUI()
示例#6
0
    def __init__(self, data, parent=None, liveplot=None):
        # Init Feature
        Feature.__init__(self,
                         'Cell Selection',
                         data,
                         parent,
                         liveplot,
                         display_name_label=False)

        self.data_manager = data
        self.data_manager.cell_selection = self

        self.setMinimumSize(350, 450)

        self.allowEditROI = True
        self.disabled_roi_handles = []
        self.preview_mode = True
        self.show_user_roi = False
        self.ellipse_mode = True
        self.update_on_ellipse_mode_change = True

        # data
        self.input = {'source': None, 'roi_ellipse_mode': None}
        self.output = {'cell': None, 'cell mean': None, 'roi': None}

        # view / plot
        self.imv = ImageView()
        self.imv.setMinimumHeight(450)
        self.layout.addWidget(self.imv)
        self.imv.view.mouseClickEvent = lambda ev: self.imvViewMouseClickEvent(
            self.imv.view, ev)
        self.imv.view.raiseContextMenu = lambda ev: self.imvViewRaiseContextMenu(
            self.imv.view, ev)
        self.imv.view.getContextMenus = lambda ev=None: self.imvViewGetContextMenus(
            self.imv.view, ev)

        self.imv.view.preview_mode = self.imv.view.menu.addAction(
            'live preview mode')
        self.imv.view.preview_mode.setCheckable(True)
        self.imv.view.preview_mode.setChecked(self.preview_mode)
        self.imv.view.preview_mode.triggered.connect(self.switchPreviewMode)

        self.imv.view.ellipse_mode = self.imv.view.menu.addAction(
            'ellipse mode')
        self.imv.view.ellipse_mode.setCheckable(True)
        self.imv.view.ellipse_mode.setChecked(self.ellipse_mode)
        self.connectEllipseMode()

        # methods
        self.addMethod('ROI', cs_roi_params, self.calculateROI)
        self.initMethodUI()
        self.initParametersUI()

        self.show()
        """
        the image must be displayed once such that the roicurve is created and can be shown
        even if the user loads a non-TIF source before he loads a TIF source.
        """
        self.imv.setImage(np.zeros((1, 10, 10)), xvals=np.arange(10))
        self.imv.clear()
 def __init__(self, name: str, description: str, count_index: int):
     Feature.__init__(self,
                      name=name,
                      description=description,
                      count_index=count_index)
     self._latest_complete_lvl8 = None
     self._latest_complete_lvl16 = None
     self._latest_answer_Q0 = None
     self._latest_answer_Q2 = None
     self._answer_time = None
示例#8
0
    def __init__(self, data, parent=None, liveplot=None):

        # Init Feature
        Feature.__init__(self, 'Spike Detection', data, parent, liveplot)

        # data
        self.input = {
            'y': None,
            'object_source_frequency': None,
            'object_noise_std': None
        }
        self.output = {
            'time': None,
            'amplitude': None,
            'train': None,
            'spike frequency': None,
            'mean amplitude': None,
            'τDecay': None,
            'mean τDecay': None
        }

        # dialog for averages
        self.showBtn = QtWidgets.QPushButton('Show quantities')
        self.showBtn.clicked.connect(self.showQuantities)
        self.layout.addWidget(self.showBtn)
        self.dialog = QtWidgets.QDialog(self,
                                        flags=QtCore.Qt.WindowTitleHint
                                        | QtCore.Qt.WindowCloseButtonHint)
        self.dialog.setWindowTitle(self.name + ' -- Quantities')
        self.dialog_table = QtWidgets.QTableWidget(self.dialog)
        self.dialog_table.horizontalHeader().hide()
        self.dialog_table.verticalHeader().hide()
        self.dialog_table.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.ResizeToContents)
        self.dialog_table.setRowCount(3)
        self.dialog_table.setColumnCount(2)
        self.dialog_table.setItem(0, 0,
                                  QtWidgets.QTableWidgetItem('mean amplitude'))
        self.dialog_table.setItem(
            1, 0, QtWidgets.QTableWidgetItem('spike frequency (#spikes / s)'))
        self.dialog_table.setItem(2, 0,
                                  QtWidgets.QTableWidgetItem('mean τDecay'))
        self.dialog_layout = QtWidgets.QGridLayout(self.dialog)
        self.dialog.setLayout(self.dialog_layout)
        self.dialog.layout().addWidget(self.dialog_table)
        ## METHODS ##
        self.addMethod('Threshold', sd_params, self.spikeUpdate)

        self.initMethodUI()
        self.initParametersUI()
示例#9
0
    def __init__(self,
                 data,
                 name,
                 input_data_name,
                 parent=None,
                 liveplot=None,
                 step_mode=False):

        # Init Feature
        Feature.__init__(self, name, data, parent, liveplot)

        self.input_data_name = input_data_name
        self.step_mode = step_mode

        # data
        self.output = {
            'xrange': None,
            'correlation': None,
            'coefficient': None,
            'delay': None,
            'delay coefficient': None
        }

        self.showBtn = QtWidgets.QPushButton(
            'Show Correlation Coefficients and Main Lags', self)
        self.showBtn.clicked.connect(self.showCoefficients)
        self.layout.addWidget(self.showBtn)
        self.dialog = QtWidgets.QDialog(self,
                                        flags=QtCore.Qt.WindowTitleHint
                                        | QtCore.Qt.WindowCloseButtonHint)
        self.dialog.setWindowTitle(
            self.name + ' -- Correlation Coefficients and Main Lags')
        self.dialog_table_coefficients = QtWidgets.QTableWidget(self.dialog)
        self.dialog_table_delay = QtWidgets.QTableWidget(self.dialog)
        self.dialog_table_delay_coefficients = QtWidgets.QTableWidget(
            self.dialog)
        self.dialog_layout = QtWidgets.QGridLayout(self.dialog)
        self.dialog.setLayout(self.dialog_layout)
        self.dialog.layout().addWidget(
            QtWidgets.QLabel('Correlation Coefficients'))
        self.dialog.layout().addWidget(self.dialog_table_coefficients)
        self.dialog_mainlag_layout = QtWidgets.QLabel()
        self.dialog.layout().addWidget(self.dialog_mainlag_layout)
        self.dialog.layout().addWidget(self.dialog_table_delay)
        self.dialog_table_delay_coefficients_label = QtWidgets.QLabel(
            'Correlation Coefficients at Main Lags')
        self.dialog.layout().addWidget(
            self.dialog_table_delay_coefficients_label)
        self.dialog.layout().addWidget(self.dialog_table_delay_coefficients)
示例#10
0
    def __init__(self, data, parent=None, liveplot=None):
        
        Feature.__init__(self, 'Movement Correction', data, parent, liveplot, display_name_label=False)

        self.input = {'source':None}
        self.output = {'source':None}

        self.addMethod('Movement Correction', mc_params, self.movementCorrection)
        
        self.initMethodUI()
        self.initParametersUI()

        self.symmetric_diffeomorphic_option = 'Symmetric Diffeomorphic'

        self.options = [
            ('None [original image]', None),
            (self.symmetric_diffeomorphic_option, None),
            ('Translation', StackReg.TRANSLATION),
            ('Rigid Body', StackReg.RIGID_BODY),
            ('Scaled Rotation', StackReg.SCALED_ROTATION),
            ('Affine', StackReg.AFFINE)
        ]

        self.calculated = []

        compare_layout = QtWidgets.QGridLayout()
        compare_layout.setSpacing(0)
        compare_layout.setMargin(0)
        compare_layout_widget = QtWidgets.QWidget()
        self.layout.addWidget(compare_layout_widget)
        compare_layout_widget.setLayout(compare_layout)
        compare_layout.addWidget(QtWidgets.QLabel('Correction: '), 0, 0)
        compare_layout.addWidget(QtWidgets.QLabel('Compare to: '), 1, 0)
        self.correction_combobox = QtWidgets.QComboBox()
        compare_layout.addWidget(self.correction_combobox, 0, 1)
        self.compare_combobox = QtWidgets.QComboBox()
        compare_layout.addWidget(self.compare_combobox, 1, 1)

        for type_, _ in self.options:
            self.correction_combobox.addItem(type_)
            self.compare_combobox.addItem(type_)
            self.calculated.append(None)

        self._connectComboboxes()
示例#11
0
    def __init__(self, data, parent=None, liveplot=None):

        # Init Feature
        Feature.__init__(self, 'Power Spectrum', data, parent, liveplot)

        # data
        self.input = {'y': None, 'object_source_frequency': None}
        self.output = {
            'frequencies': None,
            'psd': None,
            'max power': None,
            'max power frequency': None
        }

        # methods
        self.addMethod('Fast Fourier Transform', fs_fft_params,
                       self.updateFourier)
        self.initMethodUI()
        self.initParametersUI()
示例#12
0
    def __init__(self, data, parent=None, liveplot=None):

        # Init Feature
        Feature.__init__(self, 'Smoothing', data, parent, liveplot)

         # data
        self.input = {'y':None, 'object_source_frequency':None}
        self.output = {'y':None, 'noise_std': None}

        # methods
        # 1 Savitzky Golay
        self.addMethod('Savitzky Golay', sg_savitzky_golay_params, self.updateSGData)
        # 2 Moving Average
        self.addMethod('Moving Average', sg_moving_average_params, self.movingAverageWrapper)
        # 3 Butterworth
        self.addMethod('Butterworth', sg_butterworth_params, self.butter_lowpass_filter_wrapper)
        # 4 Scaled Window Convolution
        self.addMethod('Scaled Window Convolution', sg_scaled_window_convolution_params, self.scaled_window_convolution)

        self.initMethodUI()
        self.initParametersUI()
示例#13
0
    def __init__(self, data, parent=None, liveplot=None):

        Feature.__init__(self,
                         'Adjust Frequency',
                         data,
                         parent,
                         liveplot,
                         display_name_label=False)

        self.input = {'y': None, 'object_source_af_params': None}
        self.output = {'y': None}

        self.addMethod('Nearest Neighbour', af_params,
                       self.nearestNeighbourWrapper)
        self.addMethod('Linear', af_params, self.linearWrapper)
        self.addMethod('Cubic', af_params, self.cubicWrapper)

        self.initMethodUI()
        self.initParametersUI()

        # disconnect the usual method because we dont want updates when the method is changed, only graphic updates.
        self.disconnectMethodCombo()
        self.method_combo.currentIndexChanged.connect(self.updateParametersUI)
 def __init__(self, name:str, description:str, count_index:int):
     Feature.__init__(self, name=name, description=description, count_index=count_index)
     self._answer = None
 def __init__(self, name:str, description:str):
     Feature.__init__(self, name=name, description=description, count_index=0)
 def __init__(self, name:str, description:str, count_index:int):
     Feature.__init__(self, name=name, description=description, count_index=count_index)
     self._offset_count = 0
     self._good_count = 0