OTB  9.0.0
Orfeo Toolbox
otbListSampleToBalancedListSampleFilter.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 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:
141  ListSampleToBalancedListSampleFilter(const Self&) = delete;
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
otb::Statistics::ListSampleToBalancedListSampleFilter::InputSampleListType
TInputSampleList InputSampleListType
Definition: otbListSampleToBalancedListSampleFilter.h:61
otb::Statistics::ListSampleToBalancedListSampleFilter::OutputSampleListType
TOutputSampleList OutputSampleListType
Definition: otbListSampleToBalancedListSampleFilter.h:79
otb::Statistics::ListSampleToBalancedListSampleFilter::m_AddGaussianNoiseFilter
GaussianAdditiveNoisePointerType m_AddGaussianNoiseFilter
Definition: otbListSampleToBalancedListSampleFilter.h:144
otb::Statistics::ListSampleToBalancedListSampleFilter::~ListSampleToBalancedListSampleFilter
~ListSampleToBalancedListSampleFilter() override
Definition: otbListSampleToBalancedListSampleFilter.h:135
otb::Statistics::ListSampleToBalancedListSampleFilter::Superclass
otb::Statistics::ListSampleToListSampleFilter< TInputSampleList, TOutputSampleList > Superclass
Definition: otbListSampleToBalancedListSampleFilter.h:53
otb::Statistics::ListSampleToBalancedListSampleFilter::InputMeasurementVectorType
InputSampleListType::MeasurementVectorType InputMeasurementVectorType
Definition: otbListSampleToBalancedListSampleFilter.h:67
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Statistics::ListSampleToBalancedListSampleFilter::LabelSampleListPointer
LabelSampleListType::Pointer LabelSampleListPointer
Definition: otbListSampleToBalancedListSampleFilter.h:72
otb::Statistics::ListSampleToBalancedListSampleFilter::LabelSampleListType
TLabelSampleList LabelSampleListType
Definition: otbListSampleToBalancedListSampleFilter.h:71
otbMacro.h
otb::Statistics::ListSampleToBalancedListSampleFilter::GaussianAdditiveNoisePointerType
GaussianAdditiveNoiseType::Pointer GaussianAdditiveNoisePointerType
Definition: otbListSampleToBalancedListSampleFilter.h:91
otb::Statistics::ListSampleToBalancedListSampleFilter
This class generate a balanced ListSample in order to have fair distribution of learning samples.
Definition: otbListSampleToBalancedListSampleFilter.h:48
otb::Statistics::ListSampleToBalancedListSampleFilter::InputSampleListConstPointer
InputSampleListType::ConstPointer InputSampleListConstPointer
Definition: otbListSampleToBalancedListSampleFilter.h:66
otb::Statistics::ListSampleToBalancedListSampleFilter::LabelSampleListObjectType
itk::DataObjectDecorator< LabelSampleListType > LabelSampleListObjectType
Definition: otbListSampleToBalancedListSampleFilter.h:76
otb::Statistics::ListSampleToBalancedListSampleFilter::InputValueType
InputMeasurementVectorType::ValueType InputValueType
Definition: otbListSampleToBalancedListSampleFilter.h:68
otb::Statistics::ListSampleToListSampleFilter::DataObjectPointer
itk::DataObject::Pointer DataObjectPointer
Definition: otbListSampleToListSampleFilter.h:74
otb::Statistics::ListSampleToBalancedListSampleFilter::Self
ListSampleToBalancedListSampleFilter Self
Definition: otbListSampleToBalancedListSampleFilter.h:52
otb::Statistics::ListSampleToListSampleFilter
This class is a base class for filters using ListSample as input and returning ListSample.
Definition: otbListSampleToListSampleFilter.h:43
otb::Statistics::ListSampleToBalancedListSampleFilter::OutputSampleListPointer
OutputSampleListType::Pointer OutputSampleListPointer
Definition: otbListSampleToBalancedListSampleFilter.h:80
otb::Statistics::ListSampleToBalancedListSampleFilter::LabelValueType
LabelMeasurementVectorType::ValueType LabelValueType
Definition: otbListSampleToBalancedListSampleFilter.h:75
otb::Statistics::ListSampleToBalancedListSampleFilter::m_MultiplicativeCoefficient
std::vector< unsigned int > m_MultiplicativeCoefficient
Definition: otbListSampleToBalancedListSampleFilter.h:145
otb::Statistics::ListSampleToBalancedListSampleFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbListSampleToBalancedListSampleFilter.h:54
otb::Statistics::ListSampleToBalancedListSampleFilter::GaussianAdditiveNoiseType
otb::Statistics::GaussianAdditiveNoiseSampleListFilter< InputSampleListType, OutputSampleListType > GaussianAdditiveNoiseType
Definition: otbListSampleToBalancedListSampleFilter.h:90
otb::Statistics::ListSampleToBalancedListSampleFilter::LabelSampleListConstPointer
LabelSampleListType::ConstPointer LabelSampleListConstPointer
Definition: otbListSampleToBalancedListSampleFilter.h:73
otb::Statistics::ListSampleToBalancedListSampleFilter::OutputValueType
OutputMeasurementVectorType::ValueType OutputValueType
Definition: otbListSampleToBalancedListSampleFilter.h:83
otb::Statistics::ListSampleToBalancedListSampleFilter::OutputSampleListConstPointer
OutputSampleListType::ConstPointer OutputSampleListConstPointer
Definition: otbListSampleToBalancedListSampleFilter.h:81
otb::Statistics::GaussianAdditiveNoiseSampleListFilter
This class generate a noised version of the input sample list.
Definition: otbGaussianAdditiveNoiseSampleListFilter.h:48
otb::Statistics::ListSampleToBalancedListSampleFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbListSampleToBalancedListSampleFilter.h:55
otbGetObjectMemberConstMacro
#define otbGetObjectMemberConstMacro(object, name, type)
Definition: otbMacro.h:100
otb::Statistics::ListSampleToBalancedListSampleFilter::m_BalancingFactor
unsigned int m_BalancingFactor
Definition: otbListSampleToBalancedListSampleFilter.h:146
otb::Statistics::ListSampleToBalancedListSampleFilter::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbListSampleToBalancedListSampleFilter.h:87
otb::Statistics::ListSampleToBalancedListSampleFilter::OutputMeasurementVectorType
OutputSampleListType::MeasurementVectorType OutputMeasurementVectorType
Definition: otbListSampleToBalancedListSampleFilter.h:82
otbGaussianAdditiveNoiseSampleListFilter.h
otb::Statistics::ListSampleToBalancedListSampleFilter::LabelMeasurementVectorType
LabelSampleListType::MeasurementVectorType LabelMeasurementVectorType
Definition: otbListSampleToBalancedListSampleFilter.h:74
otb::Statistics::GaussianAdditiveNoiseSampleListFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGaussianAdditiveNoiseSampleListFilter.h:54
otb::Statistics::ListSampleToBalancedListSampleFilter::InputSampleListPointer
InputSampleListType::Pointer InputSampleListPointer
Definition: otbListSampleToBalancedListSampleFilter.h:65
otbSetObjectMemberMacro
#define otbSetObjectMemberMacro(object, name, type)
Definition: otbMacro.h:79
otb::Statistics::ListSampleToBalancedListSampleFilter::DataObjectPointer
Superclass::DataObjectPointer DataObjectPointer
Definition: otbListSampleToBalancedListSampleFilter.h:86
otbListSampleToBalancedListSampleFilter.hxx