Skip to content

Commit dae4264

Browse files
committed
Add raise_on_missing_reader flag to LoadImaged dictionary wrapper
- Pass through raise_on_missing_reader parameter to underlying LoadImage - Update docstring to document the new parameter - Ensure consistent behavior between array and dictionary versions
1 parent 3db882b commit dae4264

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

monai/transforms/io/dictionary.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def __init__(
8787
prune_meta_sep: str = ".",
8888
allow_missing_keys: bool = False,
8989
expanduser: bool = True,
90+
raise_on_missing_reader: bool = False,
9091
*args,
9192
**kwargs,
9293
) -> None:
@@ -123,6 +124,8 @@ def __init__(
123124
e.g. ``prune_meta_pattern=".*_code$", prune_meta_sep=" "`` removes meta keys that ends with ``"_code"``.
124125
allow_missing_keys: don't raise exception if key is missing.
125126
expanduser: if True cast filename to Path and call .expanduser on it, otherwise keep filename as is.
127+
raise_on_missing_reader: if True, raise OptionalImportError when a specified reader is not available,
128+
otherwise attempt to use fallback readers. Default is False to maintain backward compatibility.
126129
args: additional parameters for reader if providing a reader name.
127130
kwargs: additional parameters for reader if providing a reader name.
128131
"""
@@ -136,6 +139,7 @@ def __init__(
136139
prune_meta_pattern,
137140
prune_meta_sep,
138141
expanduser,
142+
raise_on_missing_reader,
139143
*args,
140144
**kwargs,
141145
)

0 commit comments

Comments
 (0)