changeset 4138:1a26daefc3fe

DicomImageInformation::USEFUL_TAG_LENGTH
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Aug 2020 17:56:10 +0200
parents 6774605d4341
children a4f28efdfccf
files OrthancFramework/Sources/DicomFormat/DicomImageInformation.h OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp
diffstat 3 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomImageInformation.h	Thu Aug 06 17:38:55 2020 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomImageInformation.h	Thu Aug 06 17:56:10 2020 +0200
@@ -30,6 +30,17 @@
 {
   class ORTHANC_PUBLIC DicomImageInformation
   {
+  public:
+    /**
+     * This constant gives a bound on the maximum tag length that is
+     * useful to class "DicomImageInformation", in order to avoid
+     * using too much memory when copying DICOM tags from "DcmDataset"
+     * to "DicomMap" using "ExtractDicomSummary()". The value 256
+     * corresponds to ORTHANC_MAXIMUM_TAG_LENGTH that was implicitly
+     * used in Orthanc <= 1.7.2.
+     **/
+    static const unsigned int USEFUL_TAG_LENGTH = 256;
+  
   private:
     unsigned int width_;
     unsigned int height_;
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Thu Aug 06 17:38:55 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomFrameIndex.cpp	Thu Aug 06 17:56:10 2020 +0200
@@ -358,7 +358,7 @@
     // Extract information about the image structure
     DicomMap tags;
     std::set<DicomTag> ignoreTagLength;
-    FromDcmtkBridge::ExtractDicomSummary(tags, dicom, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+    FromDcmtkBridge::ExtractDicomSummary(tags, dicom, DicomImageInformation::USEFUL_TAG_LENGTH, ignoreTagLength);
 
     DicomImageInformation information(tags);
 
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu Aug 06 17:38:55 2020 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu Aug 06 17:56:10 2020 +0200
@@ -251,7 +251,7 @@
 
       DicomMap m;
       std::set<DicomTag> ignoreTagLength;
-      FromDcmtkBridge::ExtractDicomSummary(m, dataset, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+      FromDcmtkBridge::ExtractDicomSummary(m, dataset, DicomImageInformation::USEFUL_TAG_LENGTH, ignoreTagLength);
 
       /**
        * Create an accessor to the raw values of the DICOM image.
@@ -324,7 +324,7 @@
   {
     DicomMap m;
     std::set<DicomTag> ignoreTagLength;
-    FromDcmtkBridge::ExtractDicomSummary(m, dataset, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+    FromDcmtkBridge::ExtractDicomSummary(m, dataset, DicomImageInformation::USEFUL_TAG_LENGTH, ignoreTagLength);
 
     DicomImageInformation info(m);
     PixelFormat format;
@@ -605,7 +605,7 @@
 
     DicomMap m;
     std::set<DicomTag> ignoreTagLength;
-    FromDcmtkBridge::ExtractDicomSummary(m, dataset, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);
+    FromDcmtkBridge::ExtractDicomSummary(m, dataset, DicomImageInformation::USEFUL_TAG_LENGTH, ignoreTagLength);
     DicomImageInformation info(m);
 
     std::unique_ptr<ImageAccessor> target(CreateImage(dataset, true));