Redesign of WSIReader
See original GitHub issueRight now WSIReader
is based on ImageReader
class with read
and get_data
methods. However, reading whole slide images regardless of the library to use have its own additional complexities that are not captured in the base class.
Also, currently, we have implemented different backends cuCIM
, OpenSlide
, and TiffFile` through if statements!
My suggestion would be to have a WSIReader
base class that implements those additional functionalities such as evaluating the level based on ppm/resolution, validating the pyramidal levels, etc. along with abstract methods that each of the libraries has to implement. In this way, we can implement each backend in different classes like CuCIMReader
(for cuCIM) inherited from WSIReader
.
This not only makes the code cleaner and more readable but also decouples MONAI integration of third-party WSI reader libraries and makes the future contribution easier and safer.
The overall structure would look like this: (will update #4005)
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
You are right! Here we are implementing a specific use of tifffile library, so we should be more clear. I’ll think of a better name for that.
I think this is a good change though
WSIReader
should still inherit fromImageReader
so that the API remains compatible.TiffFileReader
isn’t just reading TIFF images but specifically those storing slide data so this class should have a more specific name to not appear to be a general purpose TIFF image reader,PILReader
is meant for that instead.