def filter_window_cartesian(img, wsize, fun, scale, **kwargs):
r"""Apply a filter of square window size `fsize` on a given
cartesian image `img`.
Parameters
----------
img : :class:`numpy:numpy.ndarray`
2d array of values to which the filter is to be applied
wsize : float
Half size of the window centred on the pixel [m]
fun : string
name of the 2d filter from :mod:`scipy:scipy.ndimage`
scale : tuple of 2 floats
x and y scale of the cartesian grid [m]
Returns
-------
output : :class:`numpy:numpy.ndarray`
Array with the same shape as `img`, containing the filter's results.
"""
fun = getattr(filters, "%s_filter" % fun)
size = np.fix(wsize / scale + 0.5).astype(int)
data_filtered = fun(img, size, **kwargs)
return data_filtered
评论列表
文章目录