File tree Expand file tree Collapse file tree 5 files changed +7
-6
lines changed
tiatoolbox/models/architecture Expand file tree Collapse file tree 5 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ pillow>=9.3.0
2424pydicom >= 2.3.1 # Used by wsidicom
2525pyyaml >= 6.0
2626requests >= 2.28.1
27- scikit-image >= 0.20
27+ scikit-image >= 0.26.0
2828scikit-learn >= 1.2.0
2929scipy >= 1.8
3030shapely >= 2.0.0
Original file line number Diff line number Diff line change @@ -541,7 +541,7 @@ def _proc_np_hv(
541541 blb = np .array (blb_raw >= 0.5 , dtype = np .int32 ) # noqa: PLR2004
542542
543543 blb = ndimage .label (blb )[0 ]
544- blb = remove_small_objects (blb , min_size = 10 )
544+ blb = remove_small_objects (blb , max_size = 9 )
545545 blb [blb > 0 ] = 1 # background is 0 already
546546
547547 h_dir = cv2 .normalize (
@@ -610,7 +610,8 @@ def _proc_np_hv(
610610 "ignore" ,
611611 message = "Only one label was provided to `remove_small_objects`" ,
612612 )
613- marker = remove_small_objects (marker , min_size = obj_size )
613+ # scikit-image changed API in 0.26.0 from min_size to max_size.
614+ marker = remove_small_objects (marker , max_size = obj_size - 1 )
614615
615616 return watershed (dist , markers = marker , mask = blb )
616617
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ def _proc_ls(ls_map: np.ndarray) -> np.ndarray:
158158 epith_all = epith_all > 0
159159 epith_mask = morphology .remove_small_objects (
160160 epith_all ,
161- min_size = min_size ,
161+ max_size = min_size - 1 , # scikit-image >0.26.0
162162 ).astype ("uint8" )
163163 epith_edited = epith_mask * ls_map
164164 epith_edited = epith_edited .astype ("uint8" )
Original file line number Diff line number Diff line change @@ -603,7 +603,7 @@ def postproc(
603603 pred_map = raw_maps [0 ].compute () if is_dask else raw_maps [0 ]
604604 pred_bin = np .argmax (pred_map , axis = 2 )
605605 pred_inst = ndimage .label (pred_bin )[0 ]
606- pred_inst = morphology .remove_small_objects (pred_inst , min_size = 50 )
606+ pred_inst = morphology .remove_small_objects (pred_inst , max_size = 49 )
607607 canvas = np .zeros (pred_inst .shape [:2 ], dtype = np .int32 )
608608 # if margin is zero, there could be arrays of size zero.
609609 max_value = 0 if not np .any (pred_inst ) else np .max (pred_inst )
Original file line number Diff line number Diff line change @@ -619,7 +619,7 @@ def postproc(
619619
620620 """
621621 masks = preds > thresh
622- masks = remove_small_objects (masks , min_size = min_size )
622+ masks = remove_small_objects (masks , max_size = min_size - 1 )
623623 masks = remove_small_holes (masks , area_threshold = min_hole_size )
624624 if do_reconstruction :
625625 for i in range (len (masks )):
You can’t perform that action at this time.
0 commit comments