OTB  10.0.0
Orfeo Toolbox
otbRandomSampler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbRandomSampler_h
22 #define otbRandomSampler_h
23 
24 #include "otbSamplerBase.h"
25 #include "OTBStatisticsExport.h"
26 
27 namespace otb
28 {
29 
40 class OTBStatistics_EXPORT RandomSampler : public SamplerBase
41 {
42 public:
45  typedef itk::SmartPointer<Self> Pointer;
46  typedef itk::SmartPointer<const Self> ConstPointer;
47 
51  typedef struct Parameter
52  {
53 
55  unsigned long MaxBufferSize;
56 
57  bool operator!=(const struct Parameter& param) const;
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(RandomSampler, SamplerBase);
65 
67  void SetParameters(const ParameterType& param)
68  {
69  if (m_Parameters != param)
70  {
71  this->Modified();
72  m_Parameters = param;
73  }
74  }
76 
79  {
80  return m_Parameters;
81  }
82 
86  void Reset(void) override;
87 
92  bool TakeSample(void);
93 
94 protected:
97 
99  ~RandomSampler() override
100  {
101  }
102 
103 private:
104  // Not implemented
106  void operator=(const Self&);
107 
110 
112  std::vector<unsigned long> m_Positions;
113 
115  std::vector<unsigned long>::iterator m_CurrentPosition;
116 };
117 
118 } // namespace otb
119 #endif
Random sampler for iteration loops.
ParameterType GetParameters()
ParameterType m_Parameters
RandomSampler Self
SamplerBase Superclass
std::vector< unsigned long >::iterator m_CurrentPosition
bool TakeSample(void)
itk::SmartPointer< Self > Pointer
itk::SmartPointer< const Self > ConstPointer
void Reset(void) override
std::vector< unsigned long > m_Positions
~RandomSampler() override
void operator=(const Self &)
RandomSampler(const Self &)
void SetParameters(const ParameterType &param)
This is a base class for sampling methods.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
bool operator!=(const struct Parameter &param) const