ITK  5.2.0
Insight Toolkit
itkGaussianMembershipFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
55 template <typename TMeasurementVector>
56 class ITK_TEMPLATE_EXPORT GaussianMembershipFunction : public MembershipFunctionBase<TMeasurementVector>
57 {
58 public:
59  ITK_DISALLOW_COPY_AND_MOVE(GaussianMembershipFunction);
60 
66 
68  itkTypeMacro(GaussianMembershipFunction, MembershipFunction);
69  itkNewMacro(Self);
71 
74 
76  using MeasurementVectorType = TMeasurementVector;
77 
79  using MeasurementVectorSizeType = typename Superclass::MeasurementVectorSizeType;
80 
85 
88 
91  void
92  SetMean(const MeanVectorType & mean);
93 
96  itkGetConstReferenceMacro(Mean, MeanVectorType);
97 
102  void
103  SetCovariance(const CovarianceMatrixType & cov);
104 
105  /* Get the covariance matrix. Covariance matrix is a
106  VariableSizeMatrix of doubles. */
107  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);
108 
109  /* Get the inverse covariance matrix. Covariance matrix is a
110  VariableSizeMatrix of doubles. */
111  itkGetConstReferenceMacro(InverseCovariance, CovarianceMatrixType);
112 
114  double
115  Evaluate(const MeasurementVectorType & measurement) const override;
116 
120  typename LightObject::Pointer
121  InternalClone() const override;
122 
123 protected:
125  ~GaussianMembershipFunction() override = default;
126  void
127  PrintSelf(std::ostream & os, Indent indent) const override;
128 
129 private:
131  CovarianceMatrixType m_Covariance; // covariance matrix
132 
133  // inverse covariance matrix. automatically calculated
134  // when covariance matirx is set.
136 
137  // pre_factor (normalization term). automatically calculated
138  // when covariance matirx is set.
139  double m_PreFactor;
140 
143 };
144 } // end of namespace Statistics
145 } // end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 # include "itkGaussianMembershipFunction.hxx"
149 #endif
150 
151 #endif
itk::Statistics::GaussianMembershipFunction::m_InverseCovariance
CovarianceMatrixType m_InverseCovariance
Definition: itkGaussianMembershipFunction.h:135
itk::Statistics::GaussianMembershipFunction::m_PreFactor
double m_PreFactor
Definition: itkGaussianMembershipFunction.h:139
itk::Statistics::GaussianMembershipFunction::MeasurementVectorRealType
typename itk::NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType
Definition: itkGaussianMembershipFunction.h:83
itkMatrix.h
itk::Statistics::GaussianMembershipFunction::MeanVectorType
MeasurementVectorRealType MeanVectorType
Definition: itkGaussianMembershipFunction.h:84
itk::Statistics::GaussianMembershipFunction::MeasurementVectorSizeType
typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType
Definition: itkGaussianMembershipFunction.h:79
itk::Statistics::MembershipFunctionBase
MembershipFunctionBase defines common interfaces for membership functions.
Definition: itkMembershipFunctionBase.h:58
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Statistics::GaussianMembershipFunction::m_CovarianceNonsingular
bool m_CovarianceNonsingular
Definition: itkGaussianMembershipFunction.h:142
itk::VariableSizeMatrix< double >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Statistics::GaussianMembershipFunction::m_Covariance
CovarianceMatrixType m_Covariance
Definition: itkGaussianMembershipFunction.h:131
itk::Statistics::GaussianMembershipFunction::MembershipFunctionPointer
typename Superclass::Pointer MembershipFunctionPointer
Definition: itkGaussianMembershipFunction.h:73
itk::Statistics::GaussianMembershipFunction::MeasurementVectorType
TMeasurementVector MeasurementVectorType
Definition: itkGaussianMembershipFunction.h:76
itkMembershipFunctionBase.h
itk::Statistics::GaussianMembershipFunction::m_Mean
MeanVectorType m_Mean
Definition: itkGaussianMembershipFunction.h:130
itk::Statistics::GaussianMembershipFunction
GaussianMembershipFunction models class membership through a multivariate Gaussian function.
Definition: itkGaussianMembershipFunction.h:56
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84