Retrieving filename and coordinates from WSIReader #4794
-
When using WSIReader is there a simple way to retrieve the image coordinates and source filename from the dataset? I am trying to assign a confidence score to a tile and it is not obvious how to retrieve the metadata required to do so. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
Hi @drbeh , Could you please help share some best practices about this question? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
The dataloader batch_data instance seems to represent data for a single slide. Batch_data (from loader) contains dict_keys(['image', 'label', 'image_meta_dict', 'original_spatial_shape', patch_location, patch_size, num_patches, 'offset', 'label_transforms']), and batch_data[image_meta_dict] contains dict_keys(['backend', 'original_channel_dim', 'spatial_shape', 'num_patches', 'path', 'patch_location', 'patch_size', 'patch_level', 'filename_or_obj', affine, space]. This provides all the metadata I need on the slide-level, but I can't find anything on the patch level. I don't see any metadata associated with the tiles themselves. print(batch_data[image_meta_dict]) {'backend': ['cucim'], 'original_channel_dim': tensor([0]), 'spatial_shape': tensor([[19291, 20916]]), 'num_patches': tensor([1]), 'path': ['/slides/1.svs'], 'patch_location': tensor([[0, 0]]), 'patch_size': tensor([[19291, 20916]]), 'patch_level': tensor([1]), 'filename_or_obj': ['/slides/1.svs'], affine: tensor([[[1., 0., 0., 0.], |
Beta Was this translation helpful? Give feedback.
-
That did the trick! Thanks for your efforts. |
Beta Was this translation helpful? Give feedback.
-
Glad that it worked! The Project-MONAI/tutorials#841 is going to be merged soon, so it will be available on main branch too. |
Beta Was this translation helpful? Give feedback.
Glad that it worked! The Project-MONAI/tutorials#841 is going to be merged soon, so it will be available on main branch too.