Skip to content

better error messages for LoadImage #1768

@wyli

Description

@wyli

Is your feature request related to a problem? Please describe.
when the relevant optional reader packages are not installed,
the error messages are not very straight forward:

RuntimeError                              Traceback (most recent call last)
<ipython-input-2-078da3c1a088> in <module>
     48     tname = type(t).__name__
     49 
---> 50     data = t(data)
     51     image = data['image']
     52     label = data.get('label')
lib/python3.6/site-packages/monai/transforms/io/dictionary.py in __call__(self, data, reader)
    103         d = dict(data)
    104         for key in self.key_iterator(d):
--> 105             data = self._loader(d[key], reader)
    106             if self._loader.image_only:
    107                 if not isinstance(data, np.ndarray):
lib/python3.6/site-packages/monai/transforms/io/array.py in __call__(self, filename, reader)
    146 
    147         if reader is None:
--> 148             raise RuntimeError(f"can not find suitable reader for this file: {filename}.")
    149 
    150         img = reader.read(filename)

Describe the solution you'd like
the error message should recommend trying the install instructions https://docs.monai.io/en/latest/installation.html

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions