harpy.im.gaussian_filtering#
- harpy.im.gaussian_filtering(sdata, image_name=None, sigma=6, chunks=None, output_image_name='gaussian_filtered', crd=None, to_coordinate_system='global', scale_factors=None, overwrite=False)#
Apply Gaussian filtering to an image in a SpatialData object using dask.
The sigma value can be provided, either as an integer or a list of integers corresponding to each channel. Compatibility with image elements that have either two or three spatial dimensions. See
scipy.ndimage.filters.gaussian_filterfor more info- Parameters:
sdata (
SpatialData) – Spatial data object containing the images to be processed.image_name (
str|None(default:None)) – The image element insdatato run min_max_filtering on. If not provided, the last image element insdatais used.sigma (
int|list[int] (default:6)) – Standard deviation for Gaussian kernel. If provided as a list, the length must match the number of channels.chunks (
str|tuple[int,...] |int|None(default:None)) – Specification for rechunking the data before applying the function.output_image_name (
str(default:'gaussian_filtered')) – The name of the output element. Defaults to “gaussian_filtered”.crd (
tuple[int,int,int,int] |None(default:None)) – The coordinates specifying the region of the image to be processed. Defines the bounds (x_min, x_max, y_min, y_max).to_coordinate_system (
str(default:'global')) – The coordinate system to which thecrdis specified. Ignored ifcrdis None.scale_factors (
Sequence[dict[str,int] |int] |None(default:None)) – Scale factors to apply for multiscale.overwrite (bool) – If True overwrites the element if it already exists.
- Return type:
- Returns:
: The
sdataobject with the Gaussian filtered image added.- Raises:
ValueError – If
sigmais a list and its length does not match the number of channels.
Examples
Apply Gaussian filtering with a single sigma for all channels:
>>> sdata = gaussian_filtering(sdata, sigma=8)
Apply gaussian filtering with different sigmas for each channel:
>>> sdata = min_max_filtering(sdata, sigma=[6, 0, 4])
Set
sigmato zero to copy the channel (i.e. no Gaussian filter).