changeset 387:263369b75f9e

fix photometric interpretation of JPEG2000 images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Apr 2025 10:48:07 +0200
parents fa463b33ca21
children a7194a77c591
files Applications/Dicomizer.cpp Framework/Inputs/DicomPyramidInstance.cpp NEWS ViewerPlugin/RawTile.cpp
diffstat 4 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp	Tue Apr 08 08:18:03 2025 +0200
+++ b/Applications/Dicomizer.cpp	Tue Apr 08 10:48:07 2025 +0200
@@ -248,8 +248,12 @@
       switch (parameters.GetTargetCompression())
       {
         case OrthancWSI::ImageCompression_Jpeg:
+          targetPhotometric = Orthanc::PhotometricInterpretation_YBRFull422;
+          break;
+
         case OrthancWSI::ImageCompression_Jpeg2000:
-          targetPhotometric = Orthanc::PhotometricInterpretation_YBRFull422;
+          // Was set to Orthanc::PhotometricInterpretation_YBRFull422 in WSI <= 3.1
+          targetPhotometric = Orthanc::PhotometricInterpretation_RGB;
           break;
 
         case OrthancWSI::ImageCompression_None:
--- a/Framework/Inputs/DicomPyramidInstance.cpp	Tue Apr 08 08:18:03 2025 +0200
+++ b/Framework/Inputs/DicomPyramidInstance.cpp	Tue Apr 08 10:48:07 2025 +0200
@@ -82,7 +82,14 @@
     {
       return ImageCompression_Jpeg2000;
     }
-    else if (s == "1.2.840.10008.1.2.4.80")
+    else if (s == "1.2.840.10008.1.2.1.99" ||
+             s == "1.2.840.10008.1.2.2"    ||
+             s == "1.2.840.10008.1.2.4.51" ||
+             s == "1.2.840.10008.1.2.4.57" ||
+             s == "1.2.840.10008.1.2.4.70" ||
+             s == "1.2.840.10008.1.2.4.80" ||
+             s == "1.2.840.10008.1.2.4.81" ||
+             s == "1.2.840.10008.1.2.5")
     {
       return ImageCompression_UseOrthancPreview;
     }
--- a/NEWS	Tue Apr 08 08:18:03 2025 +0200
+++ b/NEWS	Tue Apr 08 10:48:07 2025 +0200
@@ -3,7 +3,9 @@
 
 * Support windowing when rendering grayscale images using on-the-fly deep zoom
 * Added tolerance to imaged volume width/height by looking only at the finest level
-* Added support for JPEG-LS transfer syntax in the Web viewer plugin
+* Added support for more transfer syntaxes in the Web viewer plugin, including JPEG-LS
+* Fix photometric interpretation of JPEG2000 images generated by OrthancWSIDicomizer
+  (now set to RGB instead of YBR_FULL_422)
 
 
 Version 3.1 (2025-03-17)
--- a/ViewerPlugin/RawTile.cpp	Tue Apr 08 08:18:03 2025 +0200
+++ b/ViewerPlugin/RawTile.cpp	Tue Apr 08 10:48:07 2025 +0200
@@ -57,7 +57,12 @@
         std::unique_ptr<Jpeg2000Reader> decoded(new Jpeg2000Reader);
         decoded->ReadFromMemory(tile_);
 
-        if (photometric_ == Orthanc::PhotometricInterpretation_YBR_ICT)
+        if (photometric_ == Orthanc::PhotometricInterpretation_YBRFull ||
+            photometric_ == Orthanc::PhotometricInterpretation_YBRFull422 ||
+            photometric_ == Orthanc::PhotometricInterpretation_YBRPartial420 ||
+            photometric_ == Orthanc::PhotometricInterpretation_YBRPartial422 ||
+            photometric_ == Orthanc::PhotometricInterpretation_YBR_ICT ||
+            photometric_ == Orthanc::PhotometricInterpretation_YBR_RCT)
         {
           ImageToolbox::ConvertJpegYCbCrToRgb(*decoded);
         }