From 5ba3cad178cd05c14e36cbe6d01e5054e62a893e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 15 Jun 2015 21:39:19 -0500 Subject: [PATCH] Update tests Docstring and TODO Update docstring Style fixes Update equalize_adapthist to use new view_as_windows Update equalize_adapthist to use new view_as_windows Try rbase again Update equalize_adapthist to use new view_as_windows Fix relative imports Style fixes Add a deprecation warning and add to api_changes.txt Update TODO and switch to 0.13 deprecation Preserve the current API as much as possible and defer to 0.14 Move the new kwarg to the very end Clarify deprecation warning Update to use row/col in clahe Update docstring Use optimal_step to set up view_as_windows Update equalize_adapthist to use new view_as_windows Try rbase again Update equalize_adapthist to use new view_as_windows Fix relative imports Style fixes Add a deprecation warning and add to api_changes.txt Update TODO and switch to 0.13 deprecation Preserve the current API as much as possible and defer to 0.14 --- TODO.txt | 2 +- skimage/exposure/_adapthist.py | 22 +++++++++------------- skimage/exposure/tests/test_exposure.py | 3 +-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/TODO.txt b/TODO.txt index e6557ff4..a96b3731 100644 --- a/TODO.txt +++ b/TODO.txt @@ -16,7 +16,7 @@ Version 0.13 * Remove deprecated edge filters `hsobel`, `vsobel`, `hscharr`, `vscharr`, `hprewitt`, `vprewitt`, `roberts_positive_diagonal`, `roberts_negative_diagonal` in `skimage/filters/edges.py` -* Remove deprecated ``ntiles_*` kwargs in ``equalize_adapthist``. + Version 0.12 diff --git a/skimage/exposure/_adapthist.py b/skimage/exposure/_adapthist.py index 85120b35..b0ed63d7 100644 --- a/skimage/exposure/_adapthist.py +++ b/skimage/exposure/_adapthist.py @@ -22,12 +22,16 @@ from ..exposure import rescale_intensity from ..util import view_as_windows <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD from .._shared.utils import skimage_deprecation, warnings ======= >>>>>>> 3bcbbc0... Update equalize_adapthist to use new view_as_windows ======= from .._shared.utils import skimage_deprecation >>>>>>> 446f383... Add a deprecation warning and add to api_changes.txt +======= +from .._shared.utils import skimage_deprecation, warnings +>>>>>>> 204208a... Preserve the current API as much as possible and defer to 0.14 NR_OF_GREY = 2 ** 14 # number of grayscale levels to use in CLAHE algorithm @@ -35,6 +39,7 @@ NR_OF_GREY = 2 ** 14 # number of grayscale levels to use in CLAHE algorithm @adapt_rgb(hsv_value) <<<<<<< HEAD +<<<<<<< HEAD def equalize_adapthist(image, ntiles_x=8, ntiles_y=8, clip_limit=0.01, nbins=256, kernel_size=None): ======= @@ -43,6 +48,9 @@ def equalize_adapthist(image, kernel_size=64, ntiles_x=None, ntiles_y=None, clip_limit=0.01, nbins=256): >>>>>>> 3bcbbc0... Update equalize_adapthist to use new view_as_windows ======= +======= +def equalize_adapthist(image, ntiles_x=8, ntiles_y=8, kernel_size=None, +>>>>>>> 204208a... Preserve the current API as much as possible and defer to 0.14 clip_limit=0.01, nbins=256): >>>>>>> 172fb0d... Style fixes """Contrast Limited Adaptive Histogram Equalization (CLAHE). @@ -58,23 +66,11 @@ def equalize_adapthist(image, kernel_size=64, ntiles_x=None, ntiles_y=None, kernel_size: integer or 2-tuple Defines the shape of contextual regions used in the algorithm. If an integer is given, the shape will be a square of -<<<<<<< HEAD -<<<<<<< HEAD sidelength given by this value. ntiles_x : int, optional (deprecated in favor of ``kernel_size``) Number of tile regions in the X direction (horizontal). ntiles_y : int, optional (deprecated if favor of ``kernel_size``) Number of tile regions in the Y direction (vertical). -======= - sidelength given by its value. -======= - sidelength given by this value. ->>>>>>> 172fb0d... Style fixes - ntiles_x : int, optional - Number of tile regions in the X direction. - ntiles_y : int, optional - Number of tile regions in the Y direction. ->>>>>>> 3bcbbc0... Update equalize_adapthist to use new view_as_windows clip_limit : float: optional Clipping limit, normalized between 0 and 1 (higher values give more contrast). @@ -113,7 +109,7 @@ def equalize_adapthist(image, kernel_size=64, ntiles_x=None, ntiles_y=None, ntiles_x = ntiles_x or 8 ntiles_y = ntiles_y or 8 kernel_size = (np.round(image.shape[0] / ntiles_y), - np.round(image.shape[1] / ntiles_x)) + np.round(image.shape[1] / ntiles_x))0.14 if isinstance(kernel_size, numbers.Number): kernel_size = (kernel_size, kernel_size) diff --git a/skimage/exposure/tests/test_exposure.py b/skimage/exposure/tests/test_exposure.py index 3d684445..bde77cdb 100644 --- a/skimage/exposure/tests/test_exposure.py +++ b/skimage/exposure/tests/test_exposure.py @@ -214,8 +214,7 @@ def test_adapthist_grayscale(): with expected_warnings(['precision loss|non-contiguous input', 'deprecated']): adapted_old = exposure.equalize_adapthist(img, 10, 9, clip_limit=0.01, - adapted = exposure.equalize_adapthist(img, kernel_size=(57, 51), clip_limit=0.01, nbins=128) - assert_almost_equal = np.testing.assert_almost_equal + adapted = exposure.equalize_adapthist(img, kernel_size=(57, 51), clip_limit=0.01, nbins=128)most_equal assert img.shape == adapted.shape assert_almost_equal(peak_snr(img, adapted), 90.669, 3) assert_almost_equal(norm_brightness_err(img, adapted), 0.084, 3)