OTB  6.7.0
Orfeo Toolbox
otbModelComponentBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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"
31 
32 namespace otb
33 {
34 namespace Statistics
35 {
36 
64 template<class TSample>
65 class ITK_EXPORT ModelComponentBase :
66  public itk::Object
67 {
68 public:
74 
76  itkNewMacro(Self);
77  itkTypeMacro(ModelComponentBase, Object);
79 
80  typedef typename TSample::MeasurementVectorType MeasurementVectorType;
81  typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType;
82 
86 
88 
90  virtual void SetSample(const TSample* sample);
91 
93  const TSample* GetSample() const;
94 
99  MembershipFunctionType* GetPdfMembershipFunction();
100  MembershipFunctionType* GetCdfMembershipFunction();
102 
108  void SetCdfMembershipFunction(MembershipFunctionType* function);
109 
111  void SetParameters(const ParametersType& parameters);
113  {
114  return m_Parameters;
115  }
117 
119  double Evaluate(MeasurementVectorType& measurements);
120  double Pdf(MeasurementVectorType& measurements);
122 
124  double Cdf(MeasurementVectorType& measurements);
125 
128  virtual void Update();
129 
131  virtual void ShowParameters(std::ostream& os, itk::Indent indent) const;
132 
133  // TODO: Distance between distributions with some kind of member function...
134 
135 protected:
137  ~ModelComponentBase() override {}
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
TSample::MeasurementVectorType MeasurementVectorType
base class for distribution representation that supports analytical way to update the distribution pa...
TSample::MeasurementVectorSizeType MeasurementVectorSizeType
itk::SmartPointer< const Self > ConstPointer
itk::Statistics::MembershipFunctionBase< MeasurementVectorType > MembershipFunctionType