WSIReader support for reading by mpp or magnification #4980
Copy link
Copy link
Closed
Labels
Pathology/MicroscopyDigital Pathology and Microscopy relatedDigital Pathology and Microscopy related
Description
In MONAI Pathology WG, we have discussed about the need for being able to read whole slide images at specific resolution (mpp or magnification) in addition to reading at a specific level. The feature request has been made by @cooperlab in cucim repo rapidsai/cucim#389.
I have discussed with cuCIM team about this topic and the conclusion was that it may be more useful to implement this functionality in MONA rather than in cucim for few reasons:
- this feature will be automatically supported for all the backends (cuCIM, OpenSlide, TiffFile, etc)
- the changes in magnification can be tracked in MONAI and be used to invert the process
To achieve this, the following functionalities need to be added to MOANI WSIReader:
- to find the next higher level to the requested mpp or magnification
- load the requested image that level with the appropriate pre-resized size
- resample/resize the image to the target mpp/magnification
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Pathology/MicroscopyDigital Pathology and Microscopy relatedDigital Pathology and Microscopy related
Type
Projects
- StatusShow more project fields💯 Complete
Activity
[-]`WSIReader` support for read by magnification[/-][+]`WSIReader` support for reading by magnification[/+]bhashemian commentedon Aug 23, 2022
@cooperlab what do you think?
cooperlab commentedon Aug 23, 2022
@drbeh LGTM. The guiding principles here are that developers shouldn't have to do a lot of calculations to determine what they have or what's been done to it, and to make clear what definitions like
locationcorrespond to.7 remaining items
NikolasSchmitz commentedon Feb 5, 2024
Hi @drbeh, sorry for the delay, but I am almost done with a first implementation. However, there are a few detailed questions I have to make sure that the function gives the desired output. Should I post them here, or should I ask them in the next monai core meeting?
bhashemian commentedon Feb 5, 2024
Hi @NikolasSchmitz, that is fantastic! It's best if you ask here to make sure that anyone with an answer can help and then followup in our next meeting. Thanks
NikolasSchmitz commentedon Feb 8, 2024
Okay, sure! Assuming the simple and straightforward solution to this matter, we would take the image at the next lower wsi level and then downscale it to a resolution that fits the user-provided mpp value.
In some cases, e.g., if the user-provided mpp is just slightly below the mpp of a certain wsi level, taking the next lower level might lead to unnecessarily compute-intensive downscaling operations. Let's say our wsi has an mpp of 1 at wsi level 1, and an mpp of 0.5 at wsi level 0. The user wants an image of the wsi that has 0.95 mpp. We would then have three options:
Personally, I would prefer 3. with a default value for tolerances atol and rtol. If one of the wsi levels is within the user's mpp +/- tolerance, then we can safely select the corresponding wsi level. Otherwise, we can scale down from the next larger representation of the wsi.
I attached three images showing three cases, where case 1 shows the simple and straightforward solution, and cases 2 and 3 show the above described issue without and with a tolerance range. I thought it might help to visualize the problem.
My questions are now:
cooperlab commentedon Feb 13, 2024
@NikolasSchmitz my suggestion re upscaling is that users should have to opt-in to enable this. It's uncommon but I really like the option to save compute if the next highest magnification is very large.
bhashemian commentedon Feb 13, 2024
@NikolasSchmitz Just to summarize what we discussed about your questions:
MONAI/monai/data/wsi_reader.py
Lines 147 to 171 in ff43028
Please do not hesitate to reach out if you have any other questions and thanks for contributing to MONAI.
NikolasSchmitz commentedon Feb 13, 2024
Thanks for the helpful feedback, everyone! I will create the draft pull request in the next days and implement what we discussed.
NikolasSchmitz commentedon Mar 24, 2024
This feature was added in #7574
Feature added: Get WSI at mpp (#7574)
Feature added: Get WSI at mpp (Project-MONAI#7574)