harpy.im.min_max_filtering#
- harpy.im.min_max_filtering(sdata, image_name=None, size_min_max_filter=85, chunks=None, output_image_name='min_max_filtered', crd=None, to_coordinate_system='global', scale_factors=None, overwrite=False)#
Apply min max filtering to an image in a SpatialData object using dask (using
dask_image.ndfilters.maximum_filteranddask_image.ndfilters.minimum_filter).The size of the filter 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.
- 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.size_min_max_filter (
int|list[int] (default:85)) – Size of the min_max filter. 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:'min_max_filtered')) – The name of the output element. Defaults to “min_max_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(default:False)) – If True overwrites the element if it already exists.
- Return type:
- Returns:
: The
sdataobject with the min max filtered image added.- Raises:
ValueError – If
size_min_max_filteris a list and its length does not match the number of channels.
Examples
Apply min max filtering with a single size:
>>> sdata = min_max_filtering(sdata, size_min_max_filtering=50)
Apply min max filtering with different sizes for each channel:
>>> sdata = min_max_filtering(sdata, size_min_max_filtering=[30, 50, 70])