diff --git a/Modules/Core/Functor/test/otbFunctorImageFilter.cxx b/Modules/Core/Functor/test/otbFunctorImageFilter.cxx
index f24ab33a06d30e5743740ea3429d65f5665b61fb..bf418e2a0b285db670d6175cc14b00ba3c4a2ea1 100644
--- a/Modules/Core/Functor/test/otbFunctorImageFilter.cxx
+++ b/Modules/Core/Functor/test/otbFunctorImageFilter.cxx
@@ -285,9 +285,10 @@ template<typename T> struct MaxInEachChannel
 
     for (auto idx = 0u; idx < in.Size(); idx++)
       {
+      auto pixel = in.GetPixel(idx);
       for(auto band = 0u; band < out.Size();++band)
         {
-        if(in.GetPixel(idx)[band] < out[band])
+        if(pixel[band] < out[band])
           out[band] = in.GetPixel(idx)[band];
         }
       }