]> Creatis software - clitk.git/commitdiff
Ported C99 std::isnormal function
authorsrit <srit>
Mon, 8 Feb 2010 10:10:44 +0000 (10:10 +0000)
committersrit <srit>
Mon, 8 Feb 2010 10:10:44 +0000 (10:10 +0000)
common/clitkPortability.h
itk/itkBinaryGuerreroFilter.h

index da1b7ba6c710a18e848b3f4fa906196763e6d0df..63bb6ac66cc311853fe5ebc5bf745cbcb87bc42a 100755 (executable)
@@ -1,10 +1,19 @@
 #ifndef CLITKPORTABILITY_H
 #define CLITKPORTABILITY_H
-  
+
 #if defined(WIN32)
 #  define rint(x)  floor(x+0.5)
 #  define lrint(x) (long)rint(x) 
 #  define _USE_MATH_DEFINES
 #endif
 
+template<typename T>
+int IsNormal(const T val) {
+#if defined(_MSC_VER)
+  return _finite(val);
+#elif defined(unix)
+  return std::isnormal(val);
+#endif
+}
+
 #endif /* end #define CLITKPORTABILITY_H */
index fdc6d21fb8e1ab4e999ee1f028977aba5341b2a4..383a21fca10a6f61505181df88900e51028a8fbd 100644 (file)
@@ -59,7 +59,7 @@ class GuerreroFunctor
             else //Use the original formula as described in Guerrero's paper
                 vol_change=static_cast<TOutput>( 1000. * (Bstar-A) / (A*(1000.+Bstar)) );
 
-            if (std::isnormal(vol_change))
+            if (IsNormal(vol_change))
                 return vol_change;
             else
                 return 0.;