Spaces:
Sleeping
Sleeping
Upload Organoid_Analyzer_AI_zstack2_HF.py
Browse files
Organoid_Analyzer_AI_zstack2_HF.py
CHANGED
|
@@ -284,14 +284,14 @@ def contour_overlap(contour1, contour2, centroid1, centroid2, area1, area2, cent
|
|
| 284 |
else:
|
| 285 |
return 1 # Some overlap but not meeting strict criteria
|
| 286 |
|
| 287 |
-
def compare_frames(frame1, frame2):
|
| 288 |
for i in range(1, len(frame1)+1):
|
| 289 |
if frame1.loc[i,"exclude"] == True:
|
| 290 |
continue
|
| 291 |
for j in range(1, len(frame2)+1):
|
| 292 |
if frame2.loc[j,"exclude"] == True:
|
| 293 |
continue
|
| 294 |
-
temp = contour_overlap(frame1.loc[i, "contour"], frame2.loc[j, "contour"], frame1.loc[i, "centroid"], frame2.loc[j, "centroid"], frame1.loc[i, "organoid_area"], frame2.loc[j, "organoid_area"])
|
| 295 |
if temp ==2:
|
| 296 |
frame2.loc[j,"exclude"] = True
|
| 297 |
elif temp ==3:
|
|
@@ -306,7 +306,7 @@ def compare_frames(frame1, frame2):
|
|
| 306 |
def main(args):
|
| 307 |
min_size = args[1]
|
| 308 |
min_circ = args[2]
|
| 309 |
-
do_necrosis = args[
|
| 310 |
colonies = {}
|
| 311 |
files = args[0]
|
| 312 |
for idx,x in enumerate(files):
|
|
@@ -321,7 +321,7 @@ def main(args):
|
|
| 321 |
if isinstance(colonies, dict):
|
| 322 |
colonies = frame
|
| 323 |
else:
|
| 324 |
-
colonies = compare_frames(frame, colonies)
|
| 325 |
if len(colonies) <=0:
|
| 326 |
img = pad(np.array(files[0]))
|
| 327 |
if img.ndim == 2:
|
|
|
|
| 284 |
else:
|
| 285 |
return 1 # Some overlap but not meeting strict criteria
|
| 286 |
|
| 287 |
+
def compare_frames(frame1, frame2, centroid_dist=30, overlap_area=.4):
|
| 288 |
for i in range(1, len(frame1)+1):
|
| 289 |
if frame1.loc[i,"exclude"] == True:
|
| 290 |
continue
|
| 291 |
for j in range(1, len(frame2)+1):
|
| 292 |
if frame2.loc[j,"exclude"] == True:
|
| 293 |
continue
|
| 294 |
+
temp = contour_overlap(frame1.loc[i, "contour"], frame2.loc[j, "contour"], frame1.loc[i, "centroid"], frame2.loc[j, "centroid"], frame1.loc[i, "organoid_area"], frame2.loc[j, "organoid_area"],centroid_dist, overlap_area)
|
| 295 |
if temp ==2:
|
| 296 |
frame2.loc[j,"exclude"] = True
|
| 297 |
elif temp ==3:
|
|
|
|
| 306 |
def main(args):
|
| 307 |
min_size = args[1]
|
| 308 |
min_circ = args[2]
|
| 309 |
+
do_necrosis = args[5]
|
| 310 |
colonies = {}
|
| 311 |
files = args[0]
|
| 312 |
for idx,x in enumerate(files):
|
|
|
|
| 321 |
if isinstance(colonies, dict):
|
| 322 |
colonies = frame
|
| 323 |
else:
|
| 324 |
+
colonies = compare_frames(frame, colonies, args[3], args[4])
|
| 325 |
if len(colonies) <=0:
|
| 326 |
img = pad(np.array(files[0]))
|
| 327 |
if img.ndim == 2:
|