Repository navigation
Cast SlidingPatchWSIDataset mask locations to int - #9170
caitlin-leonard wants to merge 1 commit into
Conversation
Fixes Project-MONAI#9135 Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: Caitlin Leonard <caitlinsimona@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Fixes #9135.
Description
SlidingPatchWSIDatasetcomputes each patch's mask location withnp.round(...), which rounds the values but keeps them as floats.ProbMapProducerthen uses these locations as array indices, whichraises an
IndexErroron NumPy 2.x.This adds
.astype(int)to that calculation, matching whatMaskedPatchWSIDatasetalready does for the same key.The test change adds an assertion to
test_read_patches_largethat themask location dtype is an integer. It fails on
dev(the values arefloats) and passes with this change.
Tested locally with the OpenSlide backend:
tests/data/test_sliding_patch_wsi_dataset.py,test_masked_patch_wsi_dataset.py,test_patch_wsi_dataset.pyandtests/handlers/test_handler_prob_map_producer.py.Types of changes