Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure location as tuple in wsireader #8007

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions monai/data/wsi_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from monai.data.utils import iter_patch_position
from monai.data.wsi_reader import BaseWSIReader, WSIReader
from monai.transforms import ForegroundMask, Randomizable, apply_transform
from monai.utils import convert_to_dst_type, ensure_tuple_rep
from monai.utils import convert_to_dst_type, ensure_tuple, ensure_tuple_rep
from monai.utils.enums import CommonKeys, ProbMapKeys, WSIPatchKeys

__all__ = ["PatchWSIDataset", "SlidingPatchWSIDataset", "MaskedPatchWSIDataset"]
Expand Down Expand Up @@ -123,9 +123,9 @@ def _get_label(self, sample: dict):
def _get_location(self, sample: dict):
if self.center_location:
size = self._get_size(sample)
return [sample[WSIPatchKeys.LOCATION][i] - size[i] // 2 for i in range(len(size))]
return ensure_tuple(sample[WSIPatchKeys.LOCATION][i] - size[i] // 2 for i in range(len(size)))
else:
return sample[WSIPatchKeys.LOCATION]
return ensure_tuple(sample[WSIPatchKeys.LOCATION])

def _get_level(self, sample: dict):
if self.patch_level is None:
Expand Down
Loading