Skip to content

Commit

Permalink
put error/warning message in variable for reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhack47 authored and asim-shrestha committed Jan 8, 2023
1 parent d8b5f1d commit d5fdbeb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions rt_utils/rtstruct_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,9 @@ def validate_contour_image_in_series_data(
return

# ReferencedSOPInstanceUID is NOT available
if warning_only:
warnings.warn(
f"Loaded RTStruct references image(s) that are not contained in input series data. "
msg = f"Loaded RTStruct references image(s) that are not contained in input series data. "
+ f"Problematic image has SOP Instance Id: {contour_image.ReferencedSOPInstanceUID}"
)
if warning_only:
warnings.warn(msg)
else:
raise Exception(
f"Loaded RTStruct references image(s) that are not contained in input series data. "
+ f"Problematic image has SOP Instance Id: {contour_image.ReferencedSOPInstanceUID}"
)
raise Exception(msg)

0 comments on commit d5fdbeb

Please sign in to comment.