Skip to content
Snippets Groups Projects
Commit d845a654 authored by Andrey Aristov's avatar Andrey Aristov
Browse files

fix filter

parent cbb87741
No related branches found
No related tags found
No related merge requests found
......@@ -130,8 +130,9 @@ def filter_labels(labels, min_diam=50, max_diam=150, max_ecc=0.2):
raise ValueError(
"min value is greater than max value for the diameter filter"
)
data = strip_dimensions(labels)
props = regionprops(
labels[0],
data,
)
good_props = filter(
lambda p: (d := p.major_axis_length) > min_diam
......@@ -143,7 +144,7 @@ def filter_labels(labels, min_diam=50, max_diam=150, max_ecc=0.2):
if len(good_labels) < 1:
return np.zeros_like(labels)
# print(f'good_labels {good_labels}')
mask = np.sum([labels == v for v in good_labels], axis=0)
mask = np.sum([data == v for v in good_labels], axis=0)
# print(mask.shape)
return (label(mask)[0].astype("uint16")).reshape(labels.shape)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment