OTB  9.0.0
Orfeo Toolbox
otbLabelMapToSampleListFilter.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 otbLabelMapToSampleListFilter_h
22 #define otbLabelMapToSampleListFilter_h
23 
24 #include <algorithm>
25 
26 #include "itkProcessObject.h"
28 
29 namespace otb
30 {
43 template <class TInputLabelMap, class TOutputSampleList,
44  class TMeasurementFunctor =
45  Functor::AttributesMapMeasurementFunctor<typename TInputLabelMap::LabelObjectType, typename TOutputSampleList::MeasurementVectorType>>
46 class ITK_EXPORT LabelMapToSampleListFilter : public itk::ProcessObject
47 {
48 public:
51  typedef itk::ProcessObject Superclass;
52  typedef itk::SmartPointer<Self> Pointer;
53  typedef itk::SmartPointer<const Self> ConstPointer;
54 
56  itkNewMacro(Self);
57 
59  itkTypeMacro(LabelMapToSampleListFilter, ProcessObject);
60 
62  typedef TInputLabelMap InputLabelMapType;
63  typedef typename InputLabelMapType::ConstPointer InputLabelMapConstPointerType;
64  typedef typename InputLabelMapType::LabelObjectType LabelObjectType;
65 
66  typedef typename InputLabelMapType::ConstIterator ConstIteratorType;
67 
68  typedef TOutputSampleList OutputSampleListType;
69  typedef typename OutputSampleListType::Pointer OutputSampleListPointerType;
70  typedef typename OutputSampleListType::MeasurementVectorType MeasurementVectorType;
71 
72  typedef TMeasurementFunctor MeasurementFunctorType;
73 
75  typedef typename Superclass::DataObjectPointer DataObjectPointerType;
76  typedef itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
77 
79  void SetInputLabelMap(const InputLabelMapType* inputLabelMap);
80  const InputLabelMapType* GetInputLabelMap() const;
82 
84  const OutputSampleListType* GetOutputSampleList();
85 
88  {
89  m_MeasurementFunctor = functor;
90  }
91 
93  {
94  return m_MeasurementFunctor;
95  }
96 
97 protected:
99  ~LabelMapToSampleListFilter() override;
100 
101  void GenerateData() override;
102 
104  DataObjectPointerType MakeOutput(DataObjectPointerArraySizeType idx) override;
105  using Superclass::MakeOutput;
106 
107  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
108 
109 private:
110  LabelMapToSampleListFilter(const Self&) = delete;
111  void operator=(const Self&) = delete;
112 
115 };
116 
117 } // end namespace otb
118 
119 #ifndef OTB_MANUAL_INSTANTIATION
121 #endif
122 
123 #endif
otbAttributesMapLabelObject.h
otb::LabelMapToSampleListFilter::ConstIteratorType
InputLabelMapType::ConstIterator ConstIteratorType
Definition: otbLabelMapToSampleListFilter.h:66
otb::LabelMapToSampleListFilter::DataObjectPointerArraySizeType
itk::ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Definition: otbLabelMapToSampleListFilter.h:76
otbLabelMapToSampleListFilter.hxx
otb::LabelMapToSampleListFilter
This class converts a LabelObjectMap to a SampleList for learning and classification.
Definition: otbLabelMapToSampleListFilter.h:46
otb::LabelMapToSampleListFilter::OutputSampleListType
TOutputSampleList OutputSampleListType
Definition: otbLabelMapToSampleListFilter.h:68
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelMapToSampleListFilter::DataObjectPointerType
Superclass::DataObjectPointer DataObjectPointerType
Definition: otbLabelMapToSampleListFilter.h:75
otb::LabelMapToSampleListFilter::MeasurementVectorType
OutputSampleListType::MeasurementVectorType MeasurementVectorType
Definition: otbLabelMapToSampleListFilter.h:70
otb::Functor::AttributesMapMeasurementFunctor< typename TInputLabelMap::LabelObjectType, typename TOutputSampleList::MeasurementVectorType >
otb::LabelMapToSampleListFilter::m_MeasurementFunctor
MeasurementFunctorType m_MeasurementFunctor
Definition: otbLabelMapToSampleListFilter.h:114
otb::LabelMapToSampleListFilter::OutputSampleListPointerType
OutputSampleListType::Pointer OutputSampleListPointerType
Definition: otbLabelMapToSampleListFilter.h:69
otb::LabelMapToSampleListFilter::SetMeasurementFunctor
void SetMeasurementFunctor(const MeasurementFunctorType &functor)
Definition: otbLabelMapToSampleListFilter.h:87
otb::LabelMapToSampleListFilter::InputLabelMapType
TInputLabelMap InputLabelMapType
Definition: otbLabelMapToSampleListFilter.h:59
otb::LabelMapToSampleListFilter::LabelObjectType
InputLabelMapType::LabelObjectType LabelObjectType
Definition: otbLabelMapToSampleListFilter.h:64
otb::LabelMapToSampleListFilter::Superclass
itk::ProcessObject Superclass
Definition: otbLabelMapToSampleListFilter.h:51
otb::LabelMapToSampleListFilter::MeasurementFunctorType
TMeasurementFunctor MeasurementFunctorType
Definition: otbLabelMapToSampleListFilter.h:72
otb::LabelMapToSampleListFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLabelMapToSampleListFilter.h:53
otb::LabelMapToSampleListFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLabelMapToSampleListFilter.h:52
otb::LabelMapToSampleListFilter::InputLabelMapConstPointerType
InputLabelMapType::ConstPointer InputLabelMapConstPointerType
Definition: otbLabelMapToSampleListFilter.h:63
otb::LabelMapToSampleListFilter::Self
LabelMapToSampleListFilter Self
Definition: otbLabelMapToSampleListFilter.h:50
otb::LabelMapToSampleListFilter::GetMeasurementFunctor
MeasurementFunctorType & GetMeasurementFunctor()
Definition: otbLabelMapToSampleListFilter.h:92