Spaces:
Sleeping
Sleeping
Upload Colony_Analyzer_AI_zstack2_HF.py
Browse files
Colony_Analyzer_AI_zstack2_HF.py
CHANGED
|
@@ -355,7 +355,9 @@ def main(args):
|
|
| 355 |
caption = np.ones((150, 2068, 3), dtype=np.uint8) * 255 # Multiply by 255 to make it white
|
| 356 |
cv2.putText(caption, "Total area necrotic: "+str(total_area_dark)+ ", Total area living: "+str(total_area_light)+", Ratio: "+str(ratio), (40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 3)
|
| 357 |
|
| 358 |
-
|
| 359 |
-
|
|
|
|
|
|
|
| 360 |
cv2.imwrite('Group_analysis_results.png', np.vstack((img, caption)))
|
| 361 |
return(np.vstack((img, caption)), 'Group_analysis_results.png', 'Group_analysis_results.xlsx')
|
|
|
|
| 355 |
caption = np.ones((150, 2068, 3), dtype=np.uint8) * 255 # Multiply by 255 to make it white
|
| 356 |
cv2.putText(caption, "Total area necrotic: "+str(total_area_dark)+ ", Total area living: "+str(total_area_light)+", Ratio: "+str(ratio), (40, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 3)
|
| 357 |
|
| 358 |
+
print('img ndim: ' +str(img.ndim))
|
| 359 |
+
print('caption ndim: ' +str(caption.ndim))
|
| 360 |
+
if img.ndim == 2:
|
| 361 |
+
img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
|
| 362 |
cv2.imwrite('Group_analysis_results.png', np.vstack((img, caption)))
|
| 363 |
return(np.vstack((img, caption)), 'Group_analysis_results.png', 'Group_analysis_results.xlsx')
|