spectral_unmixing.apply_filtersο
- spectral_unmixing.apply_filters(stack, filters, *, filters_channel2=None, median_size=3, gaussian_sigma=1.0, median_size_channel2=None, gaussian_sigma_channel2=None, apply_3d=False)[source]ο
Apply one or more filters to a microscopy stack.
- Parameters:
stack (array-like) β Input stack in canonical
TZCYXorder, or a simplerZYX/YXarray.filters (str or sequence of str) β Either a single filter name or a sequence such as
["median", "gaussian"]. Filters are applied in the order provided.filters_channel2 (str or sequence of str or None, optional) β Optional filter sequence applied only to the second channel (index
1). IfNone, the samefilterssequence is used for all channels.median_size (int or sequence of int, optional) β Median kernel size. If a sequence with length
Tis provided, the value is applied per time point. If the sequence length does not matchT, only the first entry is used for all time points.gaussian_sigma (float or sequence of float, optional) β Gaussian sigma. If a sequence with length
Tis provided, the value is applied per time point. If the sequence length does not matchT, only the first entry is used for all time points.median_size_channel2 (int or sequence of int or None, optional) β Optional median kernel size override for the second channel (index
1). IfNone, the values frommedian_sizeare reused.gaussian_sigma_channel2 (float or sequence of float or None, optional) β Optional Gaussian sigma override for the second channel (index
1). IfNone, the values fromgaussian_sigmaare reused.apply_3d (bool, optional) β If True, apply filters in 3D over
ZYXfor eachTandCvolume. If False, apply them plane-wise inYXfor each availableTandZ.
- Return type:
ndarray- Returns:
np.ndarray β Filtered stack with the same shape as the input.
Notes
Channel-specific overrides currently target the second channel, i.e. channel index
1. This matches the common two-channel use case in the unmixing workflow where the second channel may need different smoothing strength.