Skip to content

Commit

Permalink
fixed remove_artefacts for 3D labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ElpadoCan committed Jun 21, 2022
1 parent ba5c589 commit 8e798d1
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion cellacdc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,31 @@ def lab_replace_values(lab, rp, oldIDs, newIDs, in_place=True):
return lab

def remove_artefacts(
lab, min_solidity=0.5, min_area=15, max_elongation=3,
labels, min_solidity=0.5, min_area=15, max_elongation=3,
return_delIDs=False
):
if labels.ndim == 3:
for z, lab in enumerate(labels):
lab = remove_artefacts_lab2D(
lab, min_solidity, min_area, max_elongation
)
labels[z] = lab
result = labels
else:
result = remove_artefacts_lab2D(
lab, min_solidity, min_area, max_elongation,
return_delIDs=return_delIDs
)

if return_delIDs:
labels, delIDs = result
return labels, delIDs
else:
labels = result
return labels

def remove_artefacts_lab2D(
lab, min_solidity, min_area, max_elongation,
return_delIDs=False
):
"""
Expand Down

0 comments on commit 8e798d1

Please sign in to comment.