diff --git a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
index 03881d65b5e0960e888f3bac27154c61697eb9f1..c9bda376d9e2454fc714710c1d6ceff58cf747d8 100644
--- a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
+++ b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
@@ -285,7 +285,7 @@ private:
     m_VectorToImageListFilter->UpdateOutputInformation();
     ImageListType::Pointer inputImageList = 
                   m_VectorToImageListFilter->GetOutput();
-    int nbChannel = inImage->GetVectorLength ();
+    unsigned int nbChannel = inImage->GetVectorLength ();
 
     if ( mode == "each")
       {
@@ -436,13 +436,13 @@ private:
       if ( IsParameterEnabled("minmax.auto.global") )
         {
         float temp(min[0]);
-        for (unsigned int i = 0 ; i < min.GetSize() ; i++ )
+        for ( unsigned int i = 0 ; i < min.GetSize() ; i++ )
           {
           temp = std::min(temp , min[i]);
           }
         min.Fill(temp);
         temp = max[0];
-        for (unsigned int i = 0 ; i < max.GetSize() ; i++ )
+        for ( unsigned int i = 0 ; i < max.GetSize() ; i++ )
           {
           temp = std::max(temp , max[i]);
           }
@@ -480,7 +480,7 @@ private:
   // Function corresponding to the "each" mode
   void PerBandEqualization( const FloatVectorImageType::Pointer inImage ,
                             const ImageListType::Pointer inputImageList ,
-                            const int nbChannel,
+                            const unsigned int nbChannel,
                             ImageListType::Pointer outputImageList )
   {
     FloatVectorImageType::PixelType min(nbChannel) , max(nbChannel);
@@ -494,7 +494,7 @@ private:
     m_BufferFilter.resize(nbChannel);
     m_StreamingFilter.resize(nbChannel);
 
-    for (int channel = 0 ; channel<nbChannel ; channel++ ) 
+    for ( unsigned int channel = 0 ; channel < nbChannel ; channel++ ) 
       {
       m_GainLutFilter[channel] = GainLutFilterType::New();
       m_HistoFilter[channel] = HistoFilterType::New();
@@ -551,11 +551,7 @@ private:
     lumCoef[1] = GetParameterFloat("mode.lum.gre.coef");
     lumCoef[2] = GetParameterFloat("mode.lum.blu.coef");
     // Normalize those coeffs
-    float sum = 0.0;
-    for (float f : lumCoef)
-      {
-      sum +=f;
-      }
+    float sum = std::accumulate( lumCoef.begin() , lumCoef.end() , 0 );
     assert(sum>0);
     for (int i = 0 ; i<3 ; i++ )
       {
diff --git a/Modules/Filtering/Contrast/include/otbApplyGainFilter.h b/Modules/Filtering/Contrast/include/otbApplyGainFilter.h
index 3c2e51917ee9f5529b1c6bfc529c74e832b725fe..35aaa42ba998ac7cc23f155767bb5f01a0845b68 100644
--- a/Modules/Filtering/Contrast/include/otbApplyGainFilter.h
+++ b/Modules/Filtering/Contrast/include/otbApplyGainFilter.h
@@ -108,15 +108,16 @@ protected :
   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
                             itk::ThreadIdType threadId) override;
 
-  /** Bilineare interpolation of the gain beetween the different window.*/
-  float InterpolateGain( typename LutType::ConstPointer gridLut ,
-                       unsigned int pixelValue , 
-                       typename InputImageType::IndexType index);
 
 private :
   ApplyGainFilter(const Self &) = delete ;
   void operator =(const Self&) = delete ; 
 
+  /** Bilinear interpolation of the gain between the different window.*/
+  double InterpolateGain( typename LutType::ConstPointer gridLut ,
+                       unsigned int pixelValue , 
+                       typename InputImageType::IndexType index);
+
   InputPixelType m_NoData;
   InputPixelType m_Min;
   InputPixelType m_Max;
diff --git a/Modules/Filtering/Contrast/include/otbApplyGainFilter.txx b/Modules/Filtering/Contrast/include/otbApplyGainFilter.txx
index 363508b6f499ef8004195ce9ddd4f9b4a114ee83..2eadea9402899b987cf5395ae753211a78a9a316 100644
--- a/Modules/Filtering/Contrast/include/otbApplyGainFilter.txx
+++ b/Modules/Filtering/Contrast/include/otbApplyGainFilter.txx
@@ -23,6 +23,7 @@
 
 #include "otbApplyGainFilter.h"
 #include "itkImageRegionIterator.h"
+#include "itkImageRegionConstIteratorWithIndex.h"
 
 #include <limits>
 
@@ -111,38 +112,37 @@ void ApplyGainFilter < TInputImage , TLut , TOutputImage >
   typename OutputImageType::Pointer output ( this->GetOutput() );
   typename InputImageType::RegionType inputRegionForThread;
 
-  this->CallCopyOutputRegionToInputRegion(inputRegionForThread ,
-                                          outputRegionForThread);
-  // Is it usefull???
+  inputRegionForThread = outputRegionForThread ;
 
-  itk::ImageRegionConstIterator < InputImageType > it ( input , 
+  itk::ImageRegionConstIteratorWithIndex < InputImageType > it ( input , 
                                                         inputRegionForThread );
   itk::ImageRegionIterator <OutputImageType > oit ( output ,
                                                     outputRegionForThread );
 
   unsigned int pixelLutValue(0);
-  float gain(0.0);
+  double gain(0.0) , newValue(0);
   InputPixelType currentPixel(0);
 
-  for(it.GoToBegin() , oit.GoToBegin() ; !oit.IsAtEnd() , !it.IsAtEnd() ;
+  for( it.GoToBegin() , oit.GoToBegin() ; !oit.IsAtEnd() || !it.IsAtEnd() ;
       ++oit , ++it )
     {
     currentPixel = it.Get();
-    if( ( currentPixel == m_NoData && m_NoDataFlag ) ||
-              currentPixel > m_Max || currentPixel < m_Min  )
+    newValue = static_cast< double > ( currentPixel );
+    if( !( ( currentPixel == m_NoData && m_NoDataFlag ) ||
+              currentPixel > m_Max || currentPixel < m_Min ) )
       {
-      oit.Set( static_cast<OutputPixelType>( currentPixel ) );
-      continue;
+      pixelLutValue =  static_cast< unsigned int > (
+                      std::round( ( currentPixel - m_Min ) / m_Step ) );
+      gain = InterpolateGain( lut , pixelLutValue , it.GetIndex() );
+      newValue *= gain;
       }
-    pixelLutValue =  static_cast< unsigned int > (
-                    std::round( ( currentPixel - m_Min ) / m_Step ) );
-    gain = InterpolateGain( lut , pixelLutValue , it.GetIndex() );
-    oit.Set( static_cast<OutputPixelType>( gain * currentPixel ) );
+    oit.Set( static_cast<OutputPixelType>( newValue ) );
     }
+    assert ( oit.IsAtEnd() && it.IsAtEnd() );
 }
 
 template <class TInputImage , class TLut , class TOutputImage >
-float ApplyGainFilter < TInputImage , TLut , TOutputImage >
+double ApplyGainFilter < TInputImage , TLut , TOutputImage >
 ::InterpolateGain( typename LutType::ConstPointer gridLut,
                  unsigned int pixelLutValue ,
                  typename InputImageType::IndexType index)
diff --git a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h
index 7a28050b849a7ad01a48d198009747f693a8247c..ef623e08b58f5b25e95f88e5c978b1ed51ff9287 100644
--- a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h
+++ b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.h
@@ -88,6 +88,10 @@ protected:
         const OutputImageRegionType & outputRegionForThread ,
         itk::ThreadIdType threadId) override ;
 
+private:
+  ComputeGainLutFilter(const Self &) = delete ;
+  void operator =(const Self&) = delete ;
+
   /** Post-process the look up tabe to get a gain instead of a simple value */
   OutputPixelType PostProcess( unsigned int countMapValue ,
                                unsigned int countValue ) ;
@@ -106,10 +110,6 @@ protected:
   /** Check whether the input histogram has enought pixel to be meaningful */
   bool IsValid(const HistoType & inputHisto ) ;
 
-private:
-  ComputeGainLutFilter(const Self &) = delete ;
-  void operator =(const Self&) = delete ;
-
   double m_Min;
   double m_Max;
   double m_Step;
diff --git a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.txx b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.txx
index e7c7ab641c7942d846ee5647b112d62e9c3510ae..9ffcf928aa834db734b387b74836638f47637f66 100644
--- a/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.txx
+++ b/Modules/Filtering/Contrast/include/otbComputeGainLutFilter.txx
@@ -65,7 +65,7 @@ void ComputeGainLutFilter <TInputImage , TOutputImage >
   typename OutputImageType::Pointer output ( this->GetOutput() );
 
   typename InputImageType::RegionType inputRegionForThread;
-  this->CallCopyOutputRegionToInputRegion(inputRegionForThread , outputRegionForThread);
+  inputRegionForThread = outputRegionForThread;
   // Is it usefull???
 
   itk::ImageRegionConstIterator < InputImageType > it ( input , 
@@ -82,9 +82,8 @@ void ComputeGainLutFilter <TInputImage , TOutputImage >
   LutType lut;
   lut.SetSize( m_NbBin );
 
-  it.GoToBegin();
-  oit.GoToBegin();
-  for (; !oit.IsAtEnd() && !it.IsAtEnd() ; ++oit , ++it )
+  for (it.GoToBegin() , oit.GoToBegin() ; !oit.IsAtEnd() || !it.IsAtEnd() ;
+       ++oit , ++it )
     {
     currentHisto = it.Get();
     target.Fill(0);
@@ -96,6 +95,7 @@ void ComputeGainLutFilter <TInputImage , TOutputImage >
       }
     oit.Set( lut );
     }
+  assert ( oit.IsAtEnd() && it.IsAtEnd() );
 }
 
 template <class TInputImage, class TOutputImage >
diff --git a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h
index bc278dcc81de424b81c675ddcfd2474134bde08e..b25169979b6c9184fccab567b113d8a821409fbc 100644
--- a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h
+++ b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.h
@@ -128,14 +128,14 @@ protected:
 
   void GenerateOutputRequestedRegion( itk::DataObject *output ) override;
 
-  void ApplyThreshold( 
-       typename itk::ImageRegionIterator < OutputImageType > oit ,
-       unsigned int total );
-
 private:
   ComputeHistoFilter(const Self &) = delete ;
   void operator =(const Self&) = delete ;
 
+  void ApplyThreshold( 
+       typename itk::ImageRegionIterator < OutputImageType > oit ,
+       unsigned int total );
+
   std::vector< typename OutputImageType::PixelType > m_HistoThread;
   InputPixelType m_Min;
   InputPixelType m_Max;
diff --git a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.txx b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.txx
index fda1539c9e7a5c18d78e742c5a479ecc905c3fb4..fe2b914c9a741e99e4239fa3a9af815b168d2544 100644
--- a/Modules/Filtering/Contrast/include/otbComputeHistoFilter.txx
+++ b/Modules/Filtering/Contrast/include/otbComputeHistoFilter.txx
@@ -283,10 +283,9 @@ void ComputeHistoFilter < TInputImage , TOutputImage >
     }
     typename itk::ImageRegionConstIterator < InputImageType > 
       it( input , region );
-    it.GoToBegin();
     InputPixelType currentPixel(0);
 
-    for ( ; !it.IsAtEnd() ; ++it )
+    for ( it.GoToBegin() ; !it.IsAtEnd() ; ++it )
       {
       currentPixel = it.Get();
       if( ( currentPixel == m_NoData && m_NoDataFlag ) || 
@@ -311,11 +310,10 @@ void ComputeHistoFilter < TInputImage , TOutputImage >
                         GetHistoOutput()->GetRequestedRegion() );
   SizeType outSize ( histoRegion.GetSize() );
   IndexType outIndex ( histoRegion.GetIndex() );
-  oit.GoToBegin();
 
   unsigned int agreg(0) , total(0) ;
 
-  while ( !oit.IsAtEnd() )
+  for ( oit.GoToBegin() ; !oit.IsAtEnd() ; ++oit )
     {
     total = 0;
 
@@ -323,22 +321,17 @@ void ComputeHistoFilter < TInputImage , TOutputImage >
       {
       agreg = 0;
 
-      for (unsigned int threadId = 0 ; threadId<m_ValidThreads ; threadId++ )
+      for ( unsigned int threadId = 0 ; threadId < m_ValidThreads ; threadId++ )
         {
-        agreg += m_HistoThread[threadId * outSize[0] * outSize[1] \
-          + ( ( oit.GetIndex()[0] - outIndex[0] )  ) \
-          + ( oit.GetIndex()[1] - outIndex[1] ) * outSize[0]][i]; 
+        agreg += m_HistoThread[ threadId * outSize[0] * outSize[1]
+          + ( ( oit.GetIndex()[0] - outIndex[0] )  )
+          + ( oit.GetIndex()[1] - outIndex[1] ) * outSize[0] ][i] ; 
         }
       oit.Get()[i] = agreg;
       total += agreg;
       }
-    if ( m_Threshold == std::numeric_limits< float >::max() )
-      {
-      ++oit;
-      continue;
-      }
-    ApplyThreshold( oit , total );
-    ++oit;
+    if ( m_Threshold != std::numeric_limits< float >::max() )
+      ApplyThreshold( oit , total );
     }
 }