ENH: Add test of reconstruction by erosion.

This commit is contained in:
Tony S Yu
2012-08-18 23:20:49 -04:00
parent 3ad1ed3a28
commit b614b34eab
@@ -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()