Skip to content

Commit

Permalink
Ensure location as tuple in wsireader (#8007)
Browse files Browse the repository at this point in the history
Fixes #8006

### Description

Ensure location as tuple in wsireader

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: YunLiu <[email protected]>
  • Loading branch information
KumoLiu authored Aug 9, 2024
1 parent 660891f commit 4a3117f
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 4a3117f

Please sign in to comment.