# HG changeset patch # User Sebastien Jodogne # Date 1604055606 -3600 # Node ID f9eaf14d3d1989b6f0899d9d1e9dcf87a2bebb49 # Parent 9a01e0f89b6d38d1b15cf7b557ba6e38b1191005 Fix decoding sequence if "BuiltinDecoderTranscoderOrder" is "Before" diff -r 9a01e0f89b6d -r f9eaf14d3d19 NEWS --- a/NEWS Fri Oct 30 09:00:24 2020 +0100 +++ b/NEWS Fri Oct 30 12:00:06 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 diff -r 9a01e0f89b6d -r f9eaf14d3d19 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Fri Oct 30 09:00:24 2020 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Fri Oct 30 12:00:06 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 decoded(locker.GetDicom().DecodeFrame(frameIndex)); + ServerContext::DicomCacheLocker locker(*this, publicId); + + std::unique_ptr 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 decoded( - GetPlugins().Decode(dicomContent.c_str(), dicomContent.size(), frameIndex)); + + std::unique_ptr 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 decoded(dicom.GetParsedDicomFile().DecodeFrame(frameIndex)); + std::unique_ptr 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 decoded( - GetPlugins().Decode(dicom.GetBufferData(), dicom.GetBufferSize(), frameIndex)); + std::unique_ptr decoded; + try + { + decoded.reset(GetPlugins().Decode(dicom.GetBufferData(), dicom.GetBufferSize(), frameIndex)); + } + catch (OrthancException& e) + { + } + if (decoded.get() != NULL) { return decoded.release();