Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
Colony_Analyzer_AI2_HF.py
CHANGED
|
@@ -220,7 +220,14 @@ def main(args):
|
|
| 220 |
del z
|
| 221 |
p = stitch(img_map)
|
| 222 |
colonies = analyze_colonies(p, min_size, min_circ, np.array(args[0]))
|
| 223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
img = np.array(args[0])
|
| 225 |
img = cv2.copyMakeBorder(img,top=0, bottom=10,left=0,right=10, borderType=cv2.BORDER_CONSTANT, value=[255, 255, 255])
|
| 226 |
#print(colonies.to_string())
|
|
|
|
| 220 |
del z
|
| 221 |
p = stitch(img_map)
|
| 222 |
colonies = analyze_colonies(p, min_size, min_circ, np.array(args[0]))
|
| 223 |
+
if len(colonies) <=0:
|
| 224 |
+
caption = np.ones((150, 2048, 3), dtype=np.uint8) * 255 # Multiply by 255 to make it white
|
| 225 |
+
cv2.putText(caption, 'No colonies detected.', (40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 3)
|
| 226 |
+
cv2.imwrite('results.png', np.vstack((np.array(args[0]), caption)))
|
| 227 |
+
colonies = pd.DataFrame({"Colony Number":[], 'Colony volume':[], "colony_area":[],'mean_pixel_value':[], "centroid":[], "necrotic_area":[],"percent_necrotic":[]})
|
| 228 |
+
with pd.ExcelWriter('results.xlsx') as writer:
|
| 229 |
+
colonies.to_excel(writer, sheet_name="Colony data", index=False)
|
| 230 |
+
return(np.vstack((args[0], caption)), 'results.png', 'results.xlsx')
|
| 231 |
img = np.array(args[0])
|
| 232 |
img = cv2.copyMakeBorder(img,top=0, bottom=10,left=0,right=10, borderType=cv2.BORDER_CONSTANT, value=[255, 255, 255])
|
| 233 |
#print(colonies.to_string())
|
Colony_Analyzer_AI_zstack2_HF.py
CHANGED
|
@@ -263,6 +263,14 @@ def main(args):
|
|
| 263 |
colonies = frame
|
| 264 |
else:
|
| 265 |
colonies = compare_frames(frame, colonies)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
counts = {}
|
| 267 |
for x in range(len(files)):
|
| 268 |
counts[x] = list(colonies["source"]).count(x)
|
|
|
|
| 263 |
colonies = frame
|
| 264 |
else:
|
| 265 |
colonies = compare_frames(frame, colonies)
|
| 266 |
+
if len(colonies) <=0:
|
| 267 |
+
caption = np.ones((150, 2048, 3), dtype=np.uint8) * 255 # Multiply by 255 to make it white
|
| 268 |
+
cv2.putText(caption, 'No colonies detected.', (40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 3)
|
| 269 |
+
cv2.imwrite('results.png', np.vstack((np.array(files[0]), caption)))
|
| 270 |
+
colonies = pd.DataFrame({"Colony Number":[], 'Colony volume':[], "colony_area":[],'mean_pixel_value':[], "centroid":[], "necrotic_area":[],"percent_necrotic":[]})
|
| 271 |
+
with pd.ExcelWriter('results.xlsx') as writer:
|
| 272 |
+
colonies.to_excel(writer, sheet_name="Colony data", index=False)
|
| 273 |
+
return(np.vstack((files[0], caption)), 'results.png', 'results.xlsx')
|
| 274 |
counts = {}
|
| 275 |
for x in range(len(files)):
|
| 276 |
counts[x] = list(colonies["source"]).count(x)
|