From 9eeb99089821a5be54bfe75e726414cdfd4a23b6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 5 Aug 2012 23:27:24 -0500 Subject: [PATCH] Tests pass and example works on build. --- doc/examples/plot_equalize.py | 4 ++-- skimage/exposure/__init__.py | 2 +- skimage/exposure/tests/test_exposure.py | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/examples/plot_equalize.py b/doc/examples/plot_equalize.py index 2cb9cbea..8b06890a 100644 --- a/doc/examples/plot_equalize.py +++ b/doc/examples/plot_equalize.py @@ -64,7 +64,7 @@ img_rescale = exposure.rescale_intensity(img, in_range=(p2, p98)) img_eq = exposure.equalize(img) # Adaptive Equalization -img_adapteq = exposure.adapthist(img) +img_adapteq = exposure.adapthist(img, clip_limit=0.03) # Display results @@ -81,7 +81,7 @@ ax_img, ax_hist, ax_cdf = plot_img_and_hist(img_eq, axes[:, 2]) ax_img.set_title('Histogram equalization') ax_cdf.set_ylabel('Fraction of total intensity') -ax_img, ax_hist, ax_cdf = plot_img_and_hist(img_eq, axes[:, 3]) +ax_img, ax_hist, ax_cdf = plot_img_and_hist(img_adapteq, axes[:, 3]) ax_img.set_title('Adaptive equalization') ax_cdf.set_ylabel('Fraction of total intensity') diff --git a/skimage/exposure/__init__.py b/skimage/exposure/__init__.py index 7e19d317..a5e6c25a 100644 --- a/skimage/exposure/__init__.py +++ b/skimage/exposure/__init__.py @@ -1,2 +1,2 @@ -from .exposure import histogram, equalize, cumulative_distribution +from .exposure import histogram, equalize, cumulative_distribution, adapthist from .exposure import rescale_intensity diff --git a/skimage/exposure/tests/test_exposure.py b/skimage/exposure/tests/test_exposure.py index fbad207b..963758f3 100644 --- a/skimage/exposure/tests/test_exposure.py +++ b/skimage/exposure/tests/test_exposure.py @@ -5,6 +5,7 @@ import skimage from skimage import data from skimage import exposure from skimage.color import rgb2gray +from skimage.util.dtype import dtype_range # Test histogram equalization @@ -94,6 +95,7 @@ def test_adapthist_float(): img = skimage.img_as_float(data.lena()) adapted = exposure.adapthist(img, nx=10, ny=9, clip_limit=0.01, nbins=128, out_range='original') + assert_almost_equal = np.testing.assert_almost_equal assert_almost_equal(adapted.min() , img.min()) assert_almost_equal(adapted.min(), img.min()) assert img.shape == adapted.shape