Skip to content

Commit 55b8430

Browse files
committed
DCO Remediation Commit for Mohammad Amanour Rahman <[email protected]>
I, Mohammad Amanour Rahman <[email protected]>, hereby add my Signed-off-by to this commit: 7ce29a1 I, Mohammad Amanour Rahman <[email protected]>, hereby add my Signed-off-by to this commit: cc0c951 I, Mohammad Amanour Rahman <[email protected]>, hereby add my Signed-off-by to this commit: 3e92d74 I, Mohammad Amanour Rahman <[email protected]>, hereby add my Signed-off-by to this commit: f563b89 I, Mohammad Amanour Rahman <[email protected]>, hereby add my Signed-off-by to this commit: a234edf I, Mohammad Amanour Rahman <[email protected]>, hereby add my Signed-off-by to this commit: 2d423b8 Signed-off-by: Mohammad Amanour Rahman <[email protected]>
1 parent 2d423b8 commit 55b8430

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

monai/data/image_writer.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,26 @@ def resolve_writer(ext_name, error_if_not_found=True) -> Sequence:
115115
continue
116116
except Exception: # other writer init errors indicating it exists
117117
avail_writers.append(_writer)
118-
if not avail_writers and error_if_not_found:
119-
RECOMMENDED_PACKAGES = {
120-
"png": "Pillow",
121-
"jpg": "Pillow",
122-
"jpeg": "Pillow",
123-
"nii": "nibabel or SimpleITK",
124-
"nii.gz": "nibabel or SimpleITK",
125-
"nrrd": "pynrrd",
126-
"tif": "Pillow or tifffile",
127-
"tiff": "Pillow or tifffile",
128-
}
129-
130-
fmt_clean = fmt.replace(".", "").lower()
131-
package_hint = RECOMMENDED_PACKAGES.get(fmt_clean, "")
132-
133-
msg = f"No ImageWriter backend found for {fmt}."
134-
if package_hint:
135-
msg += f" Please install '{package_hint}' (e.g., pip install {package_hint})."
118+
if not avail_writers and error_if_not_found:
119+
recommended_packages = {
120+
"png": "Pillow",
121+
"jpg": "Pillow",
122+
"jpeg": "Pillow",
123+
"nii": "nibabel or SimpleITK",
124+
"nii.gz": "nibabel or SimpleITK",
125+
"nrrd": "pynrrd",
126+
"tif": "Pillow or tifffile",
127+
"tiff": "Pillow or tifffile",
128+
}
129+
130+
fmt_clean = fmt.replace(".", "").lower()
131+
package_hint = recommended_packages.get(fmt_clean, "")
132+
133+
msg = f"No ImageWriter backend found for {fmt}."
134+
if package_hint:
135+
msg += f" Please install '{package_hint}' (e.g., pip install {package_hint})."
136136

137-
raise OptionalImportError(msg)
137+
raise OptionalImportError(msg)
138138

139139
writer_tuple = ensure_tuple(avail_writers)
140140
SUPPORTED_WRITERS[fmt] = writer_tuple

0 commit comments

Comments
 (0)