ITK  6.0.0
Insight Toolkit
itkExpectationMaximizationMixtureModelEstimator.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 itkExpectationMaximizationMixtureModelEstimator_h
19#define itkExpectationMaximizationMixtureModelEstimator_h
20
21#include "ITKStatisticsExport.h"
25
26namespace itk
27{
28namespace Statistics
29{
35{
36public:
40 enum class TERMINATION_CODE : uint8_t
41 {
42 CONVERGED = 0,
43 NOT_CONVERGED = 1
44 };
45};
46// Define how to print enumeration
47extern ITKStatistics_EXPORT std::ostream &
49
85template <typename TSample>
86class ITK_TEMPLATE_EXPORT ExpectationMaximizationMixtureModelEstimator : public Object
87{
88public:
94
96 itkOverrideGetNameOfClassMacro(ExpectationMaximizationMixtureModelEstimator);
97 itkNewMacro(Self);
101 using SampleType = TSample;
102 using MeasurementType = typename TSample::MeasurementType;
103 using MeasurementVectorType = typename TSample::MeasurementVectorType;
104
108
110
113 using MembershipFunctionVectorType = std::vector<MembershipFunctionPointer>;
116
119
121 using ComponentVectorType = std::vector<ComponentType *>;
122
125
128
130 void
131 SetSample(const TSample * sample);
132
134 const TSample *
135 GetSample() const;
136
139 void
141
144
148
152
156
161 void
162 SetMaximumIteration(int numberOfIterations);
163
164 int
166
168 int
170 {
171 return m_CurrentIteration;
172 }
173
175 int
177
179 unsigned int
181
183 void
185
187#if !defined(ITK_LEGACY_REMOVE)
189 static constexpr TERMINATION_CODE_ENUM CONVERGED = TERMINATION_CODE_ENUM::CONVERGED;
190 static constexpr TERMINATION_CODE_ENUM NOT_CONVERGED = TERMINATION_CODE_ENUM::NOT_CONVERGED;
191#endif
192
196
200 GetComponentMembershipFunction(int componentIndex) const;
201
205 GetOutput() const;
206
207protected:
210 void
211 PrintSelf(std::ostream & os, Indent indent) const override;
212
213 bool
215
216 double
218
219 bool
221
222 bool
224
226 void
228
229private:
231 const TSample * m_Sample{};
232
233 int m_MaxIteration{ 100 };
234 int m_CurrentIteration{ 0 };
235
236 TERMINATION_CODE_ENUM m_TerminationCode{ TERMINATION_CODE_ENUM::NOT_CONVERGED };
237 ComponentVectorType m_ComponentVector{};
238 ProportionVectorType m_InitialProportions{};
239 ProportionVectorType m_Proportions{};
240
241 MembershipFunctionVectorObjectPointer m_MembershipFunctionsObject{};
242 MembershipFunctionsWeightsArrayPointer m_MembershipFunctionsWeightArrayObject{};
243}; // end of class
244} // end of namespace Statistics
245} // end of namespace itk
246
247#ifndef ITK_MANUAL_INSTANTIATION
248# include "itkExpectationMaximizationMixtureModelEstimator.hxx"
249#endif
250
251#endif
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Contains all enum classes used by ExpectationMaximizationMixtureModelEstimator class.
This class generates the parameter estimates for a mixture model using expectation maximization strat...
void SetInitialProportions(ProportionVectorType &proportions)
const MembershipFunctionVectorObjectType * GetOutput() const
void PrintSelf(std::ostream &os, Indent indent) const override
const MembershipFunctionsWeightsArrayObjectType * GetMembershipFunctionsWeightsArray() const
typename MembershipFunctionVectorObjectType::Pointer MembershipFunctionVectorObjectPointer
const ProportionVectorType & GetInitialProportions() const
typename MembershipFunctionsWeightsArrayObjectType::Pointer MembershipFunctionsWeightsArrayPointer
ComponentMembershipFunctionType * GetComponentMembershipFunction(int componentIndex) const
GaussianMembershipFunction models class membership through a multivariate Gaussian function.
MembershipFunctionBase defines common interfaces for membership functions.
base class for distribution modules that supports analytical way to update the distribution parameter...
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
ITKStatistics_EXPORT std::ostream & operator<<(std::ostream &out, const ExpectationMaximizationMixtureModelEstimatorEnums::TERMINATION_CODE value)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....