OTB  9.0.0
Orfeo Toolbox
otbModelComponentBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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
otb::Statistics::ModelComponentBase::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbModelComponentBase.h:72
otb::Statistics::ModelComponentBase::GetParameters
ParametersType GetParameters()
Definition: otbModelComponentBase.h:110
otb::Statistics::ModelComponentBase
base class for distribution representation that supports analytical way to update the distribution pa...
Definition: otbModelComponentBase.h:65
otb::Statistics::ModelComponentBase::m_PdfFunction
MembershipFunctionType * m_PdfFunction
Definition: otbModelComponentBase.h:161
otb::Statistics::ModelComponentBase::ParametersType
itk::Array< double > ParametersType
Definition: otbModelComponentBase.h:85
otb::Statistics::ModelComponentBase::m_CdfFunction
MembershipFunctionType * m_CdfFunction
Definition: otbModelComponentBase.h:164
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Statistics::ModelComponentBase::MeasurementVectorSizeType
TSample::MeasurementVectorSizeType MeasurementVectorSizeType
Definition: otbModelComponentBase.h:80
otb::Statistics::ModelComponentBase::Superclass
itk::Object Superclass
Definition: otbModelComponentBase.h:70
otb::Statistics::ModelComponentBase::m_SampleModified
int m_SampleModified
Definition: otbModelComponentBase.h:167
otb::Statistics::ModelComponentBase::Self
ModelComponentBase Self
Definition: otbModelComponentBase.h:69
otb::Statistics::ModelComponentBase::~ModelComponentBase
~ModelComponentBase() override
Definition: otbModelComponentBase.h:135
otb::Statistics::ModelComponentBase::MembershipFunctionType
itk::Statistics::MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType
Definition: otbModelComponentBase.h:83
otb::Statistics::ModelComponentBase::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbModelComponentBase.h:71
otb::Statistics::ModelComponentBase::MeasurementVectorType
TSample::MeasurementVectorType MeasurementVectorType
Definition: otbModelComponentBase.h:76
otbModelComponentBase.hxx
otb::Statistics::ModelComponentBase::m_Sample
const TSample * m_Sample
Definition: otbModelComponentBase.h:157
otb::Statistics::ModelComponentBase::m_Parameters
ParametersType m_Parameters
Definition: otbModelComponentBase.h:151