From d8bdb9796612d4c291d1fc2e81672db96df60fd7 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Wed, 6 Dec 2017 09:40:59 +0100
Subject: [PATCH] BUG: wrong nan detection with otb::Image type

---
 Modules/Core/Metadata/include/otbNoDataHelper.h | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/Modules/Core/Metadata/include/otbNoDataHelper.h b/Modules/Core/Metadata/include/otbNoDataHelper.h
index 9203a6b4e5..11b68cad6c 100644
--- a/Modules/Core/Metadata/include/otbNoDataHelper.h
+++ b/Modules/Core/Metadata/include/otbNoDataHelper.h
@@ -61,18 +61,7 @@ template<typename T> bool IsNoData(const T & pixel, const
   assert(flags.size()>0);
   assert(values.size()>0);
 
-  if(nanIsNoData && vnl_math_isnan(values[0]))
-    return true;
-
-
-  if(flags[0])
-    {
-    return (pixel == values[0]);
-    }
-  else
-    {
-    return false;
-    }
+  return ((nanIsNoData && vnl_math_isnan(pixel)) || (flags[0] && (pixel == values[0])))
 }
 
 /**
-- 
GitLab