mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-20 12:40:31 +08:00
ENH: Adding tests for new stain separation functions.
This commit is contained in:
@@ -46,6 +46,7 @@ from __future__ import division
|
||||
__all__ = ['convert_colorspace', 'rgb2hsv', 'hsv2rgb', 'rgb2xyz', 'xyz2rgb',
|
||||
'rgb2rgbcie', 'rgbcie2rgb', 'rgb2grey', 'rgb2gray', 'gray2rgb',
|
||||
'xyz2lab', 'lab2xyz', 'lab2rgb', 'rgb2lab', 'rgb2hed', 'hed2rgb',
|
||||
'separate_stains', 'combine_stains',
|
||||
'is_rgb', 'is_gray'
|
||||
]
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ from skimage.color import (
|
||||
rgb2hsv, hsv2rgb,
|
||||
rgb2xyz, xyz2rgb,
|
||||
rgb2hed, hed2rgb,
|
||||
separate_stains,
|
||||
combine_stains,
|
||||
rgb2rgbcie, rgbcie2rgb,
|
||||
convert_colorspace,
|
||||
rgb2grey, gray2rgb,
|
||||
@@ -132,6 +134,22 @@ class TestColorconv(TestCase):
|
||||
img_rgb = img_as_float(self.img_rgb)
|
||||
assert_array_almost_equal(hed2rgb(rgb2hed(img_rgb)), img_rgb)
|
||||
|
||||
# RGB<->HDX roundtrip with ubyte image
|
||||
def test_hdx_rgb_roundtrip(self):
|
||||
from skimage.color.colorconv import hdx_from_rgb, rgb_from_hdx
|
||||
img_rgb = self.img_rgb
|
||||
conv = combine_stains(separate_stains(img_rgb, hdx_from_rgb),
|
||||
rgb_from_hdx)
|
||||
assert_equal(img_as_ubyte(conv), img_rgb)
|
||||
|
||||
# RGB<->HDX roundtrip with ubyte image
|
||||
def test_hdx_rgb_roundtrip(self):
|
||||
from skimage.color.colorconv import hdx_from_rgb, rgb_from_hdx
|
||||
img_rgb = img_as_float(self.img_rgb)
|
||||
conv = combine_stains(separate_stains(img_rgb, hdx_from_rgb),
|
||||
rgb_from_hdx)
|
||||
assert_array_almost_equal(conv, img_rgb)
|
||||
|
||||
# RGB to RGB CIE
|
||||
def test_rgb2rgbcie_conversion(self):
|
||||
gt = np.array([[[ 0.1488856 , 0.18288098, 0.19277574],
|
||||
|
||||
Reference in New Issue
Block a user