Commit a741d0b
committed
Fix LoadImage to raise OptionalImportError when specified reader is not available
- Modified LoadImage.__init__ to catch ValueError from look_up_option when reader name is not recognized
- Raise OptionalImportError instead of just warning when specified reader is not installed
- Added test case to verify the new behavior
This addresses issue Project-MONAI#7437 where LoadImage would silently fall back to another reader
when the specified reader (e.g., ITKReader) was not installed. Now it properly raises
an OptionalImportError to make it clear that the requested reader is not available.
Fixes: Project-MONAI#74371 parent 1dc0e68 commit a741d0b
File tree
2 files changed
+16
-5
lines changed- monai/transforms/io
- tests/transforms
2 files changed
+16
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
210 | 216 | | |
211 | 217 | | |
212 | | - | |
213 | | - | |
| 218 | + | |
| 219 | + | |
214 | 220 | | |
215 | | - | |
| 221 | + | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
439 | 444 | | |
440 | 445 | | |
441 | 446 | | |
| |||
0 commit comments