@@ -6621,12 +6621,17 @@ class docstrings for more information.
66216621 else :
66226622 transformed_location , max_size = self .get_transformed_location (
66236623 location ,
6624- level_size ,
6624+ size ,
66256625 read_level ,
66266626 )
66276627 patch = self .wsi_reader .read_region (
66286628 transformed_location , read_level , max_size
66296629 )
6630+ # convert location to read resolution
6631+ transformed_location = (
6632+ int (transformed_location [0 ] / (2 ** read_level )),
6633+ int (transformed_location [1 ] / (2 ** read_level )),
6634+ )
66306635 patch = np .array (patch )
66316636
66326637 # Apply padding outside the slide area
@@ -6645,16 +6650,6 @@ class docstrings for more information.
66456650 else :
66466651 transformed_patch = self .transform_patch (patch , max_size )
66476652
6648- # Crop to get rid of black borders due to rotation
6649- if self .transform_type == "affine" :
6650- start_row = int (max_size [1 ] / 2 ) - int (level_size [1 ] / 2 )
6651- end_row = int (max_size [1 ] / 2 ) + int (level_size [1 ] / 2 )
6652- start_col = int (max_size [0 ] / 2 ) - int (level_size [0 ] / 2 )
6653- end_col = int (max_size [0 ] / 2 ) + int (level_size [0 ] / 2 )
6654- transformed_patch = transformed_patch [
6655- start_row :end_row , start_col :end_col , :
6656- ]
6657-
66586653 # Resize to desired size
66596654 post_read_scale = float (post_read_scale [0 ]), float (post_read_scale [1 ])
66606655 return utils .transforms .imresize (
@@ -6757,7 +6752,7 @@ class docstrings for more information.
67576752 # convert from requested to `baseline`
67586753 bounds_at_baseline = bounds
67596754 if coord_space == "resolution" :
6760- bounds_at_baseline = self ._bounds_at_resolution_to_baseline (
6755+ bounds_at_baseline = self .bounds_at_resolution_to_baseline (
67616756 bounds ,
67626757 resolution ,
67636758 units ,
@@ -6772,7 +6767,7 @@ class docstrings for more information.
67726767 bounds_at_read_level ,
67736768 _ ,
67746769 post_read_scale ,
6775- ) = self ._find_read_bounds_params (
6770+ ) = self .find_read_bounds_params (
67766771 bounds_at_baseline ,
67776772 resolution = resolution ,
67786773 units = units ,
@@ -6784,7 +6779,7 @@ class docstrings for more information.
67846779 bounds_at_read_level ,
67856780 size_at_requested ,
67866781 post_read_scale ,
6787- ) = self ._find_read_bounds_params (
6782+ ) = self .find_read_bounds_params (
67886783 bounds_at_baseline ,
67896784 resolution = resolution ,
67906785 units = units ,
@@ -6837,10 +6832,6 @@ class docstrings for more information.
68376832 else :
68386833 transformed_patch = self .transform_patch (patch , max_size )
68396834
6840- # Crop to get rid of black borders due to rotation
6841- if self .transform_type == "affine" :
6842- raise NotImplementedError
6843-
68446835 # Resize to desired size
68456836 post_read_scale = float (post_read_scale [0 ]), float (post_read_scale [1 ])
68466837 return utils .transforms .imresize (
0 commit comments