From b066a143b9c00c1a5c5be6448db3c4b69540442e Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Tue, 17 Jun 2014 22:57:20 -0500 Subject: [PATCH] Clarify docstrings --- skimage/exposure/exposure.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/skimage/exposure/exposure.py b/skimage/exposure/exposure.py index 2b473fea..12161c4e 100644 --- a/skimage/exposure/exposure.py +++ b/skimage/exposure/exposure.py @@ -143,8 +143,9 @@ def intensity_range(image, range_values='image', zero_min=False): ---------- image : array Input image. - range_values : {'image' | 'dtype'} or dtype-name or 2-tuple + range_values : str or 2-tuple The image intensity range is configured by this parameter. + The possible values for this parameter are enumerated below. 'image' Return image min/max as the range. @@ -181,22 +182,17 @@ def intensity_range(image, range_values='image', zero_min=False): def rescale_intensity(image, in_range='image', out_range='dtype'): """Return image after stretching or shrinking its intensity levels. - The image intensities are uniformly rescaled such that the minimum and - maximum values given by `in_range` match those given by `out_range`. Thus, - `in_range` values within the input-image's range will clip intensities, - and values outside the input image will tend to push limiting values - (e.g. white and black) toward mean values (e.g. gray). - - The minimum and maximum possible values of the output image is determined - by `out_range`. The actual min/max of the output could lie within this - range if `in_range` lies outside the input-image's intensity range. + The desired intensity range of the input and output, `in_range` and + `out_range` respectively, are used to stretch or shrink the intensity range + of the input image. See examples below. Parameters ---------- image : array Image array. - in_range, out_range : {'image' | 'dtype'} or dtype-name or 2-tuple + in_range, out_range : str or 2-tuple Min and max intensity values of input and output image. + The possible values for this parameter are enumerated below. 'image' Use image min/max as the intensity range. @@ -216,7 +212,9 @@ def rescale_intensity(image, in_range='image', out_range='dtype'): Examples -------- - By default, intensities are stretched to the limits allowed by the dtype: + By default, the min/max intensities of the input image are stretched to + the limits allowed by the image's dtype, since `in_range` defaults to + 'image' and `out_range` defaults to 'dtype': >>> image = np.array([51, 102, 153], dtype=np.uint8) >>> rescale_intensity(image)