Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

ENH: Improve rtconvert log visibility #814

Merged
merged 2 commits into from
Oct 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions score.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def convert_nifti_to_zipped_dicom_rt(nifti_file: Path, reference_series: Path, s
:param config: Model config.
:param dicom_rt_zip_file_name: Target DICOM-RT zip file name, ending in .dcm.zip.
:param model_id: The AzureML model ID <model_name>:<ID>
:raises: RunTimeError if rtconvert fails.
:return: Path to DICOM-RT file.
"""
dicom_rt_file_path = scratch_folder / Path(dicom_rt_zip_file_name).with_suffix("")
Expand All @@ -229,8 +230,10 @@ def convert_nifti_to_zipped_dicom_rt(nifti_file: Path, reference_series: Path, s
modelId=model_id
)
# Log stdout, stderr from DICOM-RT conversion.
logging.debug("stdout: %s", stdout)
logging.debug("stderr: %s", stderr)
logging.info("DICOM-RT conversion stdout: %s", stdout)
if stderr != "":
logging.error("Errors detected during DICOM conversion: %s", stderr)
raise RuntimeError("Converting model output to DICOM failed. See stack trace for more details.")
dicom_rt_zip_file_path = scratch_folder / dicom_rt_zip_file_name
with zipfile.ZipFile(dicom_rt_zip_file_path, 'w') as dicom_rt_zip:
dicom_rt_zip.write(dicom_rt_file_path, dicom_rt_file_path.name)
Expand Down