diff Plugin/DecodedImageAdapter.cpp @ 126:f99adade8b77

Fixed rendering of 16bpp images if values are < 0 or >= 32768
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Mar 2016 11:55:35 +0100
parents 3809121c3290
children d850500b8ca6
line wrap: on
line diff
--- a/Plugin/DecodedImageAdapter.cpp	Thu Jan 28 17:08:44 2016 +0100
+++ b/Plugin/DecodedImageAdapter.cpp	Fri Mar 25 11:55:35 2016 +0100
@@ -297,7 +297,7 @@
 
       case Orthanc::PixelFormat_Grayscale8:
       case Orthanc::PixelFormat_Grayscale16:
-        buffer.SetFormat(Orthanc::PixelFormat_SignedGrayscale16);
+        buffer.SetFormat(Orthanc::PixelFormat_Grayscale16);
         buffer.SetWidth(accessor.GetWidth());
         buffer.SetHeight(accessor.GetHeight());
         converted = buffer.GetAccessor();
@@ -313,6 +313,8 @@
         return false;
     }
 
+    result["Orthanc"]["IsSigned"] = (accessor.GetFormat() == Orthanc::PixelFormat_SignedGrayscale16);
+
     // Sanity check: The pitch must be minimal
     assert(converted.GetSize() == converted.GetWidth() * converted.GetHeight() * 
            GetBytesPerPixel(converted.GetFormat()));
@@ -423,6 +425,7 @@
       return false;
     }
     
+    result["Orthanc"]["IsSigned"] = (accessor.GetFormat() == Orthanc::PixelFormat_SignedGrayscale16);
     result["Orthanc"]["Compression"] = "Jpeg";
     result["sizeInBytes"] = converted.GetSize();