OTB  9.0.0
Orfeo Toolbox
otbRandomSampler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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 
26 namespace otb
27 {
28 
39 class ITK_EXPORT RandomSampler : public SamplerBase
40 {
41 public:
44  typedef itk::SmartPointer<Self> Pointer;
45  typedef itk::SmartPointer<const Self> ConstPointer;
46 
50  typedef struct Parameter
51  {
52 
54  unsigned long MaxBufferSize;
55 
56  bool operator!=(const struct Parameter& param) const;
57  } ParameterType;
58 
60  itkNewMacro(Self);
61 
63  itkTypeMacro(RandomSampler, SamplerBase);
64 
66  void SetParameters(const ParameterType& param)
67  {
68  if (m_Parameters != param)
69  {
70  this->Modified();
71  m_Parameters = param;
72  }
73  }
75 
78  {
79  return m_Parameters;
80  }
81 
85  void Reset(void) override;
86 
91  bool TakeSample(void);
92 
93 protected:
95  RandomSampler();
96 
98  ~RandomSampler() override
99  {
100  }
101 
102 private:
103  // Not implemented
104  RandomSampler(const Self&);
105  void operator=(const Self&);
106 
109 
111  std::vector<unsigned long> m_Positions;
112 
114  std::vector<unsigned long>::iterator m_CurrentPosition;
115 };
116 
117 } // namespace otb
118 #endif
otb::RandomSampler::Parameter
Definition: otbRandomSampler.h:50
otb::RandomSampler::~RandomSampler
~RandomSampler() override
Definition: otbRandomSampler.h:98
otb::RandomSampler::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbRandomSampler.h:44
otb::RandomSampler::Self
RandomSampler Self
Definition: otbRandomSampler.h:42
otb::RandomSampler::GetParameters
ParameterType GetParameters()
Definition: otbRandomSampler.h:77
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::RandomSampler::m_CurrentPosition
std::vector< unsigned long >::iterator m_CurrentPosition
Definition: otbRandomSampler.h:114
otb::RandomSampler::m_Positions
std::vector< unsigned long > m_Positions
Definition: otbRandomSampler.h:111
otb::SamplerBase
This is a base class for sampling methods.
Definition: otbSamplerBase.h:37
otbSamplerBase.h
otb::RandomSampler
Random sampler for iteration loops.
Definition: otbRandomSampler.h:39
otb::RandomSampler::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbRandomSampler.h:45
otb::RandomSampler::Superclass
SamplerBase Superclass
Definition: otbRandomSampler.h:43
otb::RandomSampler::SetParameters
void SetParameters(const ParameterType &param)
Definition: otbRandomSampler.h:66
otb::operator!=
constexpr bool operator!=(extents< StaticExtentsL... > const &lhs, extents< StaticExtentsR... > const &rhs)
Definition: otbExtents.h:164
otb::RandomSampler::m_Parameters
ParameterType m_Parameters
Definition: otbRandomSampler.h:108
otb::Wrapper::ParameterType
ParameterType
Definition: otbWrapperTypes.h:37
otb::RandomSampler::Parameter::MaxBufferSize
unsigned long MaxBufferSize
Definition: otbRandomSampler.h:54