ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkExpectationMaximizationMixtureModelEstimator.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 __itkExpectationMaximizationMixtureModelEstimator_h
19 #define __itkExpectationMaximizationMixtureModelEstimator_h
20 
24 
25 namespace itk
26 {
27 namespace Statistics
28 {
60 template< class TSample >
62 {
63 public:
66  typedef Object Superclass;
69 
72  Object);
73  itkNewMacro(Self);
75 
77  typedef TSample SampleType;
78  typedef typename TSample::MeasurementType MeasurementType;
79  typedef typename TSample::MeasurementVectorType MeasurementVectorType;
80 
85 
88 
91  typedef std::vector< MembershipFunctionPointer > MembershipFunctionVectorType;
94  typedef typename
96 
99 
101  typedef std::vector< ComponentType * > ComponentVectorType;
102 
106 
109 
111  void SetSample(const TSample *sample);
112 
114  const TSample * GetSample() const;
115 
118  void SetInitialProportions(ProportionVectorType & propotion);
119 
120  const ProportionVectorType & GetInitialProportions() const;
121 
123  const ProportionVectorType & GetProportions() const;
124 
128  typedef typename
130 
132  const MembershipFunctionsWeightsArrayObjectType * GetMembershipFunctionsWeightsArray() const;
133 
138  void SetMaximumIteration(int numberOfIterations);
139 
140  int GetMaximumIteration() const;
141 
143  int GetCurrentIteration()
144  {
145  return m_CurrentIteration;
146  }
147 
149  int AddComponent(ComponentType *component);
150 
152  unsigned int GetNumberOfComponents() const;
153 
155  void Update();
156 
158  enum TERMINATION_CODE { CONVERGED = 0, NOT_CONVERGED = 1 };
159 
161  TERMINATION_CODE GetTerminationCode() const;
162 
165  ComponentMembershipFunctionType * GetComponentMembershipFunction(int componentIndex) const;
166 
169  const MembershipFunctionVectorObjectType * GetOutput() const;
170 
171 protected:
174  void PrintSelf(std::ostream & os, Indent indent) const;
175 
176  bool CalculateDensities();
177 
178  double CalculateExpectation() const;
179 
180  bool UpdateComponentParameters();
181 
182  bool UpdateProportions();
183 
185  void GenerateData();
186 
187 private:
189  const TSample *m_Sample;
190 
193 
198 
201 }; // end of class
202 } // end of namespace Statistics
203 } // end of namespace itk
204 
205 #ifndef ITK_MANUAL_INSTANTIATION
206 #include "itkExpectationMaximizationMixtureModelEstimator.hxx"
207 #endif
208 
209 #endif
210