Commit 0940296
committed
fix: raise exception when LoadImage reader is specified but not installed
Previously, when a user explicitly specified a reader (e.g. LoadImage(reader='ITKReader'))
but the required optional package was not installed, MONAI would silently warn and fall
back to the next available reader. This silent fallback is surprising and hard to debug.
This change raises a RuntimeError instead, giving the user a clear actionable message
that explains what happened and how to fix it (install the package or omit the reader
argument to use automatic fallback).
Backward compatibility is preserved: if no reader is specified, the existing warn-and-
skip behavior for missing optional packages is unchanged.
Fixes #7437
Signed-off-by: Alan Bishop <alanbishop@users.noreply.github.com>1 parent daaedaa commit 0940296
2 files changed
Lines changed: 37 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
501 | 532 | | |
502 | 533 | | |
0 commit comments