changeset 4139:a4f28efdfccf

"maxTagLength" must be explicitly given to ParsedDicomFile::ExtractDicomSummary()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Aug 2020 18:25:47 +0200
parents 1a26daefc3fe
children 0ddc5297a8ab
files OrthancFramework/Sources/DicomParsing/DicomModification.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Sources/QueryRetrieveHandler.cpp OrthancServer/Sources/ServerIndex.cpp OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp OrthancServer/Sources/ServerToolbox.cpp
diffstat 8 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/DicomModification.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -1006,7 +1006,7 @@
     // is provided
     if (identifierGenerator_ != NULL)
     {
-      toModify.ExtractDicomSummary(currentSource_);
+      toModify.ExtractDicomSummary(currentSource_, ORTHANC_MAXIMUM_TAG_LENGTH);
     }
 
     // (1) Make sure the relationships are updated with the ids that we force too
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -1655,18 +1655,21 @@
   }
 
 
-  void ParsedDicomFile::ExtractDicomSummary(DicomMap& target) const
+  void ParsedDicomFile::ExtractDicomSummary(DicomMap& target,
+                                            unsigned int maxTagLength) const
   {
     std::set<DicomTag> ignoreTagLength;
     FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset(),
-                                         ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+                                         maxTagLength, ignoreTagLength);
   }
 
 
   void ParsedDicomFile::ExtractDicomSummary(DicomMap& target,
+                                            unsigned int maxTagLength,
                                             const std::set<DicomTag>& ignoreTagLength) const
   {
-    FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset(), ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+    FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset(),
+                                         maxTagLength, ignoreTagLength);
   }
 
 
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h	Thu Aug 06 18:25:47 2020 +0200
@@ -244,9 +244,21 @@
 
     void ChangeEncoding(Encoding target);
 
-    void ExtractDicomSummary(DicomMap& target) const;
+    /**
+     * The DICOM tags with a string whose size is greater than
+     * "maxTagLength", are replaced by a DicomValue whose type is
+     * "DicomValue_Null". If "maxTagLength" is zero, all the leaf tags
+     * are included, independently of their length.
+     **/
+    void ExtractDicomSummary(DicomMap& target,
+                             unsigned int maxTagLength) const;
 
+    /**
+     * This flavor can be used to bypass the "maxTagLength" limitation
+     * on a selected set of DICOM tags.
+     **/
     void ExtractDicomSummary(DicomMap& target,
+                             unsigned int maxTagLength,
                              const std::set<DicomTag>& ignoreTagLength) const;
 
     bool LookupTransferSyntax(std::string& result);
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -572,7 +572,7 @@
              * interpretation, and with windowing parameters.
              **/ 
             ServerContext::DicomCacheLocker locker(context, publicId);
-            locker.GetDicom().ExtractDicomSummary(dicom);
+            locker.GetDicom().ExtractDicomSummary(dicom, ORTHANC_MAXIMUM_TAG_LENGTH);
           }
         }
         catch (OrthancException& e)
--- a/OrthancServer/Sources/QueryRetrieveHandler.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancServer/Sources/QueryRetrieveHandler.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -37,7 +37,6 @@
 #include "OrthancConfiguration.h"
 
 #include "../../OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.h"
-#include "../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h"
 #include "../../OrthancFramework/Sources/Logging.h"
 #include "../../OrthancFramework/Sources/Lua/LuaFunctionCall.h"
 #include "LuaScripting.h"
@@ -160,7 +159,7 @@
                                        size_t i)
   {
     Run();
-    answers_.GetAnswer(i).ExtractDicomSummary(target);
+    answers_.GetAnswer(i).ExtractDicomSummary(target, 0 /* don't truncate tags */);
   }
 
   
--- a/OrthancServer/Sources/ServerIndex.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancServer/Sources/ServerIndex.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -2468,7 +2468,7 @@
   void ServerIndex::ReconstructInstance(ParsedDicomFile& dicom)
   {
     DicomMap summary;
-    dicom.ExtractDicomSummary(summary);
+    dicom.ExtractDicomSummary(summary, ORTHANC_MAXIMUM_TAG_LENGTH);
 
     DicomInstanceHasher hasher(summary);
 
--- a/OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancServer/Sources/ServerJobs/MergeStudyJob.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -201,7 +201,7 @@
 
     {
       ServerContext::DicomCacheLocker locker(GetContext(), instances.front());
-      locker.GetDicom().ExtractDicomSummary(dicom);
+      locker.GetDicom().ExtractDicomSummary(dicom, ORTHANC_MAXIMUM_TAG_LENGTH);
     }
 
     const std::set<DicomTag> moduleTags = removals_;
--- a/OrthancServer/Sources/ServerToolbox.cpp	Thu Aug 06 17:56:10 2020 +0200
+++ b/OrthancServer/Sources/ServerToolbox.cpp	Thu Aug 06 18:25:47 2020 +0200
@@ -269,7 +269,7 @@
 
           // Update the tags of this resource
           DicomMap dicomSummary;
-          dicom.ExtractDicomSummary(dicomSummary);
+          dicom.ExtractDicomSummary(dicomSummary, ORTHANC_MAXIMUM_TAG_LENGTH);
 
           database.ClearMainDicomTags(resource);