Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion monai/data/wsi_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def _evaluate_patch_locations(self, sample):
)
)
# convert locations to mask_location
mask_locations = np.round((patch_locations + patch_size_0 // 2) / float(mask_ratio))
mask_locations = np.round((patch_locations + patch_size_0 // 2) / float(mask_ratio)).astype(int)

# fill out samples with location and metadata
sample[WSIPatchKeys.SIZE.value] = patch_size
Expand Down
4 changes: 3 additions & 1 deletion tests/data/test_sliding_patch_wsi_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from parameterized import parameterized

from monai.data import SlidingPatchWSIDataset
from monai.utils import WSIPatchKeys, optional_import, set_determinism
from monai.utils import ProbMapKeys, WSIPatchKeys, optional_import, set_determinism
from tests.test_utils import download_url_or_skip_test, testing_data_config

set_determinism(0)
Expand Down Expand Up @@ -250,6 +250,8 @@ def test_read_patches_large(self, input_parameters, expected):
steps = [round(expected[i]["ratio"] * s) for s in expected[i]["patch_size"]]
expected_location = tuple(expected[i]["step_loc"][j] * steps[j] for j in range(len(steps)))
assert_array_equal(sample["image"].meta[WSIPatchKeys.LOCATION], expected_location)
mask_location = np.asarray(sample["image"].meta[ProbMapKeys.LOCATION])
self.assertTrue(np.issubdtype(mask_location.dtype, np.integer))


@skipUnless(has_cucim, "Requires cucim")
Expand Down
Loading