OTB  9.0.0
Orfeo Toolbox
otbLabelMapToVectorDataFilter.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 otbLabelMapToVectorDataFilter_h
22 #define otbLabelMapToVectorDataFilter_h
23 
24 #include "otbVectorDataSource.h"
25 #include "itkLabelMap.h"
29 #include "otbDataNode.h"
30 
31 #include <string>
32 #include <sstream>
33 
34 namespace otb
35 {
36 
57 template <class TLabelMap, class TVectorData, class TFieldsFunctor = Functor::LabelObjectFieldsFunctor<typename TLabelMap::LabelObjectType>>
58 class ITK_EXPORT LabelMapToVectorDataFilter : public VectorDataSource<TVectorData>
59 {
60 public:
64  typedef itk::SmartPointer<Self> Pointer;
65  typedef itk::SmartPointer<const Self> ConstPointer;
66 
68  typedef TLabelMap InputLabelMapType;
69  typedef TVectorData OutputVectorDataType;
70  typedef TFieldsFunctor FieldsFunctorType;
71 
72  typedef typename OutputVectorDataType::Pointer OutputVectorDataPointer;
73  typedef typename OutputVectorDataType::ConstPointer OutputVectorDataConstPointer;
74 
75  typedef typename InputLabelMapType::LabelObjectType LabelObjectType;
76 
77  typedef typename InputLabelMapType::ConstIterator ConstIteratorType;
78  typedef typename OutputVectorDataType::DataNodeType DataNodeType;
79  typedef typename DataNodeType::Pointer DataNodePointerType;
80  typedef typename DataNodeType::PolygonType PolygonType;
81  typedef typename PolygonType::Pointer PolygonPointerType;
82 
86 
88  itkNewMacro(Self);
89 
92 
94  using Superclass::SetInput;
95  virtual void SetInput(const InputLabelMapType* input);
96  virtual void SetInput(unsigned int idx, const InputLabelMapType* input);
97  const InputLabelMapType* GetInput(void);
98  const InputLabelMapType* GetInput(unsigned int idx);
100 
101  /* Set the functor used to provide additional OGR fields */
102  void SetFieldsFunctor(const FieldsFunctorType& functor)
103  {
104  m_FieldsFunctor = functor;
105  this->Modified();
106  }
107 
108  /* Get the functor used to provide additional OGR fields */
110  {
111  return m_FieldsFunctor;
112  }
113 
114 protected:
117  {
118  }
119  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
120  void GenerateData() override;
121 
122 private:
123  LabelMapToVectorDataFilter(const Self&) = delete;
124  void operator=(const Self&) = delete;
125 
127 }; // end of class
128 
129 } // end namespace itk
130 
131 #ifndef OTB_MANUAL_INSTANTIATION
133 #endif
134 
135 #endif
otb::LabelMapToVectorDataFilter::CorrectFunctorType
otb::CorrectPolygonFunctor< PolygonType > CorrectFunctorType
Definition: otbLabelMapToVectorDataFilter.h:85
otb::LabelMapToVectorDataFilter::DataNodeType
OutputVectorDataType::DataNodeType DataNodeType
Definition: otbLabelMapToVectorDataFilter.h:78
otb::LabelMapToVectorDataFilter
This class vectorizes a LabelObject to a VectorData.
Definition: otbLabelMapToVectorDataFilter.h:58
otb::Functor::LabelObjectToPolygonFunctor
This class vectorizes a LabelObject to a Polygon.
Definition: otbLabelObjectToPolygonFunctor.h:62
otb::LabelMapToVectorDataFilter::OutputVectorDataType
TVectorData OutputVectorDataType
Definition: otbLabelMapToVectorDataFilter.h:69
otb::LabelMapToVectorDataFilter::LabelObjectType
InputLabelMapType::LabelObjectType LabelObjectType
Definition: otbLabelMapToVectorDataFilter.h:75
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelMapToVectorDataFilter::~LabelMapToVectorDataFilter
~LabelMapToVectorDataFilter() override
Definition: otbLabelMapToVectorDataFilter.h:116
otb::LabelMapToVectorDataFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLabelMapToVectorDataFilter.h:65
otb::LabelMapToVectorDataFilter::PolygonType
DataNodeType::PolygonType PolygonType
Definition: otbLabelMapToVectorDataFilter.h:80
otb::LabelMapToVectorDataFilter::PolygonPointerType
PolygonType::Pointer PolygonPointerType
Definition: otbLabelMapToVectorDataFilter.h:81
otb::LabelMapToVectorDataFilter::m_FieldsFunctor
FieldsFunctorType m_FieldsFunctor
Definition: otbLabelMapToVectorDataFilter.h:126
otb::LabelMapToVectorDataFilter::FunctorType
otb::Functor::LabelObjectToPolygonFunctor< LabelObjectType, PolygonType > FunctorType
Definition: otbLabelMapToVectorDataFilter.h:84
otbLabelMapToVectorDataFilter.hxx
otb::LabelMapToVectorDataFilter::OutputVectorDataPointer
OutputVectorDataType::Pointer OutputVectorDataPointer
Definition: otbLabelMapToVectorDataFilter.h:72
otb::LabelMapToVectorDataFilter::DataNodePointerType
DataNodeType::Pointer DataNodePointerType
Definition: otbLabelMapToVectorDataFilter.h:79
otbVectorDataSource.h
otb::CorrectPolygonFunctor
This filter simplify and close the input polygon, making the last point equal to the first one.
Definition: otbCorrectPolygonFunctor.h:42
otb::LabelMapToVectorDataFilter::OutputVectorDataConstPointer
OutputVectorDataType::ConstPointer OutputVectorDataConstPointer
Definition: otbLabelMapToVectorDataFilter.h:73
otbLabelObjectToPolygonFunctor.h
otbLabelObjectFieldsFunctor.h
otbDataNode.h
otb::LabelMapToVectorDataFilter::InputLabelMapType
TLabelMap InputLabelMapType
Definition: otbLabelMapToVectorDataFilter.h:68
otbCorrectPolygonFunctor.h
otb::LabelMapToVectorDataFilter::Superclass
VectorDataSource< TVectorData > Superclass
Definition: otbLabelMapToVectorDataFilter.h:63
otb::LabelMapToVectorDataFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLabelMapToVectorDataFilter.h:64
otb::LabelMapToVectorDataFilter::ConstIteratorType
InputLabelMapType::ConstIterator ConstIteratorType
Definition: otbLabelMapToVectorDataFilter.h:77
otb::VectorDataSource
Filter hierarchy for generating VectorData.
Definition: otbVectorDataSource.h:42
otb::LabelMapToVectorDataFilter::GetFieldsFunctor
FieldsFunctorType & GetFieldsFunctor()
Definition: otbLabelMapToVectorDataFilter.h:109
otb::LabelMapToVectorDataFilter::FieldsFunctorType
TFieldsFunctor FieldsFunctorType
Definition: otbLabelMapToVectorDataFilter.h:70
otb::LabelMapToVectorDataFilter::Self
LabelMapToVectorDataFilter Self
Definition: otbLabelMapToVectorDataFilter.h:62
otb::LabelMapToVectorDataFilter::SetFieldsFunctor
void SetFieldsFunctor(const FieldsFunctorType &functor)
Definition: otbLabelMapToVectorDataFilter.h:102