File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 55from scipy .ndimage import gaussian_filter
66from ..extraction import masks
77from . import utils
8+ import traceback
89"""
910identify cells with channel 2 brightness (aka red cells)
1011
@@ -90,7 +91,10 @@ def cellpose_overlap(stats, mimg2):
9091 ypix0 , xpix0 = stats [i ]["ypix" ], stats [i ]["xpix" ]
9192 smask [ypix0 , xpix0 ] = 1
9293 ious = utils .mask_ious (masks , smask )[0 ]
93- iou = ious .max ()
94+ if ious .size > 0 :
95+ iou = ious .max ()
96+ else :
97+ iou = 0.0
9498 redstats [
9599 i ,
96100 ] = np .array ([iou > 0.25 , iou ]) #this had the wrong dimension
@@ -112,10 +116,11 @@ def detect(ops, stats):
112116 try :
113117 print (">>>> CELLPOSE estimating masks in anatomical channel" )
114118 redstats , masks = cellpose_overlap (stats , mimg2 )
115- except :
119+ except Exception as e :
116120 print (
117121 "ERROR importing or running cellpose, continuing without anatomical estimates"
118122 )
123+ traceback .print_exc ()
119124
120125 if redstats is None :
121126 redstats = intensity_ratio (ops , stats )
You can’t perform that action at this time.
0 commit comments