OTB  5.0.0
Orfeo Toolbox
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 
53 template<class TLabelMap, class TVectorData,
54  class TFieldsFunctor = Functor::LabelObjectFieldsFunctor<typename TLabelMap::LabelObjectType> >
55 class ITK_EXPORT LabelMapToVectorDataFilter :
56  public VectorDataSource<TVectorData>
57 {
58 public:
65 
67  typedef TLabelMap InputLabelMapType;
68  typedef TVectorData OutputVectorDataType;
69  typedef TFieldsFunctor FieldsFunctorType;
70 
71  typedef typename OutputVectorDataType::Pointer OutputVectorDataPointer;
72  typedef typename OutputVectorDataType::ConstPointer OutputVectorDataConstPointer;
73 
74  typedef typename InputLabelMapType::LabelObjectType LabelObjectType;
75 
76  typedef typename InputLabelMapType::ConstIterator ConstIteratorType;
77  typedef typename OutputVectorDataType::DataNodeType DataNodeType;
78  typedef typename DataNodeType::Pointer DataNodePointerType;
79  typedef typename DataNodeType::PolygonType PolygonType;
80  typedef typename PolygonType::Pointer PolygonPointerType;
81 
85 
87  itkNewMacro(Self);
88 
90  itkTypeMacro(LabelMapToVectorDataFilter,
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 additionnal 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 additionnal OGR fields */
110  {
111  return m_FieldsFunctor;
112  }
113 
114 protected:
117  void PrintSelf(std::ostream& os, itk::Indent indent) const;
118  void GenerateData();
119 
120 private:
121  LabelMapToVectorDataFilter(const Self &); //purposely not implemented
122  void operator =(const Self&); //purposely not implemented
123 
125 }; // end of class
126 
127 } // end namespace itk
128 
129 #ifndef OTB_MANUAL_INSTANTIATION
131 #endif
132 
133 #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