Skip to content

Commit

Permalink
fix-issue-7557
Browse files Browse the repository at this point in the history
Signed-off-by: staydelight <[email protected]>
  • Loading branch information
staydelight committed Jun 13, 2024
1 parent 1a3da38 commit 37d19ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions monai/transforms/io/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,7 @@ def __call__(self, img: MetaTensor):
img (MetaTensor): The input image with metadata.
"""
if "saved_to" not in img.meta:
raise KeyError(
"The 'saved_to' key is missing from the image metadata. Ensure SaveImage is configured with savepath_in_metadict=True."
)
raise KeyError("Missing 'saved_to' key in metadata. Check SaveImage savepath_in_metadict.")

input_path = img.meta["filename_or_obj"]
output_path = img.meta["saved_to"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mapping_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_mapping_json(self, load_params, filenames, expected_shape, savepath_in_
the_exception = cm.exception
self.assertIsInstance(the_exception.__cause__, KeyError)
self.assertIn(
"The 'saved_to' key is missing from the image metadata. Ensure SaveImage is configured with savepath_in_metadict=True.",
"Missing 'saved_to' key in metadata. Check SaveImage savepath_in_metadict.",
str(the_exception.__cause__),
)

Expand Down

0 comments on commit 37d19ed

Please sign in to comment.