Skip to content

Commit

Permalink
test: add simple dilation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Dec 15, 2023
1 parent f4b8188 commit 2182a0c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,26 @@ def test_spherical_close():
res = fastmorph.spherical_close(labels, radius=1)
assert res[5,5,5] == True


def test_dilate():
labels = np.zeros((3,3,3), dtype=bool)

out = fastmorph.dilate(labels)
assert not np.any(out)

labels[1,1,1] = True

out = fastmorph.dilate(labels)
assert np.all(out)

labels = np.zeros((3,3,3), dtype=bool)
labels[0,0,0] = True
out = fastmorph.dilate(labels)

ans = np.zeros((3,3,3), dtype=bool)
ans[:2,:2,:2] = True

assert np.all(out == ans)



0 comments on commit 2182a0c

Please sign in to comment.