From 8769f6444c18a2ab6c45d5948213b952ffbfbf1e Mon Sep 17 00:00:00 2001 From: bluna301 Date: Thu, 12 Feb 2026 14:15:00 -0500 Subject: [PATCH] added required DICOM SR tags; fixed FileMetaInfo; Processing Algorithm typo fix Signed-off-by: bluna301 --- monai/deploy/operators/dicom_seg_writer_operator.py | 4 ++-- monai/deploy/operators/dicom_text_sr_writer_operator.py | 7 ++++++- monai/deploy/operators/dicom_utils.py | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/monai/deploy/operators/dicom_seg_writer_operator.py b/monai/deploy/operators/dicom_seg_writer_operator.py index ff1c1d95..b9c96fb5 100644 --- a/monai/deploy/operators/dicom_seg_writer_operator.py +++ b/monai/deploy/operators/dicom_seg_writer_operator.py @@ -1,4 +1,4 @@ -# Copyright 2021-2025 MONAI Consortium +# Copyright 2021-2026 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -382,7 +382,7 @@ def create_dicom_seg(self, image: np.ndarray, dicom_series: DICOMSeries, output_ seg_purpose_of_reference_code = Dataset() seg_purpose_of_reference_code.CodeValue = "Newcode1" seg_purpose_of_reference_code.CodingSchemeDesignator = "99IHE" - seg_purpose_of_reference_code.CodeMeaning = '"Processing Algorithm' + seg_purpose_of_reference_code.CodeMeaning = "Processing Algorithm" seq_purpose_of_reference_code.append(seg_purpose_of_reference_code) seq_contributing_equipment = PyDicomSequence() diff --git a/monai/deploy/operators/dicom_text_sr_writer_operator.py b/monai/deploy/operators/dicom_text_sr_writer_operator.py index 273236bb..96a78ae0 100644 --- a/monai/deploy/operators/dicom_text_sr_writer_operator.py +++ b/monai/deploy/operators/dicom_text_sr_writer_operator.py @@ -1,4 +1,4 @@ -# Copyright 2021-2022 MONAI Consortium +# Copyright 2021-2026 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -96,6 +96,7 @@ def __init__( # "SR" for Structured Report. # Media Storage SOP Class UID, e.g., # "1.2.840.10008.5.1.4.1.1.88.11" for Basic Text SR Storage + # "1.2.840.10008.5.1.4.1.1.88.22" for Enhanced SR # "1.2.840.10008.5.1.4.1.1.104.1" for Encapsulated PDF Storage, # "1.2.840.10008.5.1.4.1.1.88.34" for Comprehensive 3D SR IOD # "1.2.840.10008.5.1.4.1.1.66.4" for Segmentation Storage @@ -192,8 +193,12 @@ def write(self, content_text, dicom_series: Optional[DICOMSeries], output_dir: P ) # SR specific + ds.CompletionFlag = "COMPLETE" # Estimated degree of completeness. ds.VerificationFlag = "UNVERIFIED" # Not attested by a legally accountable person. + ds.ReferencedPerformedProcedureStepSequence = Sequence([]) # Required by SR Document Series + ds.PerformedProcedureCodeSequence = Sequence([]) # Required by SR Document General + # Per recommendation of IHE Radiology Technical Framework Supplement # AI Results (AIR) Rev1.1 - Trial Implementation # Specifically for Qualitative Findings, diff --git a/monai/deploy/operators/dicom_utils.py b/monai/deploy/operators/dicom_utils.py index b2f903a5..5b75afe8 100644 --- a/monai/deploy/operators/dicom_utils.py +++ b/monai/deploy/operators/dicom_utils.py @@ -1,4 +1,4 @@ -# Copyright 2022 MONAI Consortium +# Copyright 2022-2026 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -198,8 +198,8 @@ def write_common_modules( # File meta info data set file_meta = Dataset() - file_meta.FileMetaInformationGroupLength = 198 - file_meta.FileMetaInformationVersion = bytes("01", "utf-8") # '\x00\x01' + # file_meta.FileMetaInformationGroupLength = 198 + file_meta.FileMetaInformationVersion = b"\x00\x01" # '\x00\x01' file_meta.MediaStorageSOPClassUID = sop_class_uid file_meta.MediaStorageSOPInstanceUID = my_sop_instance_uid @@ -282,7 +282,7 @@ def write_common_modules( ds_purpose_of_reference_code = Dataset() ds_purpose_of_reference_code.CodeValue = "Newcode1" ds_purpose_of_reference_code.CodingSchemeDesignator = "99IHE" - ds_purpose_of_reference_code.CodeMeaning = '"Processing Algorithm' + ds_purpose_of_reference_code.CodeMeaning = "Processing Algorithm" seq_purpose_of_reference_code.append(ds_purpose_of_reference_code) seq_contributing_equipment = Sequence()