OTB  10.0.0
Orfeo Toolbox
otbModelComponentBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  * Copyright (C) 2007-2012 Institut Mines Telecom / Telecom Bretagne
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbModelComponentBase_h
23 #define otbModelComponentBase_h
24 
25 #include <vnl/vnl_vector.h>
26 #include <vnl/vnl_matrix.h>
27 
28 #include "itkObject.h"
29 #include "itkArray.h"
30 #include "itkMembershipFunctionBase.h"
31 
32 namespace otb
33 {
34 namespace Statistics
35 {
36 
64 template <class TSample>
65 class ITK_EXPORT ModelComponentBase : public itk::Object
66 {
67 public:
70  typedef itk::Object Superclass;
71  typedef itk::SmartPointer<Self> Pointer;
72  typedef itk::SmartPointer<const Self> ConstPointer;
73 
75  itkNewMacro(Self);
76  itkTypeMacro(ModelComponentBase, Object);
78 
79  typedef typename TSample::MeasurementVectorType MeasurementVectorType;
80  typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType;
81 
83  typedef itk::Statistics::MembershipFunctionBase<MeasurementVectorType> MembershipFunctionType;
84 
85  typedef itk::Array<double> ParametersType;
86 
88  virtual void SetSample(const TSample* sample);
89 
91  const TSample* GetSample() const;
92 
97  MembershipFunctionType* GetPdfMembershipFunction();
98  MembershipFunctionType* GetCdfMembershipFunction();
100 
106  void SetCdfMembershipFunction(MembershipFunctionType* function);
107 
109  void SetParameters(const ParametersType& parameters);
111  {
112  return m_Parameters;
113  }
115 
117  double Evaluate(MeasurementVectorType& measurements);
118  double Pdf(MeasurementVectorType& measurements);
120 
122  double Cdf(MeasurementVectorType& measurements);
123 
126  virtual void Update();
127 
129  virtual void ShowParameters(std::ostream& os, itk::Indent indent) const;
130 
131  // TODO: Distance between distributions with some kind of member function...
132 
133 protected:
136  {
137  }
138  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
139 
140  virtual void GenerateData();
141 
145  void SetPdfMembershipFunction(MembershipFunctionType* function);
146 
148  int IsSampleModified();
149 
152 
153 private:
154  ModelComponentBase(const Self&) = delete;
155  void operator=(const Self&) = delete;
157  const TSample* m_Sample;
158 
159 protected:
162 
165 
168 
169 }; // end of class
170 
171 } // end of namespace Statistics
172 } // end of namespace otb
173 
174 #ifndef OTB_MANUAL_INSTANTIATION
175 #include "otbModelComponentBase.hxx"
176 #endif
177 
178 #endif
base class for distribution representation that supports analytical way to update the distribution pa...
TSample::MeasurementVectorSizeType MeasurementVectorSizeType
void operator=(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
double Evaluate(MeasurementVectorType &measurements)
TSample::MeasurementVectorType MeasurementVectorType
ModelComponentBase(const Self &)=delete
itk::Statistics::MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.