From f0e1fa20ad7e271a67cdaa14cc27d40cf512417c Mon Sep 17 00:00:00 2001
From: Chia Aik Song <crscas@nus.edu.sg>
Date: Fri, 27 Mar 2009 10:37:25 +0800
Subject: [PATCH] BUG: Fix display of unsigned char value in new viewer

---
 Code/Visualization/otbStandardRenderingFunction.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Code/Visualization/otbStandardRenderingFunction.h b/Code/Visualization/otbStandardRenderingFunction.h
index 0cafd81aca..65eea55788 100644
--- a/Code/Visualization/otbStandardRenderingFunction.h
+++ b/Code/Visualization/otbStandardRenderingFunction.h
@@ -105,7 +105,7 @@ public:
   {
     itk::OStringStream oss;
     OutputPixelType output = this->Evaluate(spixel);
-    oss<<"Grayscale[value: "<<spixel<<", displayed: "<<output[0]<<"]";
+    oss<<"Grayscale[value: "<< static_cast<typename itk::NumericTraits<ScalarPixelType>::PrintType>(spixel)<<", displayed: "<<output[0]<<"]";
     return oss.str();
   }
 
@@ -113,9 +113,9 @@ public:
   {
     itk::OStringStream oss;
     OutputPixelType output = this->Evaluate(vpixel);
-    oss<<"R[chan="  <<m_RedChannelIndex   <<" val="<< vpixel[m_RedChannelIndex]   <<" disp="<<static_cast<unsigned int>(output[0])<<"]\n";
-    oss<<"G[chan="<<m_GreenChannelIndex   <<" val="<< vpixel[m_GreenChannelIndex] <<" disp="<<static_cast<unsigned int>(output[1])<<"]\n";
-    oss<<"B[chan=" <<m_BlueChannelIndex   <<" val="<< vpixel[m_BlueChannelIndex]  <<" disp="<<static_cast<unsigned int>(output[2])<<"]";
+    oss<<"R[chan="  <<m_RedChannelIndex   <<" val="<< static_cast<typename itk::NumericTraits<ScalarPixelType>::PrintType>(vpixel[m_RedChannelIndex])   <<" disp="<<static_cast<unsigned int>(output[0])<<"]\n";
+    oss<<"G[chan="<<m_GreenChannelIndex   <<" val="<< static_cast<typename itk::NumericTraits<ScalarPixelType>::PrintType>(vpixel[m_GreenChannelIndex]) <<" disp="<<static_cast<unsigned int>(output[1])<<"]\n";
+    oss<<"B[chan=" <<m_BlueChannelIndex   <<" val="<< static_cast<typename itk::NumericTraits<ScalarPixelType>::PrintType>(vpixel[m_BlueChannelIndex])  <<" disp="<<static_cast<unsigned int>(output[2])<<"]";
     return oss.str();
 
   }
-- 
GitLab