OTB  10.0.0
Orfeo Toolbox
otbMapFileProductWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 "OTBCartoExport.h"
40 #include <string>
41 
42 namespace otb
43 {
44 
70 template <class TInputImage>
71 class ITK_TEMPLATE_EXPORT MapFileProductWriter : public itk::ProcessObject
72 {
73 public:
76  typedef itk::ProcessObject Superclass;
77  typedef itk::SmartPointer<Self> Pointer;
78  typedef itk::SmartPointer<const Self> ConstPointer;
79 
81  itkNewMacro(Self);
82 
84  itkTypeMacro(MapFileProductWriter, itk::ProcessObject);
85 
87  typedef TInputImage InputImageType;
88  typedef typename InputImageType::InternalPixelType InternalPixelType;
89  typedef typename InputImageType::SizeType SizeType;
90  typedef typename InputImageType::IndexType IndexType;
91  typedef typename InputImageType::Pointer InputImagePointer;
92  typedef typename InputImageType::RegionType InputImageRegionType;
93  typedef typename InputImageType::PixelType InputImagePixelType;
94 
95  typedef unsigned char OutputPixelType;
97 
102 
104 
105 
108 
109  // Writer
111 
112  // Resampler
114 
115  // Intensity Rescale
117 
118  // Project filter
121 
122  // Transformer
126 
128  itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
129 
130  using Superclass::SetInput;
131  virtual void SetInput(const InputImageType* image);
132  virtual void SetInput(unsigned int, const TInputImage* image);
133  const InputImageType* GetInput(void);
134  const InputImageType* GetInput(unsigned int idx);
135 
137  itkSetStringMacro(FileName);
138  itkGetStringMacro(FileName);
140 
142  itkSetMacro(TileSize, unsigned int);
143  itkGetMacro(TileSize, unsigned int);
145 
147  itkSetStringMacro(CGIPath);
148  itkGetStringMacro(CGIPath);
150 
152  itkSetStringMacro(ShapeIndexPath);
153  itkGetStringMacro(ShapeIndexPath);
155 
157  void Update() override
158  {
159  this->Write();
160  }
161 
163  itkSetMacro(SRID, int);
164 
165 protected:
167  ~MapFileProductWriter() override;
168  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
169 
171  virtual void Tiling();
172 
174  virtual void Write();
175 
176 private:
177  MapFileProductWriter(const Self&) = delete;
178  void operator=(const Self&) = delete;
179 
181  virtual void Initialize();
182 
184  virtual void AddBBoxToIndexTile(OutputPointType lowerLeftCorner, OutputPointType lowerRightCorner, OutputPointType upperRightCorner,
185  OutputPointType upperLeftCorner, unsigned int x, unsigned int y);
186 
188  virtual void GenerateMapFile();
189 
191  void AddLayer();
192 
194  void InitializeVectorData();
195 
198 
199  // Extract ROI
201 
202  // Writer
204 
205  // Resampler
207 
208  // Rescale intensity
210 
211  // Transformer
213 
214  // VectorData Pointer Type for tileindex shapefile
218 
219  // Projection Filter
221 
222  // Tile size
223  unsigned int m_TileSize;
224  unsigned int m_CurrentDepth;
225 
226  // File and path name
227  std::string m_FileName;
228  std::string m_IndexShapeFileName;
229  std::string m_CGIPath;
230  std::string m_ShapeIndexPath;
231 
232  std::ofstream m_File;
233  int m_SRID;
234 };
235 
236 } // end namespace otb
237 
238 #ifndef OTB_MANUAL_INSTANTIATION
240 #endif
241 
242 #endif
This class represents a node of data in a vector data hierarchy.
Definition: otbDataNode.h:74
itk::SmartPointer< Self > Pointer
Definition: otbDataNode.h:79
This class is a composite filter that allows you to project an input image from any coordinate system...
This is the class to handle generic remote sensing transform.
itk::Point< ScalarType, NOutputDimensions > OutputPointType
itk::SmartPointer< Self > Pointer
itk::Point< ScalarType, NInputDimensions > InputPointType
Writes image data to a single file with streaming process.
itk::SmartPointer< Self > Pointer
This class produces Map file product ie a file .map, the tiles to draw in a mapserver,...
InputImageType::IndexType IndexType
ImageFileWriter< OutputImageType > VectorWriterType
InputImageType::PixelType InputImagePixelType
TransformType::InputPointType InputPointType
VectorData< double, 2 > VectorDataType
VectorImageExtractROIFilterType::Pointer m_VectorImageExtractROIFilter
VectorImage< OutputPixelType > OutputImageType
StreamingShrinkImageFilter< InputImageType, InputImageType > StreamingShrinkImageFilterType
void operator=(const Self &)=delete
VectorRescaleIntensityImageFilter< InputImageType, InputImageType > VectorRescaleIntensityImageFilterType
VectorDataFileWriter< VectorDataType > VectorDataFileWriterType
GenericRSResamplerType::Pointer GenericRSResamplerPointerType
GenericRSResampleImageFilter< InputImageType, InputImageType > GenericRSResamplerType
itk::SmartPointer< const Self > ConstPointer
TransformType::Pointer m_Transform
VectorDataType::Pointer m_VectorDataIndexTile
StreamingShrinkImageFilterType::Pointer m_StreamingShrinkImageFilter
MapFileProductWriter(const Self &)=delete
PolygonType::VertexType VertexType
TransformType::OutputPointType OutputPointType
itk::SmartPointer< Self > Pointer
DataNodeType::PolygonType PolygonType
GenericRSResamplerPointerType m_GenericRSResampler
VectorRescaleIntensityImageFilterType::Pointer m_VectorRescaleIntensityImageFilter
InputImageType::SizeType SizeType
VectorWriterType::Pointer m_VectorWriter
VectorDataType::DataNodeType DataNodeType
InputImageType::RegionType InputImageRegionType
InputImageType::Pointer InputImagePointer
MultiChannelExtractROI< InternalPixelType, OutputPixelType > VectorImageExtractROIFilterType
Multi channels Extract ROI filter.
InputImageType::InternalPixelType InternalPixelType
Extract a spatial or spectral subset of a multi-channel image.
itk::SmartPointer< Self > Pointer
This class represent a 2D polygon.
Definition: otbPolygon.h:45
Superclass::VertexType VertexType
Definition: otbPolygon.h:58
Generates a quicklook of the input image.
This class writes vector data file format (shapefile and KML)
This class represents a hierarchy of vector data.
Definition: otbVectorData.h:62
itk::SmartPointer< Self > Pointer
Definition: otbVectorData.h:67
Creation of an "otb" vector image which contains metadata.
This filter performs a rescaling of a vector image on a per band basis.
OTBApplicationEngine_EXPORT void Write(const std::string &filename, Application::Pointer application)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.