changeset 4266:97c8a7f93805

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Oct 2020 12:00:16 +0100
parents f9eaf14d3d19 (diff) d31cba1e27ac (current diff)
children a20928107a90
files
diffstat 2 files changed, 40 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Oct 30 10:48:57 2020 +0100
+++ b/NEWS	Fri Oct 30 12:00:16 2020 +0100
@@ -2,6 +2,7 @@
 ===============================
 
 * C-GET SCP: Fix responses and handling of cancel
+* Fix decoding sequence if "BuiltinDecoderTranscoderOrder" is "Before"
 * Upgraded dependencies for static builds (notably on Windows and LSB):
   - civetweb 1.13
 
--- a/OrthancServer/Sources/ServerContext.cpp	Fri Oct 30 10:48:57 2020 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri Oct 30 12:00:16 2020 +0100
@@ -1441,8 +1441,17 @@
     {
       // Use Orthanc's built-in decoder, using the cache to speed-up
       // things on multi-frame images
-      ServerContext::DicomCacheLocker locker(*this, publicId);        
-      std::unique_ptr<ImageAccessor> decoded(locker.GetDicom().DecodeFrame(frameIndex));
+      ServerContext::DicomCacheLocker locker(*this, publicId);
+
+      std::unique_ptr<ImageAccessor> decoded;
+      try
+      {
+        decoded.reset(locker.GetDicom().DecodeFrame(frameIndex));
+      }
+      catch (OrthancException& e)
+      {
+      }
+      
       if (decoded.get() != NULL)
       {
         return decoded.release();
@@ -1456,8 +1465,16 @@
       // TODO: Store the raw buffer in the DicomCacheLocker
       std::string dicomContent;
       ReadDicom(dicomContent, publicId);
-      std::unique_ptr<ImageAccessor> decoded(
-        GetPlugins().Decode(dicomContent.c_str(), dicomContent.size(), frameIndex));
+      
+      std::unique_ptr<ImageAccessor> decoded;
+      try
+      {
+        decoded.reset(GetPlugins().Decode(dicomContent.c_str(), dicomContent.size(), frameIndex));
+      }
+      catch (OrthancException& e)
+      {
+      }
+      
       if (decoded.get() != NULL)
       {
         return decoded.release();
@@ -1487,7 +1504,15 @@
   {
     if (builtinDecoderTranscoderOrder_ == BuiltinDecoderTranscoderOrder_Before)
     {
-      std::unique_ptr<ImageAccessor> decoded(dicom.GetParsedDicomFile().DecodeFrame(frameIndex));
+      std::unique_ptr<ImageAccessor> decoded;
+      try
+      {
+        decoded.reset(dicom.GetParsedDicomFile().DecodeFrame(frameIndex));
+      }
+      catch (OrthancException& e)
+      {
+      }
+        
       if (decoded.get() != NULL)
       {
         return decoded.release();
@@ -1498,8 +1523,15 @@
     if (HasPlugins() &&
         GetPlugins().HasCustomImageDecoder())
     {
-      std::unique_ptr<ImageAccessor> decoded(
-        GetPlugins().Decode(dicom.GetBufferData(), dicom.GetBufferSize(), frameIndex));
+      std::unique_ptr<ImageAccessor> decoded;
+      try
+      {
+        decoded.reset(GetPlugins().Decode(dicom.GetBufferData(), dicom.GetBufferSize(), frameIndex));
+      }
+      catch (OrthancException& e)
+      {
+      }
+    
       if (decoded.get() != NULL)
       {
         return decoded.release();