From b614b34eab22d8d06e87c34426229ba1fb352324 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 18 Aug 2012 23:20:49 -0400 Subject: [PATCH] ENH: Add test of reconstruction by erosion. --- skimage/morphology/tests/test_reconstruction.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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()