@@ -45,9 +45,7 @@ def _file_to_base64_png(path):
4545def _norm (arr , lo , hi ):
4646 """Linearly normalise *arr* to [0, 1] using the given bounds."""
4747 if hi > lo :
48- return np .clip (
49- (arr .astype (np .float32 ) - lo ) / (hi - lo ), 0.0 , 1.0
50- )
48+ return np .clip ((arr .astype (np .float32 ) - lo ) / (hi - lo ), 0.0 , 1.0 )
5149 return np .zeros_like (arr , dtype = np .float32 )
5250
5351
@@ -134,15 +132,11 @@ def main():
134132 threshold_entries = []
135133 for thresh in thresholds :
136134 fig , axes = plt .subplots (1 , n_crops , figsize = (n_crops * 3 , 3 ))
137- fig .suptitle (
138- f"Threshold = { thresh :.1f} " , fontsize = 10 , fontweight = "bold"
139- )
135+ fig .suptitle (f"Threshold = { thresh :.1f} " , fontsize = 10 , fontweight = "bold" )
140136 if n_crops == 1 :
141137 axes = [axes ]
142138
143- for ax , (z , y0 , y1 , x0 , x1 ), crop_norm in zip (
144- axes , crop_boxes , img_crops_norm
145- ):
139+ for ax , (z , y0 , y1 , x0 , x1 ), crop_norm in zip (axes , crop_boxes , img_crops_norm ):
146140 mask_crop = (data [z , y0 :y1 , x0 :x1 ] > thresh ).astype (np .float32 )
147141 ax .imshow (crop_norm , cmap = "gray" )
148142 mask_ma = np .ma .masked_where (mask_crop < 0.5 , mask_crop )
0 commit comments