diff Applications/Dicomizer.cpp @ 171:1390d5c87603

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Aug 2019 16:03:15 +0200
parents de783db2a7c3
children e3cbf890b588
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp	Fri Aug 02 15:31:19 2019 +0200
+++ b/Applications/Dicomizer.cpp	Fri Aug 02 16:03:15 2019 +0200
@@ -194,20 +194,27 @@
   {
     // The tiles of the source image will be re-encoded
     transcoding = false;
-    
-    switch (parameters.GetTargetCompression())
+
+    if (source.GetPixelFormat() == Orthanc::PixelFormat_Grayscale8)
+    {
+      targetPhotometric = source.GetPhotometricInterpretation();
+    }
+    else
     {
-      case OrthancWSI::ImageCompression_Jpeg:
-      case OrthancWSI::ImageCompression_Jpeg2000:
-        targetPhotometric = Orthanc::PhotometricInterpretation_YBRFull422;
-        break;
+      switch (parameters.GetTargetCompression())
+      {
+        case OrthancWSI::ImageCompression_Jpeg:
+        case OrthancWSI::ImageCompression_Jpeg2000:
+          targetPhotometric = Orthanc::PhotometricInterpretation_YBRFull422;
+          break;
 
-      case OrthancWSI::ImageCompression_None:
-        targetPhotometric = Orthanc::PhotometricInterpretation_RGB;
-        break;
+        case OrthancWSI::ImageCompression_None:
+          targetPhotometric = Orthanc::PhotometricInterpretation_RGB;
+          break;
 
-      default:
-        throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+        default:
+          throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
+      }
     }
   }
   else