changeset 6303:88b7494557f2

show a warning when adding an existing Patient MainDicomTags in the ExtraMainDicomTags at study level
author Alain Mazy <am@orthanc.team>
date Tue, 09 Sep 2025 14:26:51 +0200
parents 27fe473be5b7
children 36cd91a53403
files OrthancFramework/Sources/DicomFormat/DicomMap.cpp
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Tue Sep 09 12:54:00 2025 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomMap.cpp	Tue Sep 09 14:26:51 2025 +0200
@@ -258,6 +258,16 @@
         throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined", false);
       }
 
+      if (level == ResourceType_Study) // all patients main dicom tags are also copied at study level
+      {
+        std::set<DicomTag>& patientLevelTags = GetMainDicomTagsByLevelInternal(ResourceType_Patient);
+        
+        if (patientLevelTags.find(tag) != patientLevelTags.end())
+        {
+          throw OrthancException(ErrorCode_MainDicomTagsMultiplyDefined, tag.Format() + " is already defined", false);
+        }
+      }
+
       existingLevelTags.insert(tag);
       allMainDicomTags_.insert(tag);