normalizeLPF - Normalize by Low-pass filter
Normalizes image time series using low-pass filter
Description
This function can be used to normalise channels (ΔF/F or ΔR/R), or to do a low-pass filtering.
Input
This function accepts image time series with dimensions Y, X and T, or image time series split by events with dimensions Y, X, T and E, either as a numeric array or as a .dat file. UMT structs and .umt files are not supported.
A .dat input is streamed in slabs (Low-RAM mode), so the recording is never loaded whole. Event-split data are filtered trial by trial along T and keep their E dimension unchanged.
The algorithm
This function applies low pass filters at two cut-off frequencies (set in the function's parameters). Then, these two low-passed signals are either subtracted or divided which results in the normalized signal (R) expressed as ΔR or ΔR/R, respectively.
The function applies a 4th-order low-pass Butterworth filter with 3dB cut-off frequencies freqHigh and freqLow. This yields two low-passed signals S_lwpfreqHigh and S_lwpfreqLow. Then, if the parameter Normalize is set to True, the signals are divided as:
otherwise, the signals are subtracted:
Output
The output has the same axes and sizes as the input and the same representation: a numeric array for an array input, or the normLPF.dat file (saved in the save folder) for a .dat input.
Note
For arrays held in RAM, NaN pixels are replaced by zero before filtering and restored afterwards. This biases the low-pass baseline near mask borders and, with Normalize set to true, can produce a near-zero divisor there. .dat inputs do not use this replacement.
Parameters
The parameter of this function are the following:
Sets the value (in Hertz) of the low frequency cut-off, used to estimate the slow baseline component.
The BaselineCutoffHz value ranges from zero to the Nyquist (half the sample rate).
Note
If this value is set to zero, the output will be a low-passed signal at cut-off frequency SignalCutoffHz.
Sets the value (in Hertz) of the high frequency cut-off, used to preserve the signal component.
The SignalCutoffHz value must be a positive number between the BaselineCutoffHz value and the Nyquist (half the sample rate).
Sets this parameter to True (default) to return the output signal (R) as ΔR/R, otherwise set to False to return the output signal as ΔR (see the algorithm) sections for details).
Set this parameter to True to apply a double exponential fit to the input signal prior to the filtering. In the majority of cases, this is not necessary. However, in cases where the temperature of the illumination source of the imaging system is poorly managed, a signal decay may occur. Thus, the exponential fit can be applied to fix this issue.
For event-split data, each trial gets its own exponential fit.
Frame rate (in Hertz) of the input data, needed to design the filters. When the function runs in a pipeline, the value is taken from the data flowing into the step, and a .dat input provides it through its header. It must be given explicitly only for numeric array inputs.