Skip to content

Commit 8e798d1

Browse files
committed
fixed remove_artefacts for 3D labels
1 parent ba5c589 commit 8e798d1

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

cellacdc/core.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,31 @@ def lab_replace_values(lab, rp, oldIDs, newIDs, in_place=True):
6262
return lab
6363

6464
def remove_artefacts(
65-
lab, min_solidity=0.5, min_area=15, max_elongation=3,
65+
labels, min_solidity=0.5, min_area=15, max_elongation=3,
66+
return_delIDs=False
67+
):
68+
if labels.ndim == 3:
69+
for z, lab in enumerate(labels):
70+
lab = remove_artefacts_lab2D(
71+
lab, min_solidity, min_area, max_elongation
72+
)
73+
labels[z] = lab
74+
result = labels
75+
else:
76+
result = remove_artefacts_lab2D(
77+
lab, min_solidity, min_area, max_elongation,
78+
return_delIDs=return_delIDs
79+
)
80+
81+
if return_delIDs:
82+
labels, delIDs = result
83+
return labels, delIDs
84+
else:
85+
labels = result
86+
return labels
87+
88+
def remove_artefacts_lab2D(
89+
lab, min_solidity, min_area, max_elongation,
6690
return_delIDs=False
6791
):
6892
"""

0 commit comments

Comments
 (0)