changeset 5151:a72e00a23191

allow OtherPatientIDs as a valid tag name as an input since this name is still used in outputs
author Alain Mazy <am@osimis.io>
date Tue, 31 Jan 2023 16:21:44 +0100
parents 6ff13c95f62f
children dce028ec0fe9
files OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Mon Jan 30 11:31:12 2023 +0100
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue Jan 31 16:21:44 2023 +0100
@@ -1253,9 +1253,22 @@
   }
 
 
+  static bool GetTagFromNameInternal(DicomTag& tag, const std::string& tagName)
+  {
+    // conversion from old tag names (ex: RETIRED_OtherPatientIDs is the new name for OtherPatientIDs that is still a valid name for DICOM_TAG_OTHER_PATIENT_IDS)
+    if (tagName == "OtherPatientIDs")
+    {
+      tag = DICOM_TAG_OTHER_PATIENT_IDS;
+      return true;
+    }
+
+    return false;
+  }
+
   std::string FromDcmtkBridge::GetTagName(const DicomTag& t,
                                           const std::string& privateCreator)
   {
+    
     DcmTag tag(t.GetGroup(), t.GetElement());
 
     if (!privateCreator.empty())
@@ -1315,6 +1328,12 @@
     }
     else
     {
+      DicomTag dcmTag(0, 0);
+      if (GetTagFromNameInternal(dcmTag, name))
+      {
+        return dcmTag;
+      }
+
       CLOG(INFO, DICOM) << "Unknown DICOM tag: \"" << name << "\"";
       throw OrthancException(ErrorCode_UnknownDicomTag, name, false);
     }