NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkMathsUtils.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkMathsUtils_h
16 #define niftkMathsUtils_h
17 
19 #include <vector>
20 #include <cstdlib>
21 
26 namespace niftk {
27 
31 extern "C++" NIFTKCOMMON_WINEXPORT bool IsCloseToZero(const double& value, const double& tolerance = 0.000001);
32 
33 
38 extern "C++" NIFTKCOMMON_WINEXPORT std::pair < double, double > FindMinimumValues
39  ( std::vector < std::pair < double, double> > inputValues,
40  std::pair <unsigned int , unsigned int > * indexes = NULL );
41 
42 
46 extern "C++" NIFTKCOMMON_WINEXPORT double Mean(const std::vector<double>& input);
47 
48 
52 extern "C++" NIFTKCOMMON_WINEXPORT double StdDev(const std::vector<double>& input);
53 
54 
58 extern "C++" NIFTKCOMMON_WINEXPORT double RMS(const std::vector<double>& input);
59 
60 
64 extern "C++" NIFTKCOMMON_WINEXPORT double ModifiedSignum(double value);
65 
66 
70 extern "C++" NIFTKCOMMON_WINEXPORT double SafeSQRT(double value);
71 
72 } // end namespace
73 
74 #endif
double StdDev(const std::vector< double > &input)
To return the sample standard deviation of a vector.
Definition: niftkMathsUtils.cxx:100
bool IsCloseToZero(const double &value, const double &tolerance)
Returns true if fabs(value) is less than a small tolerance, which defaults to 0.000001.
Definition: niftkMathsUtils.cxx:24
GLenum GLenum GLenum input
Definition: glew.h:12016
double SafeSQRT(double value)
Returns 0.0 of value < 0 or sqrt(value) if value >= 0.
Definition: niftkMathsUtils.cxx:129
double RMS(const std::vector< double > &input)
Assuming input contains squared errors, will sum them, divide by N, and take sqrt for an RMS measure...
Definition: niftkMathsUtils.cxx:79
double ModifiedSignum(double value)
Returns -1.0 if value < 0 or 1.0 if value >= 0.
Definition: niftkMathsUtils.cxx:118
#define NIFTKCOMMON_WINEXPORT
Definition: niftkCommonWin32ExportHeader.h:28
GLsizei const GLfloat * value
Definition: glew.h:1833
double Mean(const std::vector< double > &input)
To return the sample mean of a vector.
Definition: niftkMathsUtils.cxx:87
std::pair< double, double > FindMinimumValues(std::vector< std::pair< double, double > > inputValues, std::pair< unsigned int, unsigned int > *indexes)
Takes a vector of pairs and finds the minimum value in each dimension. Returns the minimum values...
Definition: niftkMathsUtils.cxx:38
Definition: niftkExceptionObject.h:21