Orfeo ToolBox  4.2
Orfeo ToolBox is not a black box
otbLabelMapToVectorDataFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbLabelMapToVectorDataFilter_h
19 #define __otbLabelMapToVectorDataFilter_h
20 
21 #include "otbVectorDataSource.h"
22 #include "itkLabelMap.h"
26 #include "otbDataNode.h"
27 
28 #include <string>
29 #include <sstream>
30 
31 namespace otb {
32 
51 template<class TLabelMap, class TVectorData,
52  class TFieldsFunctor = Functor::LabelObjectFieldsFunctor<typename TLabelMap::LabelObjectType> >
53 class ITK_EXPORT LabelMapToVectorDataFilter :
54  public VectorDataSource<TVectorData>
55 {
56 public:
63 
65  typedef TLabelMap InputLabelMapType;
66  typedef TVectorData OutputVectorDataType;
67  typedef TFieldsFunctor FieldsFunctorType;
68 
69  typedef typename OutputVectorDataType::Pointer OutputVectorDataPointer;
70  typedef typename OutputVectorDataType::ConstPointer OutputVectorDataConstPointer;
71 
72  typedef typename InputLabelMapType::LabelObjectType LabelObjectType;
73 
74  typedef typename InputLabelMapType::ConstIterator ConstIteratorType;
75  typedef typename OutputVectorDataType::DataNodeType DataNodeType;
76  typedef typename DataNodeType::Pointer DataNodePointerType;
77  typedef typename DataNodeType::PolygonType PolygonType;
78  typedef typename PolygonType::Pointer PolygonPointerType;
79 
83 
85  itkNewMacro(Self);
86 
88  itkTypeMacro(LabelMapToVectorDataFilter,
90 
92  virtual void SetInput(const InputLabelMapType *input);
93  virtual void SetInput(unsigned int idx, const InputLabelMapType *input);
94  const InputLabelMapType * GetInput(void);
95  const InputLabelMapType * GetInput(unsigned int idx);
96 
97  /* Set the functor used to provide additionnal OGR fields */
98  void SetFieldsFunctor(const FieldsFunctorType& functor)
99  {
100  m_FieldsFunctor = functor;
101  this->Modified();
102  }
103 
104  /* Get the functor used to provide additionnal OGR fields */
106  {
107  return m_FieldsFunctor;
108  }
109 
110 protected:
113  void PrintSelf(std::ostream& os, itk::Indent indent) const;
114  void GenerateData();
115 
116 private:
117  LabelMapToVectorDataFilter(const Self &); //purposely not implemented
118  void operator =(const Self&); //purposely not implemented
119 
121 }; // end of class
122 
123 } // end namespace itk
124 
125 #ifndef OTB_MANUAL_INSTANTIATION
127 #endif
128 
129 #endif
OutputVectorDataType::Pointer OutputVectorDataPointer
This class vectorizes a LabelObject to a Polygon.
This class vectorizes a LabelObject to a VectorData.
Filter hierarchy for generating VectorData.
itk::SmartPointer< const Self > ConstPointer
otb::Functor::LabelObjectToPolygonFunctor< LabelObjectType, PolygonType > FunctorType
InputLabelMapType::LabelObjectType LabelObjectType
VectorDataSource< TVectorData > Superclass
OutputVectorDataType::ConstPointer OutputVectorDataConstPointer
This filter simplify and close the input polygon, making the last point equal to the first one...
OutputVectorDataType::DataNodeType DataNodeType
InputLabelMapType::ConstIterator ConstIteratorType
void SetFieldsFunctor(const FieldsFunctorType &functor)
otb::CorrectPolygonFunctor< PolygonType > CorrectFunctorType