From 8344d59f47dc876afec4483b6b4a7c52319b7a7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Cresson?= <remi.cresson@irstea.fr>
Date: Fri, 17 Jan 2020 17:01:45 +0100
Subject: [PATCH] Revert "FIX: replace otb::FunctorImageFilter with
 itk::UnaryFunctorImageFilter to fix #2004"

This reverts commit 77299c78e88855d2f14de5426af1396aee2e61f6.
---
 Modules/Applications/AppImageUtils/app/otbMosaic.cxx   | 1 -
 Modules/Core/Functor/include/otbFunctorImageFilter.hxx | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/Modules/Applications/AppImageUtils/app/otbMosaic.cxx b/Modules/Applications/AppImageUtils/app/otbMosaic.cxx
index 370ba416d8..fda65b2b7c 100644
--- a/Modules/Applications/AppImageUtils/app/otbMosaic.cxx
+++ b/Modules/Applications/AppImageUtils/app/otbMosaic.cxx
@@ -737,7 +737,6 @@ private:
   void PrepareMosaicFilter(typename TMosaicFilterType::Pointer& filter)
   {
     SetInterpolator<TMosaicFilterType>(filter);
-    SetCorrectionModel<TMosaicFilterType>(filter);
     SetSpacing<TMosaicFilterType>(filter);
     SetNoDataValue<TMosaicFilterType>(filter);
     SetCorrectionModel<TMosaicFilterType>(filter);
diff --git a/Modules/Core/Functor/include/otbFunctorImageFilter.hxx b/Modules/Core/Functor/include/otbFunctorImageFilter.hxx
index 653116b5d5..0a0e7a6d31 100644
--- a/Modules/Core/Functor/include/otbFunctorImageFilter.hxx
+++ b/Modules/Core/Functor/include/otbFunctorImageFilter.hxx
@@ -49,7 +49,7 @@ int SetInputRequestedRegion(const T* img, const itk::ImageRegion<2>& region, con
   // The ugly cast in all ITK filters
   T* nonConstImg = const_cast<T*>(img);
 
-  if (currentRegion.Crop(img->GetLargestPossibleRegion()))
+  if (currentRegion.GetNumberOfPixels()==0 || currentRegion.Crop(img->GetLargestPossibleRegion()))
   {
     nonConstImg->SetRequestedRegion(currentRegion);
     return 0;
-- 
GitLab