ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkMixtureModelComponentBase.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 itkMixtureModelComponentBase_h
19 #define itkMixtureModelComponentBase_h
20 
21 #include "vnl/vnl_vector.h"
22 #include "vnl/vnl_matrix.h"
23 
24 #include "itkArray.h"
25 #include "itkObject.h"
27 
28 namespace itk
29 {
30 namespace Statistics
31 {
55 template< typename TSample >
56 class ITK_TEMPLATE_EXPORT MixtureModelComponentBase:
57  public Object
58 {
59 public:
62  typedef Object Superclass;
65 
68 
69  typedef typename TSample::MeasurementVectorType MeasurementVectorType;
70  typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType;
71 
75 
78 
80 
82  virtual void SetSample(const TSample *sample);
83 
85  const TSample * GetSample() const;
86 
91  MembershipFunctionType * GetMembershipFunction();
92 
93  void SetMinimalParametersChange(double change)
94  {
95  m_MinimalParametersChange = change;
96  }
97 
99  {
100  return m_MinimalParametersChange;
101  }
102 
103  virtual void SetParameters(const ParametersType & parameters);
104 
106  {
107  return m_Parameters;
108  }
109 
112  void AreParametersModified(bool flag);
113 
115  bool AreParametersModified();
116 
118  void SetWeight(unsigned int index, double value);
119 
121  double GetWeight(unsigned int index) const;
122 
124  double Evaluate(MeasurementVectorType & measurements);
125 
127  itkGetConstReferenceMacro(Weights, WeightArrayType);
128 
129  virtual void Update();
130 
131 protected:
133  virtual ~MixtureModelComponentBase() ITK_OVERRIDE;
134  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
135 
139  void SetMembershipFunction(MembershipFunctionType *function);
140 
141  virtual void GenerateData() = 0;
142 
143 private:
145  const TSample *m_Sample;
146 
147  double m_MinimalParametersChange;
148 
149  ParametersType m_Parameters;
150 
152  MembershipFunctionType *m_MembershipFunction;
153 
155  WeightArrayType m_Weights;
156 
158  bool m_ParametersModified;
159 }; // end of class
160 } // end of namespace Statistics
161 } // end of namespace itk
162 
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "itkMixtureModelComponentBase.hxx"
165 #endif
166 
167 #endif
MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
MembershipFunctionBase defines common interfaces for membership functions.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
base class for distribution modules that supports analytical way to update the distribution parameter...
TSample::MeasurementVectorSizeType MeasurementVectorSizeType
Base class for most ITK classes.
Definition: itkObject.h:59