diff --git a/skimage/color/__init__.py b/skimage/color/__init__.py index 95ccb0c0..1c61020d 100644 --- a/skimage/color/__init__.py +++ b/skimage/color/__init__.py @@ -15,6 +15,8 @@ from .colorconv import (convert_colorspace, rgb2lab, rgb2hed, hed2rgb, + lab2lch, + lch2lab, separate_stains, combine_stains, rgb_from_hed, @@ -68,6 +70,8 @@ __all__ = ['convert_colorspace', 'rgb2lab', 'rgb2hed', 'hed2rgb', + 'lab2lch', + 'lch2lab', 'separate_stains', 'combine_stains', 'rgb_from_hed', diff --git a/skimage/color/tests/test_colorconv.py b/skimage/color/tests/test_colorconv.py index 4fdaa4c8..a184f807 100644 --- a/skimage/color/tests/test_colorconv.py +++ b/skimage/color/tests/test_colorconv.py @@ -34,6 +34,7 @@ from skimage.color import (rgb2hsv, hsv2rgb, xyz2lab, lab2xyz, lab2rgb, rgb2lab, is_rgb, is_gray, + lab2lch, lch2lab, guess_spatial_dimensions ) @@ -249,6 +250,13 @@ class TestColorconv(TestCase): img_rgb = img_as_float(self.img_rgb) assert_array_almost_equal(lab2rgb(rgb2lab(img_rgb)), img_rgb) + def test_lab_lch_roundtrip(self): + rgb = img_as_float(self.img_rgb) + lab = rgb2lab(rgb) + lab2 = lch2lab(lab2lch(lab)) + assert_array_almost_equal(lab2, lab) + + def test_gray2rgb(): x = np.array([0, 0.5, 1]) assert_raises(ValueError, gray2rgb, x)