ITK  6.0.0
Insight Toolkit
itkMahalanobisDistanceMembershipFunction.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  * https://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 itkMahalanobisDistanceMembershipFunction_h
19 #define itkMahalanobisDistanceMembershipFunction_h
20 
22 #include "itkVariableSizeMatrix.h"
23 
25 
26 namespace itk
27 {
28 namespace Statistics
29 {
62 template <typename TVector>
63 class ITK_TEMPLATE_EXPORT MahalanobisDistanceMembershipFunction : public MembershipFunctionBase<TVector>
64 {
65 public:
71 
73  itkOverrideGetNameOfClassMacro(MahalanobisDistanceMembershipFunction);
74  itkNewMacro(Self);
79 
81  using MeasurementVectorType = TVector;
82 
84  using typename Superclass::MeasurementVectorSizeType;
85 
90 
93 
96  void
97  SetMean(const MeanVectorType & mean);
98 
101  itkGetConstReferenceMacro(Mean, MeanVectorType);
102 
106  void
107  SetCovariance(const CovarianceMatrixType & cov);
108 
111  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);
112 
118  double
119  Evaluate(const MeasurementVectorType & measurement) const override;
120 
124  typename LightObject::Pointer
125  InternalClone() const override;
126 
127 protected:
129  ~MahalanobisDistanceMembershipFunction() override = default;
130  void
131  PrintSelf(std::ostream & os, Indent indent) const override;
132 
133 private:
134  MeanVectorType m_Mean{}; // mean
135  CovarianceMatrixType m_Covariance{}; // covariance matrix
136 
137  // inverse covariance matrix. automatically calculated
138  // when covariance matrix is set.
139  CovarianceMatrixType m_InverseCovariance{};
140 
142  bool m_CovarianceNonsingular{};
143 };
144 } // end of namespace Statistics
145 } // end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 # include "itkMahalanobisDistanceMembershipFunction.hxx"
149 #endif
150 
151 #endif
itk::Statistics::MahalanobisDistanceMembershipFunction::MeasurementVectorRealType
typename itk::NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType
Definition: itkMahalanobisDistanceMembershipFunction.h:88
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itkVariableSizeMatrix.h
itk::Statistics::MahalanobisDistanceMembershipFunction::MeasurementVectorType
TVector MeasurementVectorType
Definition: itkMahalanobisDistanceMembershipFunction.h:81
itkNumericTraitsVectorPixel.h
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::MahalanobisDistanceMembershipFunction::MembershipFunctionPointer
typename Superclass::Pointer MembershipFunctionPointer
Definition: itkMahalanobisDistanceMembershipFunction.h:78
itk::VariableSizeMatrix< double >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkMembershipFunctionBase.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Statistics::MahalanobisDistanceMembershipFunction::MeanVectorType
MeasurementVectorRealType MeanVectorType
Definition: itkMahalanobisDistanceMembershipFunction.h:89
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:86
itk::Statistics::MahalanobisDistanceMembershipFunction
MahalanobisDistanceMembershipFunction models class membership using Mahalanobis distance.
Definition: itkMahalanobisDistanceMembershipFunction.h:63