OTB  10.0.0
Orfeo Toolbox
otbListSampleToBalancedListSampleFilter.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 otbListSampleToBalancedListSampleFilter_h
22 #define otbListSampleToBalancedListSampleFilter_h
23 
25 #include "itkDataObjectDecorator.h"
26 #include "otbMacro.h"
27 
28 namespace otb
29 {
30 namespace Statistics
31 {
32 
47 template <class TInputSampleList, class TLabelSampleList, class TOutputSampleList = TInputSampleList>
48 class ITK_EXPORT ListSampleToBalancedListSampleFilter : public otb::Statistics::ListSampleToListSampleFilter<TInputSampleList, TOutputSampleList>
49 {
50 public:
54  typedef itk::SmartPointer<Self> Pointer;
55  typedef itk::SmartPointer<const Self> ConstPointer;
56 
59 
61  itkNewMacro(Self);
62 
64  typedef TInputSampleList InputSampleListType;
65  typedef typename InputSampleListType::Pointer InputSampleListPointer;
66  typedef typename InputSampleListType::ConstPointer InputSampleListConstPointer;
67  typedef typename InputSampleListType::MeasurementVectorType InputMeasurementVectorType;
68  typedef typename InputMeasurementVectorType::ValueType InputValueType;
69 
71  typedef TLabelSampleList LabelSampleListType;
72  typedef typename LabelSampleListType::Pointer LabelSampleListPointer;
73  typedef typename LabelSampleListType::ConstPointer LabelSampleListConstPointer;
74  typedef typename LabelSampleListType::MeasurementVectorType LabelMeasurementVectorType;
75  typedef typename LabelMeasurementVectorType::ValueType LabelValueType;
76  typedef itk::DataObjectDecorator<LabelSampleListType> LabelSampleListObjectType;
77 
79  typedef TOutputSampleList OutputSampleListType;
80  typedef typename OutputSampleListType::Pointer OutputSampleListPointer;
81  typedef typename OutputSampleListType::ConstPointer OutputSampleListConstPointer;
82  typedef typename OutputSampleListType::MeasurementVectorType OutputMeasurementVectorType;
83  typedef typename OutputMeasurementVectorType::ValueType OutputValueType;
84 
87  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
88 
92 
94  void SetInputLabel(const LabelSampleListType* label);
95 
97  const LabelSampleListType* GetInputLabel() const;
98 
100  LabelSampleListType* GetOutputLabel();
101 
103  otbSetObjectMemberMacro(AddGaussianNoiseFilter, Mean, double);
104  otbGetObjectMemberConstMacro(AddGaussianNoiseFilter, Mean, double);
106 
108  otbSetObjectMemberMacro(AddGaussianNoiseFilter, Variance, double);
109  otbGetObjectMemberConstMacro(AddGaussianNoiseFilter, Variance, double);
111 
116  itkSetMacro(BalancingFactor, unsigned int);
117  itkGetMacro(BalancingFactor, unsigned int);
119 
120 protected:
122  void GenerateData() override;
123 
128  void ComputeMaxSampleFrequency();
129 
131  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
132  using Superclass::MakeOutput;
133 
136  {
137  }
138  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
139 
140 private:
142  void operator=(const Self&) = delete;
143 
145  std::vector<unsigned int> m_MultiplicativeCoefficient;
146  unsigned int m_BalancingFactor;
147 
148 }; // end of class ListSampleToBalancedListSampleFilter
149 
150 } // end of namespace Statistics
151 } // end of namespace otb
152 
153 #ifndef OTB_MANUAL_INSTANTIATION
155 #endif
156 
157 #endif
This class generate a noised version of the input sample list.
This class is a base class for filters using ListSample as input and returning ListSample.
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
itk::DataObject::Pointer DataObjectPointer
This class generate a balanced ListSample in order to have fair distribution of learning samples.
itk::DataObjectDecorator< LabelSampleListType > LabelSampleListObjectType
otb::Statistics::ListSampleToListSampleFilter< TInputSampleList, TOutputSampleList > Superclass
otbGetObjectMemberConstMacro(AddGaussianNoiseFilter, Mean, double)
otbSetObjectMemberMacro(AddGaussianNoiseFilter, Mean, double)
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
otb::Statistics::GaussianAdditiveNoiseSampleListFilter< InputSampleListType, OutputSampleListType > GaussianAdditiveNoiseType
otbSetObjectMemberMacro(AddGaussianNoiseFilter, Variance, double)
otbGetObjectMemberConstMacro(AddGaussianNoiseFilter, Variance, double)
This class is a base class for filters using ListSample as input and returning ListSample.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.