changeset 5333:816968b5a031

speeded up ServerContext::ReadDicomUntilPixelData() if storage compression is on
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Jun 2023 10:39:17 +0200
parents f5cb6310e0dc
children 5b2a5cc64cb1
files OrthancServer/Sources/ServerContext.cpp
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Tue Jun 27 09:35:31 2023 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Tue Jun 27 10:39:17 2023 +0200
@@ -1144,13 +1144,23 @@
   bool ServerContext::ReadDicomUntilPixelData(std::string& dicom,
                                               const std::string& instancePublicId)
   {
+    FileInfo attachment;
+    int64_t revision;  // Ignored
+    if (index_.LookupAttachment(attachment, revision, instancePublicId, FileContentType_DicomUntilPixelData))
+    {
+      StorageAccessor accessor(area_, storageCache_, GetMetricsRegistry());
+
+      accessor.Read(dicom, attachment);
+      assert(dicom.size() == attachment.GetUncompressedSize());
+
+      return true;
+    }
+
     if (!area_.HasReadRange())
     {
       return false;
     }
     
-    FileInfo attachment;
-    int64_t revision;  // Ignored
     if (!index_.LookupAttachment(attachment, revision, instancePublicId, FileContentType_Dicom))
     {
       throw OrthancException(ErrorCode_InternalError,