OTB  6.7.0
Orfeo Toolbox
otbLabelMapWithClassLabelToLabeledSampleListFilter.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 otbLabelMapWithClassLabelToLabeledSampleListFilter_h
22 #define otbLabelMapWithClassLabelToLabeledSampleListFilter_h
23 
25 
26 namespace otb
27 {
42 template <class TInputLabelMap, class TOutputSampleList, class TOutputTrainingSampleList,
43  class TMeasurementFunctor = Functor::AttributesMapMeasurementFunctor
44  <typename TInputLabelMap::LabelObjectType, typename TOutputSampleList::MeasurementVectorType > >
46  public LabelMapToSampleListFilter<TInputLabelMap, TOutputSampleList,TMeasurementFunctor>
47 {
48 public:
52  <TInputLabelMap, TOutputSampleList,TMeasurementFunctor> Superclass;
55 
57  itkNewMacro(Self);
58 
61 
63  typedef TInputLabelMap InputLabelMapType;
64  typedef typename InputLabelMapType::ConstPointer InputLabelMapConstPointerType;
65  typedef typename InputLabelMapType::LabelObjectType LabelObjectType;
66  typedef typename InputLabelMapType::ConstIterator ConstIteratorType;
68 
70  typedef TOutputSampleList OutputSampleListType;
71  typedef typename OutputSampleListType::Pointer OutputSampleListPointerType;
72  typedef typename OutputSampleListType
73  ::MeasurementVectorType MeasurementVectorType;
74 
76  typedef TOutputTrainingSampleList OutputTrainingSampleListType;
77  typedef typename OutputTrainingSampleListType::Pointer OutputTrainingSampleListPointerType;
78  typedef typename OutputTrainingSampleListType
79  ::MeasurementVectorType TraningVectorType;
80 
82  typedef TMeasurementFunctor MeasurementFunctorType;
83 
84  // DataObject type definition from superclass
85  typedef typename Superclass::DataObjectPointerType DataObjectPointerType;
86 
87  // Get the output training ListSample
88  const OutputTrainingSampleListType* GetOutputTrainingSampleList();
89 
90  // Get a hook on the functor for settings
92  {
93  m_MeasurementFunctor = functor;
94  }
95 
97  {
98  return m_MeasurementFunctor;
99  }
100 
101 protected:
104 
105  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
106 
107  void GenerateData() override;
108 
110  DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) override;
111  using Superclass::MakeOutput;
112 
113 private:
115  void operator=(const Self&) = delete;
116 
119 };
120 
121 } // end namespace otb
122 
123 #ifndef OTB_MANUAL_INSTANTIATION
125 #endif
126 
127 #endif
LabelMapToSampleListFilter< TInputLabelMap, TOutputSampleList, TMeasurementFunctor > Superclass
This class converts a LabelObjectMap to a SampleList for learning and classification.
This class converts a LabelObjectMap with some class labeled objets to a SampleList and a TrainingSam...
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType