changeset 1929:cda5b0ab4ce5

ORTHANC_MAXIMUM_TAG_LENGTH made explicit
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Mar 2016 14:28:59 +0100
parents 84c7eaeb5244
children 1c147c3c3121
files OrthancServer/DicomInstanceToStore.cpp OrthancServer/DicomProtocol/DicomUserConnection.cpp OrthancServer/FromDcmtkBridge.cpp OrthancServer/FromDcmtkBridge.h OrthancServer/Internals/DicomFrameIndex.cpp OrthancServer/Internals/DicomImageDecoder.cpp OrthancServer/Internals/FindScp.cpp OrthancServer/Internals/MoveScp.cpp OrthancServer/Internals/StoreScp.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/ParsedDicomFile.cpp OrthancServer/Search/HierarchicalMatcher.cpp
diffstat 12 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomInstanceToStore.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/DicomInstanceToStore.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -106,6 +106,7 @@
       summary_.Allocate();
       FromDcmtkBridge::Convert(summary_.GetContent(), 
                                *parsed_.GetContent().GetDcmtkObject().getDataset(),
+                               ORTHANC_MAXIMUM_TAG_LENGTH,                               
                                Configuration::GetDefaultEncoding());
     }
     
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -396,6 +396,7 @@
       {
         DicomMap m;
         FromDcmtkBridge::Convert(m, *responseIdentifiers, 
+                                 ORTHANC_MAXIMUM_TAG_LENGTH,
                                  Configuration::GetDefaultEncoding());
 
         if (!m.HasTag(DICOM_TAG_QUERY_RETRIEVE_LEVEL))
--- a/OrthancServer/FromDcmtkBridge.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -306,6 +306,7 @@
 
   void FromDcmtkBridge::Convert(DicomMap& target, 
                                 DcmDataset& dataset,
+                                unsigned int maxStringLength,
                                 Encoding defaultEncoding)
   {
     Encoding encoding = DetectEncoding(dataset, defaultEncoding);
@@ -318,7 +319,7 @@
       {
         target.SetValue(element->getTag().getGTag(),
                         element->getTag().getETag(),
-                        ConvertLeafElement(*element, DicomToJsonFlags_Default, encoding));
+                        ConvertLeafElement(*element, DicomToJsonFlags_Default, maxStringLength, encoding));
       }
     }
   }
@@ -338,6 +339,7 @@
 
   DicomValue* FromDcmtkBridge::ConvertLeafElement(DcmElement& element,
                                                   DicomToJsonFlags flags,
+                                                  unsigned int maxStringLength,
                                                   Encoding encoding)
   {
     if (!element.isLeaf())
@@ -359,7 +361,8 @@
         std::string s(c);
         std::string utf8 = Toolbox::ConvertToUtf8(s, encoding);
 
-        if (utf8.size() > ORTHANC_MAXIMUM_TAG_LENGTH)
+        if (maxStringLength != 0 &&
+            utf8.size() > maxStringLength)
         {
           return new DicomValue;  // Create a NULL value
         }
@@ -705,7 +708,7 @@
 
     if (element.isLeaf())
     {
-      std::auto_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement(element, flags, encoding));
+      std::auto_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement(element, flags, maxStringLength, encoding));
       LeafValueToJson(target, *v, format, flags, maxStringLength);
     }
     else
--- a/OrthancServer/FromDcmtkBridge.h	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.h	Mon Mar 21 14:28:59 2016 +0100
@@ -59,6 +59,7 @@
 
     static void Convert(DicomMap& target, 
                         DcmDataset& dataset,
+                        unsigned int maxStringLength,
                         Encoding defaultEncoding);
 
     static DicomTag Convert(const DcmTag& tag);
@@ -69,6 +70,7 @@
 
     static DicomValue* ConvertLeafElement(DcmElement& element,
                                           DicomToJsonFlags flags,
+                                          unsigned int maxStringLength,
                                           Encoding encoding);
 
     static void ToJson(Json::Value& parent,
--- a/OrthancServer/Internals/DicomFrameIndex.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/Internals/DicomFrameIndex.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -377,7 +377,7 @@
 
     // Extract information about the image structure
     DicomMap tags;
-    FromDcmtkBridge::Convert(tags, dataset,
+    FromDcmtkBridge::Convert(tags, dataset, ORTHANC_MAXIMUM_TAG_LENGTH,
                              Configuration::GetDefaultEncoding());
 
     DicomImageInformation information(tags);
--- a/OrthancServer/Internals/DicomImageDecoder.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/Internals/DicomImageDecoder.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -242,7 +242,7 @@
       // See also: http://support.dcmtk.org/wiki/dcmtk/howto/accessing-compressed-data
 
       DicomMap m;
-      FromDcmtkBridge::Convert(m, dataset,
+      FromDcmtkBridge::Convert(m, dataset, ORTHANC_MAXIMUM_TAG_LENGTH,
                                Configuration::GetDefaultEncoding());
 
       /**
@@ -315,7 +315,7 @@
                                                 bool ignorePhotometricInterpretation)
   {
     DicomMap m;
-    FromDcmtkBridge::Convert(m, dataset,
+    FromDcmtkBridge::Convert(m, dataset, ORTHANC_MAXIMUM_TAG_LENGTH,
                              Configuration::GetDefaultEncoding());
 
     DicomImageInformation info(m);
--- a/OrthancServer/Internals/FindScp.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/Internals/FindScp.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -171,7 +171,7 @@
               }
 
               DicomMap input;
-              FromDcmtkBridge::Convert(input, *requestIdentifiers,
+              FromDcmtkBridge::Convert(input, *requestIdentifiers, ORTHANC_MAXIMUM_TAG_LENGTH,
                                        Configuration::GetDefaultEncoding());
               data.findHandler_->Handle(data.answers_, input, sequencesToReturn,
                                         *data.remoteIp_, *data.remoteAet_,
--- a/OrthancServer/Internals/MoveScp.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/Internals/MoveScp.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -130,7 +130,7 @@
       if (data.lastRequest_ == NULL)
       {
         DicomMap input;
-        FromDcmtkBridge::Convert(input, *requestIdentifiers,
+        FromDcmtkBridge::Convert(input, *requestIdentifiers, ORTHANC_MAXIMUM_TAG_LENGTH,
                                  Configuration::GetDefaultEncoding());
 
         try
--- a/OrthancServer/Internals/StoreScp.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/Internals/StoreScp.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -168,13 +168,15 @@
 
           try
           {
-            FromDcmtkBridge::Convert(summary, **imageDataSet,
-                                     Configuration::GetDefaultEncoding());
+            const Encoding defaultEncoding = Configuration::GetDefaultEncoding();
+            FromDcmtkBridge::Convert(summary, **imageDataSet, 
+                                     ORTHANC_MAXIMUM_TAG_LENGTH,
+                                     defaultEncoding);
             FromDcmtkBridge::ToJson(dicomJson, **imageDataSet,
                                     DicomToJsonFormat_Full, 
                                     DicomToJsonFlags_Default, 
                                     ORTHANC_MAXIMUM_TAG_LENGTH,
-                                    Configuration::GetDefaultEncoding());
+                                    defaultEncoding);
 
             if (!FromDcmtkBridge::SaveToMemoryBuffer(buffer, **imageDataSet))
             {
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -468,8 +468,6 @@
 
   static void GetRawFrame(RestApiGetCall& call)
   {
-    ServerContext& context = OrthancRestApi::GetContext(call);
-
     std::string frameId = call.GetUriComponent("frame", "0");
 
     unsigned int frame;
--- a/OrthancServer/ParsedDicomFile.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/ParsedDicomFile.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -773,7 +773,8 @@
       }
 
       std::auto_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement
-                                  (*element, DicomToJsonFlags_Default, GetEncoding()));
+                                  (*element, DicomToJsonFlags_Default, 
+                                   ORTHANC_MAXIMUM_TAG_LENGTH, GetEncoding()));
       
       if (v.get() == NULL ||
           v->IsNull())
@@ -1187,7 +1188,8 @@
 
   void ParsedDicomFile::Convert(DicomMap& tags)
   {
-    FromDcmtkBridge::Convert(tags, *pimpl_->file_->getDataset(),
+    FromDcmtkBridge::Convert(tags, *pimpl_->file_->getDataset(), 
+                             ORTHANC_MAXIMUM_TAG_LENGTH, 
                              Configuration::GetDefaultEncoding());
   }
 
--- a/OrthancServer/Search/HierarchicalMatcher.cpp	Mon Mar 21 14:12:31 2016 +0100
+++ b/OrthancServer/Search/HierarchicalMatcher.cpp	Mon Mar 21 14:28:59 2016 +0100
@@ -122,7 +122,8 @@
       else
       {
         std::auto_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
-                                        (*element, DicomToJsonFlags_None, encoding));
+                                        (*element, DicomToJsonFlags_None, 
+                                         ORTHANC_MAXIMUM_TAG_LENGTH, encoding));
 
         if (value->IsBinary())
         {
@@ -221,7 +222,8 @@
         }
 
         std::auto_ptr<DicomValue> value(FromDcmtkBridge::ConvertLeafElement
-                                        (*element, DicomToJsonFlags_None, encoding));
+                                        (*element, DicomToJsonFlags_None, 
+                                         ORTHANC_MAXIMUM_TAG_LENGTH, encoding));
 
         if (value->IsNull() ||
             value->IsBinary() ||