OTB  10.0.0
Orfeo Toolbox
otbLabelMapWithClassLabelToLabeledSampleListFilter.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 otbLabelMapWithClassLabelToLabeledSampleListFilter_h
22 #define otbLabelMapWithClassLabelToLabeledSampleListFilter_h
23 
25 
26 namespace otb
27 {
42 template <class TInputLabelMap, class TOutputSampleList, class TOutputTrainingSampleList,
43  class TMeasurementFunctor =
44  Functor::AttributesMapMeasurementFunctor<typename TInputLabelMap::LabelObjectType, typename TOutputSampleList::MeasurementVectorType>>
45 class ITK_EXPORT LabelMapWithClassLabelToLabeledSampleListFilter : public LabelMapToSampleListFilter<TInputLabelMap, TOutputSampleList, TMeasurementFunctor>
46 {
47 public:
51  typedef itk::SmartPointer<Self> Pointer;
52  typedef itk::SmartPointer<const Self> ConstPointer;
53 
55  itkNewMacro(Self);
56 
59 
61  typedef TInputLabelMap InputLabelMapType;
62  typedef typename InputLabelMapType::ConstPointer InputLabelMapConstPointerType;
63  typedef typename InputLabelMapType::LabelObjectType LabelObjectType;
64  typedef typename InputLabelMapType::ConstIterator ConstIteratorType;
65  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
66 
68  typedef TOutputSampleList OutputSampleListType;
69  typedef typename OutputSampleListType::Pointer OutputSampleListPointerType;
70  typedef typename OutputSampleListType::MeasurementVectorType MeasurementVectorType;
71 
73  typedef TOutputTrainingSampleList OutputTrainingSampleListType;
74  typedef typename OutputTrainingSampleListType::Pointer OutputTrainingSampleListPointerType;
75  typedef typename OutputTrainingSampleListType::MeasurementVectorType TraningVectorType;
76 
78  typedef TMeasurementFunctor MeasurementFunctorType;
79 
80  // DataObject type definition from superclass
82 
83  // Get the output training ListSample
84  const OutputTrainingSampleListType* GetOutputTrainingSampleList();
85 
86  // Get a hook on the functor for settings
88  {
89  m_MeasurementFunctor = functor;
90  }
91 
93  {
94  return m_MeasurementFunctor;
95  }
96 
97 protected:
100 
101  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
102 
103  void GenerateData() override;
104 
106  DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) override;
107  using Superclass::MakeOutput;
108 
109 private:
111  void operator=(const Self&) = delete;
112 
115 };
116 
117 } // end namespace otb
118 
119 #ifndef OTB_MANUAL_INSTANTIATION
121 #endif
122 
123 #endif
This class converts a LabelObjectMap to a SampleList for learning and classification.
Superclass::DataObjectPointer DataObjectPointerType
This class converts a LabelObjectMap with some class labeled objects to a SampleList and a TrainingSa...
LabelMapWithClassLabelToLabeledSampleListFilter(const Self &)=delete
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
LabelMapToSampleListFilter< TInputLabelMap, TOutputSampleList, TMeasurementFunctor > Superclass
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.