File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -399,10 +399,8 @@ def __init__( # skipcq: PY-R1000 # noqa: PLR0915
399399 `units`. Expected to be positive and of (height, width).
400400 Note, this is not at level 0.
401401 resolution (Resolution):
402- Check (:class:`.WSIReader`) for details. When
403- `mode='tile'`, value is fixed to be `resolution=1.0` and
404- `units='baseline'` units: check (:class:`.WSIReader`) for
405- details.
402+ Requested resolution corresponding to units. Check
403+ (:class:`WSIReader`) for details.
406404 units (Units):
407405 Units in which `resolution` is defined.
408406 auto_get_mask (bool):
Original file line number Diff line number Diff line change @@ -1052,6 +1052,21 @@ def _run_wsi_mode(
10521052 patch_mode = False ,
10531053 ioconfig = self ._ioconfig ,
10541054 )
1055+
1056+ # get units and resolution from dataloader.
1057+ dataloader_units = dataloader .dataset .units
1058+ dataloader_resolution = dataloader .dataset .resolution
1059+
1060+ slide_resolution = (1.0 , 1.0 )
1061+ if dataloader_units != "baseline" :
1062+ wsimeta_dict = dataloader .dataset .reader .info .as_dict ()
1063+ slide_resolution = wsimeta_dict [dataloader_units ]
1064+
1065+ scale_factor = tuple (np .divide (slide_resolution , dataloader_resolution ))
1066+
1067+ if dataloader_units != "mpp" :
1068+ scale_factor = tuple (np .divide (dataloader_resolution , slide_resolution ))
1069+
10551070 raw_predictions = self .infer_wsi (
10561071 dataloader = dataloader ,
10571072 save_path = save_path [image ],
@@ -1062,6 +1077,7 @@ def _run_wsi_mode(
10621077 ** kwargs ,
10631078 )
10641079 kwargs ["output_file" ] = out [image ]
1080+ kwargs ["scale_factor" ] = scale_factor
10651081 out [image ] = self .save_predictions (
10661082 processed_predictions = processed_predictions ,
10671083 output_type = output_type ,
You can’t perform that action at this time.
0 commit comments