changeset 4136:2724977419fb

Fix DICOM SCP filters if some query tag has more than 256 characters
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Aug 2020 15:55:03 +0200
parents baf8e21e91cb
children 6774605d4341
files NEWS OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp OrthancServer/Sources/DicomInstanceToStore.cpp
diffstat 13 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Aug 04 13:02:02 2020 +0200
+++ b/NEWS	Thu Aug 06 15:55:03 2020 +0200
@@ -1,6 +1,8 @@
 Pending changes in the mainline
 ===============================
 
+* Fix DICOM SCP filters if some query tag has more than 256 characters
+
 
 Version 1.7.2 (2020-07-08)
 ==========================
--- a/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -82,7 +82,7 @@
       else
       {
         DicomMap m;
-        FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers);
+        FromDcmtkBridge::ExtractDicomSummary(m, *responseIdentifiers, 0 /* don't truncate tags */);
         
         if (!m.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
         {
--- a/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -265,7 +265,7 @@
               }
 
               DicomMap input;
-              FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers);
+              FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */);
 
               DicomMap filtered;
               FixFindQuery(filtered, input);
--- a/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -148,7 +148,7 @@
       if (data.lastRequest_ == NULL)
       {
         DicomMap input;
-        FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers);
+        FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */);
 
         try
         {
--- a/OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -166,7 +166,7 @@
       if (data.lastRequest_ == NULL)
       {
         DicomMap input;
-        FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers);
+        FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */);
 
         try
         {
--- a/OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -162,7 +162,7 @@
           {
             std::set<DicomTag> ignoreTagLength;
             
-            FromDcmtkBridge::ExtractDicomSummary(summary, **imageDataSet);
+            FromDcmtkBridge::ExtractDicomSummary(summary, **imageDataSet, 0 /* don't truncate tags */);
             FromDcmtkBridge::ExtractDicomAsJson(dicomJson, **imageDataSet, ignoreTagLength);
 
             if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer, **imageDataSet))
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -2038,10 +2038,10 @@
 
   void FromDcmtkBridge::ExtractDicomSummary(DicomMap& target, 
                                             DcmItem& dataset,
+                                            unsigned int maxStringLength,
                                             const std::set<DicomTag>& ignoreTagLength)
   {
-    ExtractDicomSummary(target, dataset,
-                        ORTHANC_MAXIMUM_TAG_LENGTH,
+    ExtractDicomSummary(target, dataset, maxStringLength,
                         GetDefaultDicomEncoding(), ignoreTagLength);
   }
 
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h	Thu Aug 06 15:55:03 2020 +0200
@@ -227,13 +227,15 @@
 
     static void ExtractDicomSummary(DicomMap& target, 
                                     DcmItem& dataset,
+                                    unsigned int maxStringLength,
                                     const std::set<DicomTag>& ignoreTagLength);
 
     static void ExtractDicomSummary(DicomMap& target, 
-                                    DcmItem& dataset)
+                                    DcmItem& dataset,
+                                    unsigned int maxStringLength)
     {
       std::set<DicomTag> none;
-      ExtractDicomSummary(target, dataset, none);
+      ExtractDicomSummary(target, dataset, maxStringLength, none);
     }
 
     static void ExtractDicomAsJson(Json::Value& target, 
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -357,7 +357,7 @@
 
     // Extract information about the image structure
     DicomMap tags;
-    FromDcmtkBridge::ExtractDicomSummary(tags, dicom);
+    FromDcmtkBridge::ExtractDicomSummary(tags, dicom, 0 /* don't truncate tags */);
 
     DicomImageInformation information(tags);
 
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -250,7 +250,7 @@
       // See also: http://support.dcmtk.org/wiki/dcmtk/howto/accessing-compressed-data
 
       DicomMap m;
-      FromDcmtkBridge::ExtractDicomSummary(m, dataset);
+      FromDcmtkBridge::ExtractDicomSummary(m, dataset, 0 /* don't truncate tags */);
 
       /**
        * Create an accessor to the raw values of the DICOM image.
@@ -322,7 +322,7 @@
                                                 bool ignorePhotometricInterpretation)
   {
     DicomMap m;
-    FromDcmtkBridge::ExtractDicomSummary(m, dataset);
+    FromDcmtkBridge::ExtractDicomSummary(m, dataset, 0 /* don't truncate tags */);
 
     DicomImageInformation info(m);
     PixelFormat format;
@@ -602,7 +602,7 @@
     }
 
     DicomMap m;
-    FromDcmtkBridge::ExtractDicomSummary(m, dataset);
+    FromDcmtkBridge::ExtractDicomSummary(m, dataset, 0 /* don't truncate tags */);
     DicomImageInformation info(m);
 
     std::unique_ptr<ImageAccessor> target(CreateImage(dataset, true));
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomDir.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -110,7 +110,7 @@
       lowerOffsets_[i] = lower;
 
       std::unique_ptr<DicomMap> entry(new DicomMap);
-      FromDcmtkBridge::ExtractDicomSummary(*entry, *item);
+      FromDcmtkBridge::ExtractDicomSummary(*entry, *item, 0 /* don't truncate tags */);
 
       if (next != 0)
       {
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -1657,14 +1657,14 @@
 
   void ParsedDicomFile::ExtractDicomSummary(DicomMap& target) const
   {
-    FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset());
+    FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset(), ORTHANC_MAXIMUM_TAG_LENGTH);
   }
 
 
   void ParsedDicomFile::ExtractDicomSummary(DicomMap& target,
                                             const std::set<DicomTag>& ignoreTagLength) const
   {
-    FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset(), ignoreTagLength);
+    FromDcmtkBridge::ExtractDicomSummary(target, *GetDcmtkObject().getDataset(), ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
   }
 
 
--- a/OrthancServer/Sources/DicomInstanceToStore.cpp	Tue Aug 04 13:02:02 2020 +0200
+++ b/OrthancServer/Sources/DicomInstanceToStore.cpp	Thu Aug 06 15:55:03 2020 +0200
@@ -246,7 +246,8 @@
       {
         summary_.Allocate();
         FromDcmtkBridge::ExtractDicomSummary(summary_.GetContent(), 
-                                             *parsed_.GetContent().GetDcmtkObject().getDataset());
+                                             *parsed_.GetContent().GetDcmtkObject().getDataset(),
+                                             ORTHANC_MAXIMUM_TAG_LENGTH);
       }
     
       if (!json_.HasContent())