ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkMahalanobisDistanceMembershipFunction.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 itkMahalanobisDistanceMembershipFunction_h
19 #define itkMahalanobisDistanceMembershipFunction_h
20 
21 #include "itkVariableSizeMatrix.h"
22 
24 
25 namespace itk
26 {
27 namespace Statistics
28 {
61 template< typename TVector >
62 class ITK_TEMPLATE_EXPORT MahalanobisDistanceMembershipFunction:
63  public MembershipFunctionBase< TVector >
64 {
65 public:
71 
74  itkNewMacro(Self);
76 
79 
81  using MeasurementVectorType = TVector;
82 
84  using MeasurementVectorSizeType = typename Superclass::MeasurementVectorSizeType;
85 
88  using MeasurementVectorRealType = typename itk::NumericTraits< MeasurementVectorType >::RealType;
90 
93 
96  void SetMean(const MeanVectorType & mean);
97 
100  itkGetConstReferenceMacro(Mean, MeanVectorType);
101 
105  void SetCovariance(const CovarianceMatrixType & cov);
106 
109  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);
110 
116  double Evaluate(const MeasurementVectorType & measurement) const override;
117 
121  typename LightObject::Pointer InternalClone() const override;
122 
123 protected:
125  ~MahalanobisDistanceMembershipFunction() override = default;
126  void PrintSelf(std::ostream & os, Indent indent) const override;
127 
128 private:
130  CovarianceMatrixType m_Covariance; // covariance matrix
131 
132  // inverse covariance matrix. automatically calculated
133  // when covariace matirx is set.
135 
138 };
139 } // end of namespace Statistics
140 } // end namespace itk
141 
142 #ifndef ITK_MANUAL_INSTANTIATION
143 #include "itkMahalanobisDistanceMembershipFunction.hxx"
144 #endif
145 
146 #endif
Light weight base class for most itk classes.
MahalanobisDistanceMembershipFunction models class membership using Mahalanobis distance.
typename itk::NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType
typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType
MembershipFunctionBase defines common interfaces for membership functions.
Control indentation during Print() invocation.
Definition: itkIndent.h:49