OTB  7.2.0
Orfeo Toolbox
otbPersistentImageToVectorDataFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2020 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 otbPersistentImageToVectorDataFilter_h
23 #define otbPersistentImageToVectorDataFilter_h
24 
26 #include "itkExtractImageFilter.h"
27 
29 #include "otbOGRVectorDataIO.h"
30 #include "itkMacro.h"
31 #include <string>
32 
33 namespace otb
34 {
35 
51 template <class TImage, class TOutputVectorData>
52 class ITK_EXPORT PersistentImageToVectorDataFilter : 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;
69  typedef typename InputImageType::PixelType PixelType;
70  typedef typename InputImageType::InternalPixelType InternalPixelType;
71 
72  typedef TOutputVectorData OutputVectorDataType;
73  typedef typename TOutputVectorData::Pointer OutputVectorDataPointerType;
74 
75  typedef itk::ExtractImageFilter<InputImageType, InputImageType> ExtractImageFilterType;
76  typedef typename ExtractImageFilterType::Pointer ExtractImageFilterPointerType;
77 
80 
82  typedef typename OGRVectorDataIOType::Pointer OGRVectorDataIOPointerType;
83 
85  typedef itk::DataObject::Pointer DataObjectPointer;
86 
87  OutputVectorDataType* GetOutputVectorData() const;
88 
89  void AllocateOutputs() override;
90 
91  void Reset(void) override;
92 
93  void Synthetize(void) override;
94 
96  itkSetStringMacro(FileName);
97  itkGetStringMacro(FileName);
99 
100 protected:
103  {
104  }
105 
106  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
107 
108  void GenerateData() override;
109 
110  ExtractImageFilterPointerType m_ExtractFilter;
111 
112  OutputVectorDataPointerType m_OutputVectorData;
113 
114 private:
115  PersistentImageToVectorDataFilter(const Self&) = delete;
116  void operator=(const Self&) = delete;
117 
118  virtual OutputVectorDataPointerType ProcessTile() = 0;
119 
120  OGRVectorDataIOPointerType m_VectorDataIO;
121  std::string m_FileName;
122 
123 }; // end of class
124 } // end namespace otb
125 
126 #ifndef OTB_MANUAL_INSTANTIATION
128 #endif
129 
130 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
Produces a VectorData from the concatenation of several input vectordatas.
ImageIO object for reading and writing OGR format vector data.
otb::ConcatenateVectorDataFilter< OutputVectorDataType > ConcatenateVectorDataFilterType
ConcatenateVectorDataFilterType::Pointer ConcatenateVectorDataFilterPointerType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
PersistentImageFilter< TImage, TImage > Superclass
Perform vectorization in a persistent way.
This filter is the base class for all filter persisting data through multiple update. For instance, a filter computing global statistics on an image with streaming capabilities will have to keep the temporary results for each streamed piece of the image in order to synthesize the global statistics at the end. This filter is an itk::ImageToImageFilter, providing two additional methods. The first one, Synthetize(), allows the user to synthesize temporary data produced by the multiple updates on different pieces of the image to the global result. The second one, Reset(), allows the user to reset the temporary data for a new input image for instance.
itk::ExtractImageFilter< InputImageType, InputImageType > ExtractImageFilterType