Skip to content

Commit e81e9dc

Browse files
fix: bug for binary_image
1 parent bd2f271 commit e81e9dc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cc3d/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ def connected_components_stack(
437437
(bottom_cc_labels != 0)
438438
& (top_cc_labels != 0)
439439
)
440-
if not binary_image:
440+
if binary_image:
441+
mask &= bottom_cc_img > 0
442+
mask &= image[:, :, 0] > 0
443+
else:
441444
mask &= (bottom_cc_img == image[:, :, 0])
442445

443446
bottom_labels = np.asarray(bottom_cc_labels)[mask]

0 commit comments

Comments
 (0)