imfun.filt¶
- imfun.filt.adaptive_medianf(arr, k=2)¶
Perform adaptive median filtering on 2D array arr, by setting pixels to 3x3 local median if their value exceeds k times standard deviation over 3x3 neighborhood.
TODO: convert to Ndimensions, and make it run faster
- imfun.filt.baseline_als(y, lam, p, niter=10)¶
Implements an Asymmetric Least Squares Smoothing baseline correction algorithm (P. Eilers, H. Boelens 2005)
- imfun.filt.bspline_smooth(sig, phi=<Mock name='mock.array()' id='140508896700432'>)¶
Smooth signal sig by 1D convolution with a cubic b-spline
see imfun.atrous.smooth and imfun.atrous.wavelet_denoise for more variants
- imfun.filt.gauss_blur(X, size=1.0)¶
Return 2D Gauss blurred array X with a kernel of size size
- imfun.filt.gauss_kern(xsize=1.5, ysize=None)¶
Return a normalized 2D gauss kernel for convolutions
- Parameters:
- xsize:
, standard deviation for x dimension - ysize:
, standard deviation for y dimension
- xsize:
- Returns:
- g : the 2D kernel as an array
- imfun.filt.gauss_kern1d(size=1.5)¶
Given variance size, return 1D kernel
- imfun.filt.gauss_smooth(sig, sigma=1.0, dt=1.0, order=0)¶
Perform Gauss smoothing (blurring) on signal sig
- Parameters:
- sig: an N-dimensional signal (vector, matrix, ...)
- sigma: standard deviation of the Gauss filter
- dt: sampling coefficient
- order: order of the Gaussian function
- Returns:
- blurred copy of sig
- See also:
- Uses functions scipy.ndimage.gaussian_filter and scipy.ndimage.gaussian_filter1d
- imfun.filt.kalman_stack_filter(frames, seed='mean', gain=0.5, var=0.05)¶
Kalman stack filter similar to that of Imagej
- frames: array_like, e.g. nframes x nrows x ncolumns array or list of 2D
images
- seed: {‘mean’ | ‘first’ | 2D array}
the seed to start with, defaults to the time-average of all frames, if ‘first’, then the first frame is used, if 2D array, this array is used as the seed
gain: overall filter gain
var: estimated environment noise variance
- new frames, an nframes x nrows x ncolumns array with filtered frames
- imfun.filt.mavg_DFoF(v, tau=90.0, dt=1.0)¶
Normalize signal v as
with smoothing- Parameters:
- v: input signal
- tau: characteristic time of the smoothing function
- dt: sampling interval
- Returns:
- v/smooth(v) - 1
- imfun.filt.mavg_DFoSD(v, tau=90.0, dt=1.0)¶
Normalize signal v as standard score
with smoothing- Parameters:
- v: input signal
- tau: characteristic time of the smoothing function
- dt: sampling interval
- Returns: Standard score
- (v-smooth(v))/S.D.(smooth(v))
- imfun.filt.opening_of_closing(a)¶
Return binary opening of binary closing of an array
- imfun.filt.test_kalman_stack_filter()¶
just tests if kalman_stack_filter function runs