Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload Colony_Analyzer_AI2_HF.py
Browse files
Colony_Analyzer_AI2_HF.py
CHANGED
|
@@ -114,7 +114,7 @@ def find_colonies(mask, size_cutoff, circ_cutoff):
|
|
| 114 |
mask = mask[0, :, :, 0] # if there's an extra batch/channel dimension
|
| 115 |
|
| 116 |
binary_mask = np.where(mask == 1, 255, 0).astype(np.uint8)
|
| 117 |
-
print(max(binary_mask))
|
| 118 |
contours, _ = cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 119 |
contoursf = []
|
| 120 |
for x in contours:
|
|
@@ -140,7 +140,7 @@ def find_necrosis(mask):
|
|
| 140 |
elif mask.ndim == 4:
|
| 141 |
mask = mask[0, :, :, 0] # if there's an extra batch/channel dimension
|
| 142 |
binary_mask = np.where(mask == 2, 255, 0).astype(np.uint8)
|
| 143 |
-
print(max(binary_mask))
|
| 144 |
contours, _ = cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 145 |
return(contours)
|
| 146 |
|
|
|
|
| 114 |
mask = mask[0, :, :, 0] # if there's an extra batch/channel dimension
|
| 115 |
|
| 116 |
binary_mask = np.where(mask == 1, 255, 0).astype(np.uint8)
|
| 117 |
+
print(np.max(binary_mask))
|
| 118 |
contours, _ = cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 119 |
contoursf = []
|
| 120 |
for x in contours:
|
|
|
|
| 140 |
elif mask.ndim == 4:
|
| 141 |
mask = mask[0, :, :, 0] # if there's an extra batch/channel dimension
|
| 142 |
binary_mask = np.where(mask == 2, 255, 0).astype(np.uint8)
|
| 143 |
+
print(np.max(binary_mask))
|
| 144 |
contours, _ = cv2.findContours(binary_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 145 |
return(contours)
|
| 146 |
|