OTB  9.0.0
Orfeo Toolbox
otbPersistentImageToOGRDataFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbPersistentImageToOGRDataFilter_h
23 #define otbPersistentImageToOGRDataFilter_h
24 
26 
28 
29 #include "itkMacro.h"
30 #include <string>
31 
32 namespace otb
33 {
34 
51 template <class TImage>
52 class ITK_EXPORT PersistentImageToOGRDataFilter : public PersistentImageFilter<TImage, TImage>
53 {
54 public:
58  typedef itk::SmartPointer<Self> Pointer;
59  typedef itk::SmartPointer<const Self> ConstPointer;
60 
63 
64  typedef TImage InputImageType;
65  typedef typename InputImageType::Pointer InputImagePointer;
66  typedef typename InputImageType::RegionType RegionType;
67  typedef typename InputImageType::SizeType SizeType;
68  typedef typename InputImageType::IndexType IndexType;
69  typedef typename InputImageType::PixelType PixelType;
70  typedef typename InputImageType::InternalPixelType InternalPixelType;
71 
76 
77 
78  void AllocateOutputs();
79  virtual void Reset(void);
80  virtual void Synthetize(void);
81 
86  virtual void Initialize(void);
87 
89  itkSetStringMacro(LayerName);
90  itkGetStringMacro(LayerName);
92 
96  itkSetMacro(FieldName, std::string);
97 
101  itkGetMacro(FieldName, std::string);
102 
107  itkGetMacro(StreamSize, SizeType);
108 
110  itkSetMacro(GeometryType, OGRwkbGeometryType);
111 
113  itkGetMacro(GeometryType, OGRwkbGeometryType);
114 
116  void SetOGRDataSource(OGRDataSourcePointerType ogrDS);
117 
119  OGRDataSourceType* GetOGRDataSource(void);
120 
122  void AddOGRLayerCreationOption(const std::string& option);
123 
125  void ClearOGRLayerCreationOptions();
126 
128  void SetOGRLayerCreationOptions(const std::vector<std::string>& options);
129 
131  const std::vector<std::string>& GetOGRLayerCreationOptions(void);
132 
134  itkSetMacro(FieldType, OGRFieldType);
135 
137  itkGetMacro(FieldType, OGRFieldType);
138 
139 protected:
142 
143  void PrintSelf(std::ostream& os, itk::Indent indent) const;
144 
145  virtual void GenerateData();
146 
147 
148 private:
149  PersistentImageToOGRDataFilter(const Self&) = delete;
150  void operator=(const Self&) = delete;
151 
152  virtual OGRDataSourcePointerType ProcessTile() = 0;
153 
154  std::string m_FieldName;
155  std::string m_LayerName;
156  OGRwkbGeometryType m_GeometryType;
157  SizeType m_StreamSize{0,0};
158  std::vector<std::string> m_OGRLayerCreationOptions;
159  OGRFieldType m_FieldType;
160 
161 }; // end of class
162 } // end namespace otb
163 
164 #ifndef OTB_MANUAL_INSTANTIATION
166 #endif
167 
168 #endif
otb::PersistentImageToOGRDataFilter::PixelType
InputImageType::PixelType PixelType
Definition: otbPersistentImageToOGRDataFilter.h:69
otb::PersistentImageToOGRDataFilter::OGRLayerType
ogr::Layer OGRLayerType
Definition: otbPersistentImageToOGRDataFilter.h:74
otbPersistentImageFilter.h
otb::PersistentImageFilter
This filter is the base class for all filter persisting data through multiple update....
Definition: otbPersistentImageFilter.h:47
otbPersistentImageToOGRDataFilter.hxx
otb::PersistentImageToOGRDataFilter::Superclass
PersistentImageFilter< TImage, TImage > Superclass
Definition: otbPersistentImageToOGRDataFilter.h:57
otb::PersistentImageToOGRDataFilter::Self
PersistentImageToOGRDataFilter Self
Definition: otbPersistentImageToOGRDataFilter.h:56
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ogr::DataSource
Collection of geometric objects.
Definition: otbOGRDataSourceWrapper.h:83
otb::PersistentImageToOGRDataFilter::m_OGRLayerCreationOptions
std::vector< std::string > m_OGRLayerCreationOptions
Definition: otbPersistentImageToOGRDataFilter.h:158
otb::PersistentImageToOGRDataFilter::OGRFeatureType
ogr::Feature OGRFeatureType
Definition: otbPersistentImageToOGRDataFilter.h:75
otb::PersistentImageToOGRDataFilter::RegionType
InputImageType::RegionType RegionType
Definition: otbPersistentImageToOGRDataFilter.h:66
otb::PersistentImageToOGRDataFilter
Perform vectorization in a persistent way.
Definition: otbPersistentImageToOGRDataFilter.h:52
otb::PersistentImageToOGRDataFilter::InputImagePointer
InputImageType::Pointer InputImagePointer
Definition: otbPersistentImageToOGRDataFilter.h:65
otb::PersistentImageToOGRDataFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbPersistentImageToOGRDataFilter.h:58
otb::PersistentImageToOGRDataFilter::m_LayerName
std::string m_LayerName
Definition: otbPersistentImageToOGRDataFilter.h:155
otb::PersistentImageToOGRDataFilter::OGRDataSourceType
ogr::DataSource OGRDataSourceType
Definition: otbPersistentImageToOGRDataFilter.h:72
otbLabelImageToOGRDataSourceFilter.h
otb::PersistentImageToOGRDataFilter::m_FieldName
std::string m_FieldName
Definition: otbPersistentImageToOGRDataFilter.h:154
otb::ogr::DataSource::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbOGRDataSourceWrapper.h:90
otb::PersistentImageToOGRDataFilter::SizeType
InputImageType::SizeType SizeType
Definition: otbPersistentImageToOGRDataFilter.h:67
otb::PersistentImageToOGRDataFilter::IndexType
InputImageType::IndexType IndexType
Definition: otbPersistentImageToOGRDataFilter.h:68
otb::PersistentImageToOGRDataFilter::InputImageType
TImage InputImageType
Definition: otbPersistentImageToOGRDataFilter.h:62
otb::ogr::Feature
Geometric object with descriptive fields.
Definition: otbOGRFeatureWrapper.h:63
otb::ogr::Layer
Layer of geometric objects.
Definition: otbOGRLayerWrapper.h:80
otb::PersistentImageToOGRDataFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbPersistentImageToOGRDataFilter.h:59
otb::PersistentImageToOGRDataFilter::m_FieldType
OGRFieldType m_FieldType
Definition: otbPersistentImageToOGRDataFilter.h:159
otb::PersistentImageToOGRDataFilter::InternalPixelType
InputImageType::InternalPixelType InternalPixelType
Definition: otbPersistentImageToOGRDataFilter.h:70
otb::PersistentImageToOGRDataFilter::OGRDataSourcePointerType
OGRDataSourceType::Pointer OGRDataSourcePointerType
Definition: otbPersistentImageToOGRDataFilter.h:73
otb::PersistentImageToOGRDataFilter::m_GeometryType
OGRwkbGeometryType m_GeometryType
Definition: otbPersistentImageToOGRDataFilter.h:156