Skip to content

Commit

Permalink
fix: single rows of pixels were not handled for C order arrays (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith authored Jul 15, 2021
1 parent 424328a commit 2da2547
Show file tree
Hide file tree
Showing 3 changed files with 3,059 additions and 2,737 deletions.
13 changes: 13 additions & 0 deletions automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,19 @@ def test_each(dtype, order, in_place, dims):
for label, img in cc3d.each(labels, binary=True, in_place=in_place):
assert np.all(img == (labels == label))

@pytest.mark.parametrize("order", ('C', 'F'))
@pytest.mark.parametrize("connectivity", (4, 8))
def test_single_pixel_2d(order, connectivity):
binary_img = np.zeros((3, 3), dtype=np.uint8, order=order)
binary_img[1, 1] = 1
labels = cc3d.connected_components(binary_img, connectivity=connectivity)
assert np.all(labels == binary_img)

binary_img = np.zeros((5, 5), dtype=np.uint8, order=order)
binary_img[1, 1] = 1
labels = cc3d.connected_components(binary_img, connectivity=connectivity)
assert np.all(labels == binary_img)

def test_region_graph_26():
labels = np.zeros( (10, 10, 10), dtype=np.uint32 )

Expand Down
Loading

0 comments on commit 2da2547

Please sign in to comment.