]> Creatis software - clitk.git/blob - common/clitkPortability.h
The lower and upper options can be tuned for all type of region growing algorithm
[clitk.git] / common / clitkPortability.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef CLITKPORTABILITY_H
19 #define CLITKPORTABILITY_H
20 #if defined(_WIN32)
21 #  define _USE_MATH_DEFINES //Before math.h include (i.e. cmath)
22 #endif
23 #include <cmath>
24
25 #if defined(_WIN32)
26 #  define rint(x)  floor(x+0.5)
27 #  define lrint(x) (long)rint(x) 
28 #endif
29
30 template<typename T>
31 int IsNormal(const T val) {
32 #if defined(_MSC_VER)
33   return _finite(val);
34 #else
35   return std::isnormal(val);
36 #endif
37 }
38
39 #if defined(_MSC_VER)
40 #  include <io.h>
41 #  define mkstemp(x) _mktemp_s(x, sizeof(x))
42 #endif
43
44 #endif /* end #define CLITKPORTABILITY_H */