Debian Codegraph @

dask_image/ndfilters/_smooth.py

raw
1 # -*- coding: utf-8 -*-
2
3
4 import scipy.ndimage
5
6 from ..dispatch._dispatch_ndfilters import dispatch_uniform_filter
7 from . import _utils
8 from ._gaussian import gaussian_filter
9
10 __all__ = [
11 "uniform_filter",
12 ]
13
14 gaussian_filter = gaussian_filter
15
16
17 @_utils._update_wrapper(scipy.ndimage.uniform_filter)
18 def uniform_filter(image,
19 size=3,
20 mode='reflect',
21 cval=0.0,
22 origin=0):
23 size = _utils._get_size(image.ndim, size)
24 depth = _utils._get_depth(size, origin)
25
26 depth, boundary = _utils._get_depth_boundary(image.ndim, depth, "none")
27
28 result = image.map_overlap(
29 dispatch_uniform_filter(image),
30 depth=depth,
31 boundary=boundary,
32 dtype=image.dtype,
33 meta=image._meta,
34 size=size,
35 mode=mode,
36 cval=cval,
37 origin=origin
38 )
39
40 return result