changeset 4012:dc6e7c7372ae

merge
author Alain Mazy <alain@mazy.be>
date Mon, 08 Jun 2020 16:04:43 +0200
parents 914b15dedae3 (diff) f0ee3f1db775 (current diff)
children 1e9f6d706237
files Core/LoggingUtils.h
diffstat 3 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomParsing/ParsedDicomFile.cpp	Mon Jun 08 15:54:30 2020 +0200
+++ b/Core/DicomParsing/ParsedDicomFile.cpp	Mon Jun 08 16:04:43 2020 +0200
@@ -657,6 +657,12 @@
   void ParsedDicomFile::ReplacePlainString(const DicomTag& tag,
                                            const std::string& utf8Value)
   {
+//    if (tag.GetElement() == 4257 && tag.GetGroup() == 1031)
+//    {
+//      Replace(tag, utf8Value, false, DicomReplaceMode_InsertIfAbsent,
+//              "99CZM_CapeCod_OctGeneral");
+//    }
+//    else
     if (tag.IsPrivate())
     {
       throw OrthancException(ErrorCode_InternalError,
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Mon Jun 08 15:54:30 2020 +0200
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Mon Jun 08 16:04:43 2020 +0200
@@ -303,7 +303,7 @@
                         const DicomArray& query,
                         const std::list<DicomTag>& sequencesToReturn,
                         const DicomMap* counters,
-                        const std::string& privateCreator)
+                        const std::string& defaultPrivateCreator)
   {
     DicomMap match;
 
@@ -373,7 +373,7 @@
     else
     {
       ParsedDicomFile dicom(result, GetDefaultDicomEncoding(),
-                            true /* be permissive, cf. issue #136 */, privateCreator);
+                            true /* be permissive, cf. issue #136 */, defaultPrivateCreator);
 
       for (std::list<DicomTag>::const_iterator tag = sequencesToReturn.begin();
            tag != sequencesToReturn.end(); ++tag)
@@ -396,7 +396,14 @@
             content.append(item);
           }
 
-          dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, privateCreator);
+          if (tag->IsPrivate())
+          {
+            dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, defaultPrivateCreator); // TODO: instead of taking the default private creator, we should get the private createor of the current "group"
+          }
+          else
+          {
+            dicom.Replace(*tag, content, false, DicomReplaceMode_InsertIfAbsent, "" /* no private creator */);
+          }
         }
       }
 
@@ -485,7 +492,7 @@
     const DicomMap&             query_;
     DicomArray                  queryAsArray_;
     const std::list<DicomTag>&  sequencesToReturn_;
-    std::string                 privateCreator_;
+    std::string                 defaultPrivateCreator_;
 
   public:
     LookupVisitor(DicomFindAnswers&  answers,
@@ -504,7 +511,7 @@
 
       {
         OrthancConfiguration::ReaderLock lock;
-        privateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator();
+        defaultPrivateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator();
       }
     }
 
@@ -547,7 +554,7 @@
       std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_));
 
       AddAnswer(answers_, mainDicomTags, dicomAsJson,
-                queryAsArray_, sequencesToReturn_, counters.get(), privateCreator_);
+                queryAsArray_, sequencesToReturn_, counters.get(), defaultPrivateCreator_);
     }
   };
 
--- a/OrthancServer/OrthancInitialization.cpp	Mon Jun 08 15:54:30 2020 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Mon Jun 08 16:04:43 2020 +0200
@@ -162,7 +162,7 @@
           (content.size() >= 4 && content[3].type() != Json::intValue) ||
           (content.size() >= 5 && content[4].type() != Json::stringValue))
       {
-        throw OrthancException(ErrorCode_BadFileFormat);
+        throw OrthancException(ErrorCode_BadFileFormat, "The definition of the '" + tags[i] + "' dictionary entry is invalid.");
       }
 
       DicomTag tag(FromDcmtkBridge::ParseTag(tags[i]));