ITK  5.0.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  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 SetSample(const TSample *sample);
82 
84  const TSample * GetSample() const;
85 
90  MembershipFunctionType * GetMembershipFunction();
91 
92  void SetMinimalParametersChange(double change)
93  {
94  m_MinimalParametersChange = change;
95  }
96 
98  {
99  return m_MinimalParametersChange;
100  }
101 
102  virtual void SetParameters(const ParametersType & parameters);
103 
105  {
106  return m_Parameters;
107  }
108 
111  void AreParametersModified(bool flag);
112 
114  bool AreParametersModified();
115 
117  void SetWeight(unsigned int index, double value);
118 
120  double GetWeight(unsigned int index) const;
121 
123  double Evaluate(MeasurementVectorType & measurements);
124 
126  itkGetConstReferenceMacro(Weights, WeightArrayType);
127 
128  virtual void Update();
129 
130 protected:
132  ~MixtureModelComponentBase() override = default;
133  void PrintSelf(std::ostream & os, Indent indent) const override;
134 
138  void SetMembershipFunction(MembershipFunctionType *function);
139 
140  virtual void GenerateData() = 0;
141 
142 private:
144  const TSample *m_Sample;
145 
147 
149 
152 
155 
158 }; // end of class
159 } // end of namespace Statistics
160 } // end of namespace itk
161 
162 #ifndef ITK_MANUAL_INSTANTIATION
163 #include "itkMixtureModelComponentBase.hxx"
164 #endif
165 
166 #endif
typename TSample::MeasurementVectorType MeasurementVectorType
Light weight base class for most itk classes.
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...
typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType
Base class for most ITK classes.
Definition: itkObject.h:60