Skip to content

incorrect error message when reader is specified in LoadImage #3787

Description

@wyli

Describe the bug

from monai.transforms import LoadImage

LoadImage(reader="itkreader")("noname")

current message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Documents/MONAI/monai/transforms/io/array.py", line 210, in __call__
    f"cannot find a suitable reader for file: {filename}.\n"
RuntimeError: cannot find a suitable reader for file: noname.
    Please install the reader libraries, see also the installation instructions:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies.
   The current registered: [<monai.data.image_reader.ITKReader object at 0x7f806d04b090>, <monai.data.image_reader.NumpyReader object at 0x7f806c8b2210>, <monai.data.image_reader.PILReader object at 0x7f8060942e90>, <monai.data.image_reader.NibabelReader object at 0x7f8099395b10>, <monai.data.image_reader.ITKReader object at 0x7f806d045e50>].

but the file noname doesn't exist.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions