From: srit Date: Mon, 8 Feb 2010 10:10:44 +0000 (+0000) Subject: Ported C99 std::isnormal function X-Git-Tag: v1.2.0~824 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;ds=sidebyside;h=3a3b13d43c061445e7fc700086b91bb4eae32aff;p=clitk.git Ported C99 std::isnormal function --- diff --git a/common/clitkPortability.h b/common/clitkPortability.h index da1b7ba..63bb6ac 100755 --- a/common/clitkPortability.h +++ b/common/clitkPortability.h @@ -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 +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 */ diff --git a/itk/itkBinaryGuerreroFilter.h b/itk/itkBinaryGuerreroFilter.h index fdc6d21..383a21f 100644 --- a/itk/itkBinaryGuerreroFilter.h +++ b/itk/itkBinaryGuerreroFilter.h @@ -59,7 +59,7 @@ class GuerreroFunctor else //Use the original formula as described in Guerrero's paper vol_change=static_cast( 1000. * (Bstar-A) / (A*(1000.+Bstar)) ); - if (std::isnormal(vol_change)) + if (IsNormal(vol_change)) return vol_change; else return 0.;