Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StandardDeviation.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003, 2004 (see file CONTACTS for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 #include <bias_config.h>
25 
26 #include <vector>
27 #include <iostream>
28 #include <math.h>
29 
30 using namespace std;
31 
32 namespace BIAS
33 {
34  /** @class StandardDeviation
35  @ingroup g_mathalgo
36  @brief Computes the standard deviation and mean of given values.
37  @author MIP
38  */
39  //template <class T>
40  class BIASMathAlgo_EXPORT StandardDeviation
41  {
42  public:
43 
45 
46  /** @brief Create statistics from given values. */
47  StandardDeviation(vector<double> &values);
48 
49  /** @brief Compute median of internally stored values. */
50  double CalcAverage();
51 
52  /** @brief Compute standard deviation of internally sorted values. */
53  double CalcStandardDeviation();
54 
55  /** @brief Add a value to the vector of internally stored values. */
56  void AddValue(double v);
57 
58  /** @brief Clear the internally stored values. */
59  void Clear();
60 
61  private:
62 
63  /** @brief Stores values to compute statistics for internally. */
64  vector<double> val;
65 
66  };
67 
68 }
Computes the standard deviation and mean of given values.