From e2e2c238fe43384511a9724d448e313f01840755 Mon Sep 17 00:00:00 2001
From: Cedric <cedric.traizet@c-s.fr>
Date: Mon, 28 May 2018 12:04:10 +0200
Subject: [PATCH] ENH : change no data filter now create a no-data flag and a
 no-data value if there are no flags in all bands of the input

---
 .../include/otbChangeNoDataValueFilter.h               | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h
index d19f2184a3..94243aa5ce 100644
--- a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h
@@ -21,6 +21,7 @@
 #ifndef otbChangeNoDataValueFilter_h
 #define otbChangeNoDataValueFilter_h
 
+#include "otbLogger.h"
 #include "itkUnaryFunctorImageFilter.h"
 #include "itkMetaDataObject.h"
 #include "otbMetaDataKey.h"
@@ -80,12 +81,17 @@ public:
  *  - NaN values will be considered as no data and replaced as well
  *  - Output image will have no-data flags and values for all bands
  *
- *  If NaNIsNoData is false:
+ *  If NaNIsNoData is false and the input has at least one band with no-data 
+ *  flag and no-data value :
  *  - Band for which input no-data flags is false will remain
  *    untouched
  *  - Output image will have no-data flags and values only for bands
  *    for which input no-data flag is true.
  * 
+ *  If NaNIsNoData is false and the input has no band with no-data 
+ *  flag and no-data value :
+ *  - Output image will have no-data flags and values for all bands
+ * 
  * \ingroup Streamed
  * \ingroup MultiThreaded
  * \ingroup OTBImageManipulation
@@ -151,7 +157,7 @@ protected:
 
     if(!ret)
       {
-      noDataValueAvailable.resize(this->GetInput()->GetNumberOfComponentsPerPixel(),false);
+      noDataValueAvailable.resize(this->GetInput()->GetNumberOfComponentsPerPixel(),true);
       noDataValues.resize(this->GetInput()->GetNumberOfComponentsPerPixel(),0);
       }
 
-- 
GitLab