OTB  6.7.0
Orfeo Toolbox
otbListSampleToBalancedListSampleFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 namespace Statistics {
30 
45 template < class TInputSampleList,
46  class TLabelSampleList,
47  class TOutputSampleList = TInputSampleList >
49  public otb::Statistics::ListSampleToListSampleFilter<TInputSampleList,
50  TOutputSampleList>
51 {
52 public:
56  <TInputSampleList, TOutputSampleList> Superclass;
59 
62 
64  itkNewMacro(Self);
65 
67  typedef TInputSampleList InputSampleListType;
68  typedef typename InputSampleListType::Pointer InputSampleListPointer;
69  typedef typename InputSampleListType::ConstPointer InputSampleListConstPointer;
70  typedef typename InputSampleListType::MeasurementVectorType InputMeasurementVectorType;
71  typedef typename InputMeasurementVectorType::ValueType InputValueType;
72 
74  typedef TLabelSampleList LabelSampleListType;
75  typedef typename LabelSampleListType::Pointer LabelSampleListPointer;
76  typedef typename LabelSampleListType::ConstPointer LabelSampleListConstPointer;
77  typedef typename LabelSampleListType::MeasurementVectorType LabelMeasurementVectorType;
78  typedef typename LabelMeasurementVectorType::ValueType LabelValueType;
80 
82  typedef TOutputSampleList OutputSampleListType;
83  typedef typename OutputSampleListType::Pointer OutputSampleListPointer;
84  typedef typename OutputSampleListType::ConstPointer OutputSampleListConstPointer;
85  typedef typename OutputSampleListType::MeasurementVectorType OutputMeasurementVectorType;
86  typedef typename OutputMeasurementVectorType::ValueType OutputValueType;
87 
91 
96 
98  void SetInputLabel( const LabelSampleListType * label );
99 
101  const LabelSampleListType * GetInputLabel() const;
102 
104  LabelSampleListType * GetOutputLabel();
105 
107  otbSetObjectMemberMacro(AddGaussianNoiseFilter, Mean, double);
108  otbGetObjectMemberConstMacro(AddGaussianNoiseFilter, Mean, double);
110 
112  otbSetObjectMemberMacro(AddGaussianNoiseFilter, Variance, double);
113  otbGetObjectMemberConstMacro(AddGaussianNoiseFilter, Variance, double);
115 
120  itkSetMacro(BalancingFactor, unsigned int);
121  itkGetMacro(BalancingFactor, unsigned int);
123 
124 protected:
126  void GenerateData() override;
127 
132  void ComputeMaxSampleFrequency();
133 
135  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
136  using Superclass::MakeOutput;
137 
140  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
141 
142 private:
143  ListSampleToBalancedListSampleFilter(const Self&) = delete;
144  void operator=(const Self&) = delete;
145 
147  std::vector<unsigned int> m_MultiplicativeCoefficient;
148  unsigned int m_BalancingFactor;
149 
150 }; // end of class ListSampleToBalancedListSampleFilter
151 
152 } // end of namespace Statistics
153 } // end of namespace otb
154 
155 #ifndef OTB_MANUAL_INSTANTIATION
157 #endif
158 
159 #endif
#define otbGetObjectMemberConstMacro(object, name, type)
Definition: otbMacro.h:101
itk::DataObjectDecorator< LabelSampleListType > LabelSampleListObjectType
This class generate a noised version of the input sample list.
otb::Statistics::ListSampleToListSampleFilter< TInputSampleList, TOutputSampleList > Superclass
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
This class is a base class for filters using ListSample as input and returning ListSample.
#define otbSetObjectMemberMacro(object, name, type)
Definition: otbMacro.h:80
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
otb::Statistics::GaussianAdditiveNoiseSampleListFilter< InputSampleListType, OutputSampleListType > GaussianAdditiveNoiseType
This class generate a balanced ListSample in order to have fair distribution of learning samples...