Skip to content

Commit

Permalink
feat: support binary_image in dusk, largest_k
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Oct 9, 2024
1 parent 4406885 commit 738f89e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cc3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def dust(
threshold:Union[int,float],
connectivity:int = 26,
in_place:bool = False,
binary_image:bool = False,
) -> np.ndarray:
"""
Remove from the input image connected components
Expand All @@ -43,7 +44,8 @@ def dust(
img = np.copy(img)

cc_labels, N = connected_components(
img, connectivity=connectivity, return_N=True
img, connectivity=connectivity,
return_N=True, binary_image=bool(binary_image),
)
stats = statistics(cc_labels)
mask_sizes = stats["voxel_counts"]
Expand All @@ -68,6 +70,7 @@ def largest_k(
connectivity:int = 26,
delta:Union[int,float] = 0,
return_N:bool = False,
binary_image:bool = False,
) -> np.ndarray:
"""
Returns the k largest connected components
Expand All @@ -83,6 +86,7 @@ def largest_k(
cc_labels, N = connected_components(
img, connectivity=connectivity,
return_N=True, delta=delta,
binary_image=bool(binary_image),
)
if N <= k:
if return_N:
Expand Down

0 comments on commit 738f89e

Please sign in to comment.