diff Plugins/Engine/OrthancPlugins.cpp @ 3709:1f4910999fe7

Fix issue #168 (Plugins can't read private tags from the configuration file)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Feb 2020 13:23:11 +0100
parents 4922bdd046dd
children 1c69af37d8ae 2a170a8f1faf
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp	Fri Feb 28 11:53:23 2020 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Fri Feb 28 13:23:11 2020 +0100
@@ -2922,9 +2922,18 @@
     std::string dicom;
 
     {
+      // Fix issue 168 (Plugins can't read private tags from the
+      // configuration file)
+      // https://bitbucket.org/sjodogne/orthanc/issues/168/
+      std::string privateCreator;
+      {
+        OrthancConfiguration::ReaderLock lock;
+        privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator();
+      }
+      
       std::auto_ptr<ParsedDicomFile> file
         (ParsedDicomFile::CreateFromJson(json, static_cast<DicomFromJsonFlags>(p.flags),
-                                         "" /* TODO - private creator */));
+                                         privateCreator));
 
       if (p.pixelData)
       {
@@ -3097,7 +3106,25 @@
     DcmTagKey tag2(tag.GetGroup(), tag.GetElement());
 
     DictionaryReadLocker locker;
-    const DcmDictEntry* entry = locker->findEntry(tag2, NULL);
+    const DcmDictEntry* entry = NULL;
+
+    if (tag.IsPrivate())
+    {
+      // Fix issue 168 (Plugins can't read private tags from the
+      // configuration file)
+      // https://bitbucket.org/sjodogne/orthanc/issues/168/
+      std::string privateCreator;
+      {
+        OrthancConfiguration::ReaderLock lock;
+        privateCreator = lock.GetConfiguration().GetDefaultPrivateCreator();
+      }
+
+      entry = locker->findEntry(tag2, privateCreator.c_str());
+    }
+    else
+    {
+      entry = locker->findEntry(tag2, NULL);
+    }
 
     if (entry == NULL)
     {