ITK  4.13.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< typename TMeasurementVector >
55 class ITK_TEMPLATE_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 ITK_OVERRIDE;
111 
115  virtual typename LightObject::Pointer InternalClone() const ITK_OVERRIDE;
116 
117 protected:
119  virtual ~GaussianMembershipFunction() ITK_OVERRIDE {}
120  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
121 
122 private:
123  ITK_DISALLOW_COPY_AND_ASSIGN(GaussianMembershipFunction);
124 
125  MeanVectorType m_Mean; // mean
126  CovarianceMatrixType m_Covariance; // covariance matrix
127 
128  // inverse covariance matrix. automatically calculated
129  // when covariace matirx is set.
131 
132  // pre_factor (normalization term). automatically calculated
133  // when covariace matirx is set.
134  double m_PreFactor;
135 
138 };
139 } // end of namespace Statistics
140 } // end namespace itk
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "itkGaussianMembershipFunction.hxx"
144 #endif
145 
146 #endif
Light weight base class for most itk classes.
Superclass::MeasurementVectorSizeType MeasurementVectorSizeType
MembershipFunctionBase< TMeasurementVector > Superclass
GaussianMembershipFunction models class membership through a multivariate Gaussian function...
MembershipFunctionBase defines common interfaces for membership functions.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType