ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkGaussianMembershipFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkGaussianMembershipFunction_h
19 #define __itkGaussianMembershipFunction_h
20 
21 #include "itkMatrix.h"
23 
24 namespace itk
25 {
26 namespace Statistics
27 {
54 template< class TMeasurementVector >
55 class ITK_EXPORT GaussianMembershipFunction:
56  public MembershipFunctionBase< TMeasurementVector >
57 {
58 public:
64 
66  itkTypeMacro(GaussianMembershipFunction, MembershipFunction);
67  itkNewMacro(Self);
69 
72 
74  typedef TMeasurementVector MeasurementVectorType;
75 
77  typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType;
78 
83 
86 
89  void SetMean(const MeanVectorType & mean);
90 
93  itkGetConstReferenceMacro(Mean, MeanVectorType);
94 
99  void SetCovariance(const CovarianceMatrixType & cov);
100 
101  /* Get the covariance matrix. Covariance matrix is a
102  VariableSizeMatrix of doubles. */
103  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);
104 
105  /* Get the inverse covariance matrix. Covariance matrix is a
106  VariableSizeMatrix of doubles. */
107  itkGetConstReferenceMacro(InverseCovariance, CovarianceMatrixType);
108 
110  double Evaluate(const MeasurementVectorType & measurement) const;
111 
115  virtual typename LightObject::Pointer InternalClone() const;
116 
117 protected:
120  void PrintSelf(std::ostream & os, Indent indent) const;
121 
122 private:
123  GaussianMembershipFunction(const Self &); //purposely not implemented
124  void operator=(const Self &); //purposely not implemented
125 
127  CovarianceMatrixType m_Covariance; // covariance matrix
128 
129  // inverse covariance matrix. automatically calculated
130  // when covariace matirx is set.
132 
133  // pre_factor (normalization term). automatically calculated
134  // when covariace matirx is set.
135  double m_PreFactor;
136 
139 };
140 } // end of namespace Statistics
141 } // end namespace itk
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "itkGaussianMembershipFunction.hxx"
145 #endif
146 
147 #endif
148