ITK  5.2.0
Insight Toolkit
itkMixtureModelComponentBase.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  * 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 {
56 template <typename TSample>
57 class ITK_TEMPLATE_EXPORT MixtureModelComponentBase : public Object
58 {
59 public:
62  using Superclass = Object;
65 
67  itkTypeMacro(MixtureModelComponentBase, Object);
68 
69  using MeasurementVectorType = typename TSample::MeasurementVectorType;
70  using MeasurementVectorSizeType = typename TSample::MeasurementVectorSizeType;
71 
74 
77 
79 
81  virtual void
82  SetSample(const TSample * sample);
83 
85  const TSample *
86  GetSample() const;
87 
93  GetMembershipFunction();
94 
95  void
97  {
98  m_MinimalParametersChange = change;
99  }
100 
101  double
103  {
104  return m_MinimalParametersChange;
105  }
106 
107  virtual void
108  SetParameters(const ParametersType & parameters);
109 
110  virtual ParametersType
112  {
113  return m_Parameters;
114  }
115 
118  void
119  AreParametersModified(bool flag);
120 
122  bool
123  AreParametersModified();
124 
126  void
127  SetWeight(unsigned int index, double value);
128 
130  double
131  GetWeight(unsigned int index) const;
132 
134  double
135  Evaluate(MeasurementVectorType & measurements);
136 
138  itkGetConstReferenceMacro(Weights, WeightArrayType);
139 
140  virtual void
141  Update();
142 
143 protected:
145  ~MixtureModelComponentBase() override = default;
146  void
147  PrintSelf(std::ostream & os, Indent indent) const override;
148 
152  void
153  SetMembershipFunction(MembershipFunctionType * function);
154 
155  virtual void
156  GenerateData() = 0;
157 
158 private:
160  const TSample * m_Sample;
161 
163 
165 
168 
171 
174 }; // end of class
175 } // end of namespace Statistics
176 } // end of namespace itk
177 
178 #ifndef ITK_MANUAL_INSTANTIATION
179 # include "itkMixtureModelComponentBase.hxx"
180 #endif
181 
182 #endif
itk::Statistics::MixtureModelComponentBase::SetMinimalParametersChange
void SetMinimalParametersChange(double change)
Definition: itkMixtureModelComponentBase.h:96
itk::Statistics::MixtureModelComponentBase
base class for distribution modules that supports analytical way to update the distribution parameter...
Definition: itkMixtureModelComponentBase.h:57
itk::Statistics::MixtureModelComponentBase::m_MinimalParametersChange
double m_MinimalParametersChange
Definition: itkMixtureModelComponentBase.h:162
itk::Statistics::MixtureModelComponentBase::GetFullParameters
virtual ParametersType GetFullParameters()
Definition: itkMixtureModelComponentBase.h:111
itk::Statistics::MixtureModelComponentBase::MeasurementVectorType
typename TSample::MeasurementVectorType MeasurementVectorType
Definition: itkMixtureModelComponentBase.h:69
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::MixtureModelComponentBase::m_Weights
WeightArrayType m_Weights
Definition: itkMixtureModelComponentBase.h:170
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::Statistics::MixtureModelComponentBase::MeasurementVectorSizeType
typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType
Definition: itkMixtureModelComponentBase.h:70
itk::Statistics::MixtureModelComponentBase::m_MembershipFunction
MembershipFunctionType * m_MembershipFunction
Definition: itkMixtureModelComponentBase.h:167
itk::Statistics::MixtureModelComponentBase::m_Parameters
ParametersType m_Parameters
Definition: itkMixtureModelComponentBase.h:164
itkMembershipFunctionBase.h
itkArray.h
itk::Statistics::MixtureModelComponentBase::m_ParametersModified
bool m_ParametersModified
Definition: itkMixtureModelComponentBase.h:173
itk::Statistics::MixtureModelComponentBase::m_Sample
const TSample * m_Sample
Definition: itkMixtureModelComponentBase.h:160
itkObject.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Array< double >
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::Statistics::MixtureModelComponentBase::GetMinimalParametersChange
double GetMinimalParametersChange()
Definition: itkMixtureModelComponentBase.h:102