Skip to content
Merged
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
7 changes: 6 additions & 1 deletion monai/data/image_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ class WSIReader(ImageReader):

"""

def __init__(self, reader_lib: str = "cuClaraImage"):
def __init__(self, reader_lib: str = "OpenSlide"):
super().__init__()
self.reader_lib = reader_lib.lower()
if self.reader_lib == "openslide":
Expand Down Expand Up @@ -672,6 +672,11 @@ def read(self, data: Union[Sequence[str], str, np.ndarray], **kwargs):
data: file name or a list of file names to read.

"""
if (self.reader_lib == "openslide") and (not has_osl):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could have these logics even earlier for example between line 646 and 652?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no, Nic is instantiating this class in LoadImage, so the error shouldn't be raised in __init__ (it used to be raise without having has_osl and has_cux). The first place that it can be raised here.

I agree that the best place would be when the class is instantiating but for that purpose LoadImage need to be changed:

self.readers: List[ImageReader] = [ITKReader(), NumpyReader(), PILReader(), NibabelReader(), WSIReader()]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure you're right!

(@Nic-Ma I'm approving this for now, perhaps we need another iteration to revise the base API?)

raise ImportError("No module named 'openslide'")
elif (self.reader_lib == "cuclaraimage") and (not has_cux):
raise ImportError("No module named 'cuimage'")

img_: List = []

filenames: Sequence[str] = ensure_tuple(data)
Expand Down