Gaussian.h
1 /*
2  * Developing brain Region Annotation With Expectation-Maximization (Draw-EM)
3  *
4  * Copyright 2013-2016 Imperial College London
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 
20 #ifndef _MIRTKGAUSSIAN_H
21 
22 #define _MIRTKGAUSSIAN_H
23 
24 #include "mirtk/Image.h"
25 
26 /**
27 
28 multivariate gaussian probability distribution
29 
30  */
31 
32 namespace mirtk {
33 
34 class Gaussian : public Object
35 {
36  mirtkObjectMacro(Gaussian);
37 
38 protected:
39 
40  double _mi;
41  double _sigma;
42  double _norm;
43 
44 public:
45 
46  void Initialise(const double &mi, const double &sigma);
47  double Evaluate(const double &x);
48  double GetNorm();
49 };
50 
51 inline double Gaussian::Evaluate(const double &x)
52 {
53  return _norm * exp(-((x - _mi) * (x - _mi)) / (2.0 * _sigma));
54 }
55 
56 inline double Gaussian::GetNorm()
57 {
58  return _norm;
59 }
60 
61 }
62 #endif
Definition: IOConfig.h:41