changeset 7170:bb6c9baf347d

Fixed preview of YBR_FULL images encoded in JPEG-LS
author Alain Mazy <am@orthanc.team>
date Fri, 09 Oct 2026 17:13:06 +0200
parents 47f2edc0200d
children 752b2dc9f6b1
files NEWS OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Oct 08 10:34:30 2026 +0200
+++ b/NEWS	Fri Oct 09 17:13:06 2026 +0200
@@ -34,6 +34,8 @@
   - W101_TruncatingDicomTagTo256Values
 * Fixed a deadlock in Anonymization/Modification jobs: some instances failing to be processed
   could keep the job in a "processing" state forever.
+* Fixed preview of YBR_FULL images encoded in JPEG-LS
+  (https://discourse.orthanc-server.org/t/orthanc-preview-does-not-show-correctly/6488)
 * Fix use of the static runtime under Visual Studio (/MT), which broke in 1.12.10
 * New CMake options: 
   - "THIRD_PARTY_DOWNLOADS_ROOT_URL" to specify another webserver to downloads the third-parties from.
--- a/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Thu Oct 08 10:34:30 2026 +0200
+++ b/OrthancFramework/Sources/DicomParsing/Internals/DicomImageDecoder.cpp	Fri Oct 09 17:13:06 2026 +0200
@@ -862,10 +862,19 @@
       std::string colorModel = Orthanc::Toolbox::StripSpaces(decompressedColorModel.c_str());
 
       if (target->GetFormat() == PixelFormat_RGB24 &&
-          (colorModel == "RGB" || colorModel == "YBR_FULL") &&
-          info.IsPlanar())
+          (colorModel == "RGB" || colorModel == "YBR_FULL"))
       {
-        std::unique_ptr<ImageAccessor> output(DecodePlanarConfiguration(*target));
+        std::unique_ptr<ImageAccessor> output;
+
+        if (info.IsPlanar())
+        {
+          output.reset(DecodePlanarConfiguration(*target));
+        }
+        else
+        {
+          output.reset(target.release());
+        }
+
 
         if (colorModel == "YBR_FULL")
         {