OTB  5.0.0
Orfeo Toolbox
otbVectorDataToLabelMapFilter.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 
19 #ifndef __otbVectorDataToLabelMapFilter_h
20 #define __otbVectorDataToLabelMapFilter_h
21 
22 #include "itkLabelObject.h"
23 #include "itkProgressReporter.h"
24 #include "itkBarrier.h"
25 #include "itkConceptChecking.h"
26 #include "itkContinuousIndex.h"
27 //#include "itkDataObject.h"
28 
29 #include "otbLabelMapSource.h"
30 #include "otbVectorData.h"
32 
33 #include <vector>
34 #include <map>
35 
36 // #include "itkImageToImageFilter.h"
37 
38 namespace otb
39 {
40 
54 template <class TVectorData, class TLabelMap>
55 class ITK_EXPORT VectorDataToLabelMapFilter :
56  public LabelMapSource <TLabelMap>
57 
58 {
59 public:
65 
67  typedef TVectorData InputVectorDataType;
68  typedef TLabelMap OutputLabelMapType;
69  typedef typename InputVectorDataType::Pointer InputVectorDataPointer;
70  typedef typename InputVectorDataType::ConstPointer InputVectorDataConstPointer;
71 
72  typedef typename OutputLabelMapType::Pointer OutputLabelMapPointer;
73  typedef typename OutputLabelMapType::ConstPointer OutputLabelMapConstPointer;
74 
75  typedef typename InputVectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType;
76  typedef typename InternalTreeNodeType::ChildrenListType ChildrenListType;
77  typedef typename InputVectorDataType::DataNodeType DataNodeType;
78  typedef typename DataNodeType::Pointer DataNodePointerType;
79  typedef typename DataNodeType::PolygonType PolygonType;
80  typedef typename PolygonType::Pointer PolygonPointerType;
81  typedef typename OutputLabelMapType::LabelType LabelType;
82 
83  typedef typename OutputLabelMapType::IndexType IndexType;
84  typedef typename OutputLabelMapType::PixelType OutputLabelMapPixelType;
85  typedef typename OutputLabelMapType::PointType OriginType;
86  typedef typename OutputLabelMapType::SpacingType SpacingType;
87  typedef typename OutputLabelMapType::DirectionType DirectionType;
88 
91 
93  itkStaticConstMacro(VectorDataDimension, unsigned int,
94  TVectorData::Dimension);
95 
98 
99  typedef typename InputVectorDataType::PointType PointType;
100 
106 
108 // itkSetMacro( Size, SizeType );
109 
111 // itkSetMacro( StartIndex, IndexType );
112 
116  itkTypeMacro(VectorDataToLabelMapFilter, ImageToImageFilter);
117 
121  itkNewMacro(Self);
122 
127  itkSetMacro(BackgroundValue, OutputLabelMapPixelType);
128  itkGetConstMacro(BackgroundValue, OutputLabelMapPixelType);
130 
132  itkSetMacro(Size, SizeType);
133 
135  itkGetConstReferenceMacro(Size, SizeType);
136 
139  itkSetMacro(Origin, OriginType);
140  virtual void SetOrigin(const double origin[2]);
141  virtual void SetOrigin(const float origin[2]);
143 
144  itkGetConstReferenceMacro(Origin, OriginType);
145 
147  itkGetConstReferenceMacro(StartIndex, IndexType);
148  itkSetMacro(StartIndex, IndexType);
149 
152  virtual void SetSpacing(const SpacingType& spacing);
153  virtual void SetSpacing(const double spacing[2]);
154  virtual void SetSpacing(const float spacing[2]);
156 
157  itkGetConstReferenceMacro(Spacing, SpacingType);
158 
160  using Superclass::SetInput;
161  virtual void SetInput(const InputVectorDataType *input);
162  virtual void SetInput(unsigned int idx, const InputVectorDataType *input);
163  const InputVectorDataType * GetInput(void);
164  const InputVectorDataType * GetInput(unsigned int idx);
166 
167  virtual void GenerateOutputInformation();
168 
169 protected:
172  void PrintSelf(std::ostream& os, itk::Indent indent) const;
173 
178  virtual void GenerateData();
179 
183 // void GenerateInputRequestedRegion();
184 
189 // void EnlargeOutputRequestedRegion(itk::DataObject *itkNotUsed(output));
190 
191 private:
192  VectorDataToLabelMapFilter(const Self &); //purposely not implemented
193  void operator =(const Self&); //purposely not implemented
194 
195  void ProcessNode(InternalTreeNodeType * source);
196 
199 
200  //TODO donc need this attribute now compute with VectorDataProperties
206 
209 };
210 
211 } // end namespace itk
212 
213 #ifndef OTB_MANUAL_INSTANTIATION
215 #endif
216 
217 #endif
OutputLabelMapType::Pointer OutputLabelMapPointer
OutputLabelMapType::LabelType LabelType
itk::Size< itkGetStaticConstMacro(VectorDataDimension)> SizeType
Convert a vector data and produce a collection of label objects for each node.
InputVectorDataType::ConstPointer InputVectorDataConstPointer
InputVectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType
InputVectorDataType::Pointer InputVectorDataPointer
InputVectorDataType::PointType PointType
OutputLabelMapType::DirectionType DirectionType
itk::SmartPointer< const Self > ConstPointer
InputVectorDataType::DataNodeType DataNodeType
otb::CorrectPolygonFunctor< PolygonType > CorrectFunctorType
Base class for filter that output LabelMap.
This filter simplify and close the input polygon, making the last point equal to the first one...
OutputLabelMapType::IndexType IndexType
InternalTreeNodeType::ChildrenListType ChildrenListType
OutputLabelMapType::ConstPointer OutputLabelMapConstPointer
OutputLabelMapType::PixelType OutputLabelMapPixelType
OutputLabelMapType::PointType OriginType
OutputLabelMapType::SpacingType SpacingType