diff --git a/skimage/morphology/tests/test_reconstruction.py b/skimage/morphology/tests/test_reconstruction.py index a3461f31..74f61b9f 100644 --- a/skimage/morphology/tests/test_reconstruction.py +++ b/skimage/morphology/tests/test_reconstruction.py @@ -8,6 +8,7 @@ All rights reserved. Original author: Lee Kamentsky """ import numpy as np +from numpy.testing import assert_array_almost_equal as assert_close from skimage.morphology.greyreconstruct import reconstruction @@ -68,6 +69,14 @@ def test_zero_image_one_mask(): assert np.all(result == 0) +def test_fill_hole(): + """Test reconstruction by erosion, which should fill holes in mask.""" + seed = np.array([0, 8, 8, 8, 8, 8, 8, 8, 8, 0]) + mask = np.array([0, 3, 6, 2, 1, 1, 1, 4, 2, 0]) + result = reconstruction(seed, mask, method='erosion') + assert_close(result, np.array([0, 3, 6, 4, 4, 4, 4, 4, 2, 0])) + + if __name__ == '__main__': from numpy import testing testing.run_module_suite()