OTB  6.7.0
Orfeo Toolbox
otbMapFileProductWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbMapFileProductWriter_h
22 #define otbMapFileProductWriter_h
23 
24 
25 #include "itkObjectFactory.h"
26 
27 // Image Tiling
29 #include "otbImageFileWriter.h"
32 
33 // sahpe index necessary includes
34 #include "otbVectorData.h"
36 
37 // projection filter
39 #include <string>
40 
41 namespace otb
42 {
43 
69 template <class TInputImage>
70 class ITK_EXPORT MapFileProductWriter : public itk::ProcessObject
71 {
72 public:
78 
80  itkNewMacro(Self);
81 
84 
86  typedef TInputImage InputImageType;
87  typedef typename InputImageType::InternalPixelType InternalPixelType;
90  typedef typename InputImageType::Pointer InputImagePointer;
91  typedef typename InputImageType::RegionType InputImageRegionType;
92  typedef typename InputImageType::PixelType InputImagePixelType;
93 
94  typedef unsigned char OutputPixelType;
96 
101 
103 
104 
106  typedef MultiChannelExtractROI
108 
109  // Writer
111 
112  // Resampler
115 
116  // Intensity Rescale
119 
120  // Project filter
123 
124  // Transformer
128 
130  itkStaticConstMacro(InputImageDimension, unsigned int,
131  InputImageType::ImageDimension);
132 
133  using Superclass::SetInput;
134  virtual void SetInput( const InputImageType *image);
135  virtual void SetInput( unsigned int, const TInputImage * image);
136  const InputImageType * GetInput(void);
137  const InputImageType * GetInput(unsigned int idx);
138 
140  itkSetStringMacro(FileName);
141  itkGetStringMacro(FileName);
143 
145  itkSetMacro(TileSize, unsigned int);
146  itkGetMacro(TileSize, unsigned int);
148 
150  itkSetStringMacro(CGIPath);
151  itkGetStringMacro(CGIPath);
153 
155  itkSetStringMacro(ShapeIndexPath);
156  itkGetStringMacro(ShapeIndexPath);
158 
160  void Update() override
161  {
162  this->Write();
163  }
164 
166  itkSetMacro(SRID, int);
167 
168 protected:
170  ~MapFileProductWriter() override;
171  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
172 
174  virtual void Tiling();
175 
177  virtual void Write();
178 
179 private:
180  MapFileProductWriter(const Self &) = delete;
181  void operator =(const Self&) = delete;
182 
184  virtual void Initialize();
185 
187  virtual void AddBBoxToIndexTile(OutputPointType lowerLeftCorner,
188  OutputPointType lowerRightCorner,
189  OutputPointType upperRightCorner,
190  OutputPointType upperLeftCorner,
191  unsigned int x, unsigned int y);
192 
194  virtual void GenerateMapFile();
195 
197  void AddLayer();
198 
200  void InitializeVectorData();
201 
204 
205  // Extract ROI
207 
208  // Writer
210 
211  // Resampler
213 
214  // Rescale intensity
216 
217  // Transformer
219 
220  // VectorData Pointer Type for tileindex shapefile
224 
225  // Projection Filter
227 
228  // Tile size
229  unsigned int m_TileSize;
230  unsigned int m_CurrentDepth;
231 
232  // File and path name
233  std::string m_FileName;
234  std::string m_IndexShapeFileName;
235  std::string m_CGIPath;
236  std::string m_ShapeIndexPath;
237 
238  std::ofstream m_File;
239  int m_SRID;
240 
241 };
242 
243 } // end namespace otb
244 
245 #ifndef OTB_MANUAL_INSTANTIATION
247 #endif
248 
249 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
VectorDataFileWriter< VectorDataType > VectorDataFileWriterType
Creation of an "otb" vector image which contains metadata.
GenericRSResamplerType::Pointer GenericRSResamplerPointerType
Generates a quicklook of the input image.
StreamingShrinkImageFilter< InputImageType, InputImageType > StreamingShrinkImageFilterType
This class produces Map file product ie a file .map, the tiles to draw in a mapserver, and finally a shapefile which describe the tiles and where to find them on the disk.
DataNodeType::PolygonType PolygonType
VectorDataType::Pointer m_VectorDataIndexTile
itk::SmartPointer< Self > Pointer
This class represents a node of data in a vector data hierarchy.
Definition: otbDataNode.h:75
VectorImageExtractROIFilterType::Pointer m_VectorImageExtractROIFilter
This class represent a 2D polygon.
Definition: otbPolygon.h:44
VectorData< double, 2 > VectorDataType
Extract a spatial or spectral subset of a multi-channel image.
This filter performs a rescaling of a vector image on a per band basis.
InputImageType::InternalPixelType InternalPixelType
StreamingShrinkImageFilterType::Pointer m_StreamingShrinkImageFilter
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
This class is a composite filter that allows you to project an input image from any coordinate system...
VectorWriterType::Pointer m_VectorWriter
MultiChannelExtractROI< InternalPixelType, OutputPixelType > VectorImageExtractROIFilterType
Multi channels Extract ROI filter.
Superclass::VertexType VertexType
Definition: otbPolygon.h:59
itk::SmartPointer< const Self > ConstPointer
InputImageType::SizeType SizeType
ImageFileWriter< OutputImageType > VectorWriterType
VectorRescaleIntensityImageFilterType::Pointer m_VectorRescaleIntensityImageFilter
GenericRSResampleImageFilter< InputImageType, InputImageType > GenericRSResamplerType
TransformType::InputPointType InputPointType
PolygonType::VertexType VertexType
VectorDataType::DataNodeType DataNodeType
VectorImage< OutputPixelType > OutputImageType
TransformType::Pointer m_Transform
This is the class to handle generic remote sensing transform.
VectorRescaleIntensityImageFilter< InputImageType, InputImageType > VectorRescaleIntensityImageFilterType
GenericRSResamplerPointerType m_GenericRSResampler
OTBApplicationEngine_EXPORT void Write(const std::string &filename, Application::Pointer application)
This class represents a hierarchy of vector data.
Definition: otbVectorData.h:58
TileSize
Definition: mvdGui.h:117
InputImageType::Pointer InputImagePointer
InputImageType::PixelType InputImagePixelType
TransformType::OutputPointType OutputPointType
InputImageType::RegionType InputImageRegionType
This class writes vector data file format (shapefile and KML)
Writes image data to a single file with streaming process.
InputImageType::IndexType IndexType