trackpy.preprocessing.bandpass¶
- trackpy.preprocessing.bandpass(image, lshort, llong, threshold=None, truncate=4)¶
Remove noise and background variation.
Convolve with a Gaussian to remove short-wavelength noise and subtract out long-wavelength variations by subtracting a running average. This retains features of intermediate scale.
The lowpass implementation relies on scipy.ndimage.filters.gaussian_filter, and it is the fastest way known to the authors of performing a bandpass in Python.
- Parameters:
- imagendarray
- lshortnumber or tuple
Size of the gaussian kernel with which the image is convolved. Provide a tuple for different sizes per dimension.
- llonginteger or tuple
The size of rolling average (square or rectangular kernel) filter. Should be odd and larger than the particle diameter. When llong <= lshort, an error is raised. Provide a tuple for different sizes per dimension.
- thresholdfloat or integer
Clip bandpass result below this value. Thresholding is done on the already background-subtracted image. By default, 1 for integer images and 1/255 for float images.
- truncatenumber, optional
Determines the truncation size of the gaussian kernel. Default 4.
- Returns:
- resultarray
the bandpassed image
See also
lowpass
,boxcar
,legacy_bandpass
,legacy_bandpass_fftw
Notes
The boxcar size and shape changed in v0.4: before, the boxcar had a circular kernel with radius llong, now it is has a square kernel that has an edge length of llong (twice as small!).