mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-18 12:40:14 +08:00
ENH: Add test of reconstruction by erosion.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user