changeset 6833:36da56de363d streaming

removed useless version of ServerContext::DecodeDicomFrame()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 21 May 2026 11:09:06 +0200
parents 2e85b570380c
children 8dfbb91480cc
files OrthancServer/Plugins/Engine/OrthancPlugins.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h OrthancServer/Sources/ServerTranscoder.cpp OrthancServer/Sources/ServerTranscoder.h
diffstat 5 files changed, 19 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Thu May 21 10:36:56 2026 +0200
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Thu May 21 11:09:06 2026 +0200
@@ -4154,7 +4154,7 @@
       case OrthancPluginImageFormat_Dicom:
       {
         PImpl::ServerContextReference lock(*pimpl_);
-        image.reset(lock.GetContext().DecodeDicomFrame(p.data, p.size, 0));
+        image.reset(lock.GetContext().GetTranscoder()->DecodeFrame(p.data, p.size, 0 /* frame index */));
         break;
       }
 
@@ -4829,7 +4829,7 @@
       case _OrthancPluginService_DecodeDicomImage:
       {
         PImpl::ServerContextReference lock(*pimpl_);
-        result.reset(lock.GetContext().DecodeDicomFrame(p.constBuffer, p.bufferSize, p.frameIndex));
+        result.reset(lock.GetContext().GetTranscoder()->DecodeFrame(p.constBuffer, p.bufferSize, p.frameIndex));
         break;
       }
 
--- a/OrthancServer/Sources/ServerContext.cpp	Thu May 21 10:36:56 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Thu May 21 11:09:06 2026 +0200
@@ -1850,7 +1850,7 @@
   ImageAccessor* ServerContext::DecodeDicomFrame(const DicomInstanceToStore& dicom,
                                                  unsigned int frameIndex)
   {
-    return GetTranscoder()->DecodeFrame(dicom.GetParsedDicomFile(),
+    return GetTranscoder()->DecodeFrame(//dicom.GetParsedDicomFile(),
                                         dicom.GetBufferData(),
                                         dicom.GetBufferSize(),
                                         frameIndex);
@@ -1858,15 +1858,6 @@
   }
 
 
-  ImageAccessor* ServerContext::DecodeDicomFrame(const void* dicom,
-                                                 size_t size,
-                                                 unsigned int frameIndex)
-  {
-    std::unique_ptr<ParsedDicomFile> instance(new ParsedDicomFile(dicom, size));
-    return GetTranscoder()->DecodeFrame(*instance, dicom, size, frameIndex);
-  }
-  
-
   void ServerContext::PerformCStoreWithTranscoding(std::string& sopClassUid,
                                                    std::string& sopInstanceUid,
                                                    DicomStoreUserConnection& connection,
--- a/OrthancServer/Sources/ServerContext.h	Thu May 21 10:36:56 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Thu May 21 11:09:06 2026 +0200
@@ -545,11 +545,6 @@
     ImageAccessor* DecodeDicomFrame(const DicomInstanceToStore& dicom,
                                     unsigned int frameIndex);
 
-    // TODO-Streaming : To remove
-    ImageAccessor* DecodeDicomFrame(const void* dicom,
-                                    size_t size,
-                                    unsigned int frameIndex);
-
     void PerformCStoreWithTranscoding(std::string& sopClassUid,
                                       std::string& sopInstanceUid,
                                       DicomStoreUserConnection& connection,
--- a/OrthancServer/Sources/ServerTranscoder.cpp	Thu May 21 10:36:56 2026 +0200
+++ b/OrthancServer/Sources/ServerTranscoder.cpp	Thu May 21 11:09:06 2026 +0200
@@ -282,16 +282,21 @@
   }
 
 
-  ImageAccessor* ServerTranscoder::DecodeFrame(const ParsedDicomFile& dicom,
-                                               const void* buffer,
+  ImageAccessor* ServerTranscoder::DecodeFrame(const void* buffer,
                                                size_t size,
                                                unsigned int frameIndex)
   {
+    std::unique_ptr<ParsedDicomFile> dicom;
     std::unique_ptr<ImageAccessor> decoded;
 
     if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before)
     {
-      decoded.reset(DecodeFrameBuiltin(dicom, frameIndex));
+      if (dicom.get() == NULL)
+      {
+        dicom.reset(new ParsedDicomFile(buffer, size));
+      }
+
+      decoded.reset(DecodeFrameBuiltin(*dicom, frameIndex));
       if (decoded.get() != NULL)
       {
         return decoded.release();
@@ -306,7 +311,12 @@
 
     if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_After)
     {
-      decoded.reset(DecodeFrameBuiltin(dicom, frameIndex));
+      if (dicom.get() == NULL)
+      {
+        dicom.reset(new ParsedDicomFile(buffer, size));
+      }
+
+      decoded.reset(DecodeFrameBuiltin(*dicom, frameIndex));
       if (decoded.get() != NULL)
       {
         return decoded.release();
--- a/OrthancServer/Sources/ServerTranscoder.h	Thu May 21 10:36:56 2026 +0200
+++ b/OrthancServer/Sources/ServerTranscoder.h	Thu May 21 11:09:06 2026 +0200
@@ -90,10 +90,9 @@
 
     bool HasPluginsTranscoder() const;
 
-    ImageAccessor* DecodeFrame(const ParsedDicomFile& dicom,
-                               const void* buffer,  // buffer that is the source of the ParsedDicomFile
+    ImageAccessor* DecodeFrame(const void* buffer,
                                size_t size,
-                               unsigned int frameIndex);  // TODO-Streaming : Remove this flavor
+                               unsigned int frameIndex);
 
     ImageAccessor* DecodeFrame(const boost::shared_ptr<DataSourceReader>& dicomReader,        // For built-in decoding
                                const boost::shared_ptr<DataSourceReader>& storageAreaReader,  // For plugin-based decoding