diff --git a/Code/BasicFilters/otbQuaternaryFunctorImageFilter.txx b/Code/BasicFilters/otbQuaternaryFunctorImageFilter.txx
index bfb0ac8414cce937ccbf5b4dca852ccc8528fa65..cde1c4c275ce9eae0976d00356dc7bdd1e7345ca 100755
--- a/Code/BasicFilters/otbQuaternaryFunctorImageFilter.txx
+++ b/Code/BasicFilters/otbQuaternaryFunctorImageFilter.txx
@@ -113,7 +113,7 @@ QuaternaryFunctorImageFilter<TInputImage1,TInputImage2,TInputImage3,TInputImage4
   Input3ImagePointer inputPtr3
     = dynamic_cast<const TInputImage3*>((itk::ProcessObject::GetInput(2)));
   Input4ImagePointer inputPtr4
-    = dynamic_cast<const TInputImage4*>((itk::ProcessObject::GetInput(4)));
+    = dynamic_cast<const TInputImage4*>((itk::ProcessObject::GetInput(3)));
   if (inputPtr1.IsNull() || inputPtr2.IsNull() || inputPtr3.IsNull() ||inputPtr4.IsNull())
     {
       itkExceptionMacro(<< "At least one input is missing."