From eff310539baad6f497d4626c3f8759502974fabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sun, 1 May 2016 23:02:01 +0200 Subject: [PATCH] Improve doc string formatting of denoise_bilateral (#2062) * Improve doc string formatting of denoise_bilateral --- skimage/restoration/_denoise.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/skimage/restoration/_denoise.py b/skimage/restoration/_denoise.py index 30954c70..446fa257 100644 --- a/skimage/restoration/_denoise.py +++ b/skimage/restoration/_denoise.py @@ -8,17 +8,18 @@ import warnings def denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, - bins=10000, mode='constant', cval=0, multichannel=True, sigma_range=None): + bins=10000, mode='constant', cval=0, multichannel=True, + sigma_range=None): """Denoise image using bilateral filter. - This is an edge-preserving and noise reducing denoising filter. It averages - pixels based on their spatial closeness and radiometric similarity. + This is an edge-preserving, denoising filter. It averages pixels based on + their spatial closeness and radiometric similarity. - Spatial closeness is measured by the gaussian function of the euclidian + Spatial closeness is measured by the Gaussian function of the Euclidean distance between two pixels and a certain standard deviation (`sigma_spatial`). - Radiometric similarity is measured by the gaussian function of the euclidian + Radiometric similarity is measured by the Gaussian function of the Euclidean distance between two color values and a certain standard deviation (`sigma_color`). @@ -28,7 +29,8 @@ def denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, Input image, 2D grayscale or RGB. win_size : int Window size for filtering. - If win_size is not specified, it is calculated as max(5, 2*ceil(3*sigma_spatial)+1) + If win_size is not specified, it is calculated as + ``max(5, 2 * ceil(3 * sigma_spatial) + 1)``. sigma_color : float Standard deviation for grayvalue/color distance (radiometric similarity). A larger value results in averaging of pixels with larger @@ -40,7 +42,7 @@ def denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, Standard deviation for range distance. A larger value results in averaging of pixels with larger spatial differences. bins : int - Number of discrete values for gaussian weights of color filtering. + Number of discrete values for Gaussian weights of color filtering. A larger value results in improved accuracy. mode : {'constant', 'edge', 'symmetric', 'reflect', 'wrap'} How to handle values outside the image borders. See @@ -91,7 +93,8 @@ def denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, "implemented for 2D grayscale and color images " "only.".format(image.shape, image.shape[2])) else: - msg = "Input image must be grayscale, RGB, or RGBA; but has shape {0}." + msg = "Input image must be grayscale, RGB, or RGBA; " \ + "but has shape {0}." warnings.warn(msg.format(image.shape)) else: if image.ndim > 2: @@ -110,7 +113,7 @@ def denoise_bilateral(image, win_size=None, sigma_color=None, sigma_spatial=1, sigma_color = sigma_range if win_size is None: - win_size = max(5, 2*int(ceil(3*sigma_spatial))+1) + win_size = max(5, 2 * int(ceil(3 * sigma_spatial)) + 1) mode = _mode_deprecations(mode) return _denoise_bilateral(image, win_size, sigma_color, sigma_spatial,