From 28d6787a872e3f027b898e7232fc82c9cf65ea3c Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sun, 23 Feb 2014 23:13:13 -0600 Subject: [PATCH] Add tests for uint12 and uint14 limits --- skimage/exposure/tests/test_exposure.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/skimage/exposure/tests/test_exposure.py b/skimage/exposure/tests/test_exposure.py index 2fc1f750..6471ff59 100644 --- a/skimage/exposure/tests/test_exposure.py +++ b/skimage/exposure/tests/test_exposure.py @@ -46,6 +46,8 @@ def check_cdf_slope(cdf): uint10_max = 2**10 - 1 +uint12_max = 2**12 - 1 +uint14_max = 2**14 - 1 uint16_max = 2**16 - 1 @@ -93,6 +95,18 @@ def test_rescale_named_out_range(): assert_close(out, [0, uint10_max]) +def test_rescale_uint12_limits(): + image = np.array([0, uint16_max], dtype=np.uint16) + out = exposure.rescale_intensity(image, out_range='uint12') + assert_close(out, [0, uint12_max]) + + +def test_rescale_uint14_limits(): + image = np.array([0, uint16_max], dtype=np.uint16) + out = exposure.rescale_intensity(image, out_range='uint14') + assert_close(out, [0, uint14_max]) + + # Test adaptive histogram equalization # ====================================