Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -277,6 +277,16 @@ def run_segmentation_editor(editor_data, model_choice, min_cell_size, max_cell_s
|
|
| 277 |
# Run Cellpose segmentation
|
| 278 |
masks_raw, flows, styles = model.eval(processed_image_np, diameter=None, channels=[0, 0])
|
| 279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
# Compute recommendation from RAW masks
|
| 281 |
recommend_min = rec_min_size(masks_raw)
|
| 282 |
|
|
|
|
| 277 |
# Run Cellpose segmentation
|
| 278 |
masks_raw, flows, styles = model.eval(processed_image_np, diameter=None, channels=[0, 0])
|
| 279 |
|
| 280 |
+
ids = np.unique(masks_raw)
|
| 281 |
+
ids = ids[ids > 0]
|
| 282 |
+
|
| 283 |
+
sizes = np.array([np.count_nonzero(masks_raw == cid) for cid in ids])
|
| 284 |
+
|
| 285 |
+
print("num_cells:", len(ids))
|
| 286 |
+
print("mean:", sizes.mean())
|
| 287 |
+
print("median:", np.median(sizes))
|
| 288 |
+
print("p90:", np.percentile(sizes, 90))
|
| 289 |
+
print("max:", sizes.max())
|
| 290 |
# Compute recommendation from RAW masks
|
| 291 |
recommend_min = rec_min_size(masks_raw)
|
| 292 |
|