OTB  9.0.0
Orfeo Toolbox
otbMapFileProductWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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:
75  typedef itk::ProcessObject Superclass;
76  typedef itk::SmartPointer<Self> Pointer;
77  typedef itk::SmartPointer<const Self> ConstPointer;
78 
80  itkNewMacro(Self);
81 
83  itkTypeMacro(MapFileProductWriter, itk::ProcessObject);
84 
86  typedef TInputImage InputImageType;
87  typedef typename InputImageType::InternalPixelType InternalPixelType;
88  typedef typename InputImageType::SizeType SizeType;
89  typedef typename InputImageType::IndexType IndexType;
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 
107 
108  // Writer
110 
111  // Resampler
113 
114  // Intensity Rescale
116 
117  // Project filter
120 
121  // Transformer
125 
127  itkStaticConstMacro(InputImageDimension, unsigned int, InputImageType::ImageDimension);
128 
129  using Superclass::SetInput;
130  virtual void SetInput(const InputImageType* image);
131  virtual void SetInput(unsigned int, const TInputImage* image);
132  const InputImageType* GetInput(void);
133  const InputImageType* GetInput(unsigned int idx);
134 
136  itkSetStringMacro(FileName);
137  itkGetStringMacro(FileName);
139 
141  itkSetMacro(TileSize, unsigned int);
142  itkGetMacro(TileSize, unsigned int);
144 
146  itkSetStringMacro(CGIPath);
147  itkGetStringMacro(CGIPath);
149 
151  itkSetStringMacro(ShapeIndexPath);
152  itkGetStringMacro(ShapeIndexPath);
154 
156  void Update() override
157  {
158  this->Write();
159  }
160 
162  itkSetMacro(SRID, int);
163 
164 protected:
166  ~MapFileProductWriter() override;
167  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
168 
170  virtual void Tiling();
171 
173  virtual void Write();
174 
175 private:
176  MapFileProductWriter(const Self&) = delete;
177  void operator=(const Self&) = delete;
178 
180  virtual void Initialize();
181 
183  virtual void AddBBoxToIndexTile(OutputPointType lowerLeftCorner, OutputPointType lowerRightCorner, OutputPointType upperRightCorner,
184  OutputPointType upperLeftCorner, unsigned int x, unsigned int y);
185 
187  virtual void GenerateMapFile();
188 
190  void AddLayer();
191 
193  void InitializeVectorData();
194 
197 
198  // Extract ROI
200 
201  // Writer
203 
204  // Resampler
206 
207  // Rescale intensity
209 
210  // Transformer
212 
213  // VectorData Pointer Type for tileindex shapefile
217 
218  // Projection Filter
220 
221  // Tile size
222  unsigned int m_TileSize;
223  unsigned int m_CurrentDepth;
224 
225  // File and path name
226  std::string m_FileName;
227  std::string m_IndexShapeFileName;
228  std::string m_CGIPath;
229  std::string m_ShapeIndexPath;
230 
231  std::ofstream m_File;
232  int m_SRID;
233 };
234 
235 } // end namespace otb
236 
237 #ifndef OTB_MANUAL_INSTANTIATION
239 #endif
240 
241 #endif
otb::MapFileProductWriter::GenericRSResamplerType
GenericRSResampleImageFilter< InputImageType, InputImageType > GenericRSResamplerType
Definition: otbMapFileProductWriter.h:118
otb::MapFileProductWriter::m_SRID
int m_SRID
Definition: otbMapFileProductWriter.h:232
otb::DataNode::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbDataNode.h:79
otb::MapFileProductWriter::InternalPixelType
InputImageType::InternalPixelType InternalPixelType
Definition: otbMapFileProductWriter.h:87
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::MapFileProductWriter::OutputPixelType
unsigned char OutputPixelType
Definition: otbMapFileProductWriter.h:94
otb::StreamingShrinkImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStreamingShrinkImageFilter.h:272
otb::MapFileProductWriter::Superclass
itk::ProcessObject Superclass
Definition: otbMapFileProductWriter.h:75
otb::MapFileProductWriter::VectorRescaleIntensityImageFilterType
VectorRescaleIntensityImageFilter< InputImageType, InputImageType > VectorRescaleIntensityImageFilterType
Definition: otbMapFileProductWriter.h:115
otb::MapFileProductWriter::InputImagePixelType
InputImageType::PixelType InputImagePixelType
Definition: otbMapFileProductWriter.h:92
otb::MultiChannelExtractROI::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMultiChannelExtractROI.h:53
otb::MapFileProductWriter::StreamingShrinkImageFilterType
StreamingShrinkImageFilter< InputImageType, InputImageType > StreamingShrinkImageFilterType
Definition: otbMapFileProductWriter.h:112
otb::MapFileProductWriter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbMapFileProductWriter.h:91
otbMultiChannelExtractROI.h
otb::VectorRescaleIntensityImageFilter
This filter performs a rescaling of a vector image on a per band basis.
Definition: otbVectorRescaleIntensityImageFilter.h:220
otbVectorDataFileWriter.h
otb::MapFileProductWriter::m_CGIPath
std::string m_CGIPath
Definition: otbMapFileProductWriter.h:228
otb::MapFileProductWriter::PolygonType
DataNodeType::PolygonType PolygonType
Definition: otbMapFileProductWriter.h:99
otb::VectorData::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorData.h:64
otb::VectorData
This class represents a hierarchy of vector data.
Definition: otbVectorData.h:58
otb::DataNode
This class represents a node of data in a vector data hierarchy.
Definition: otbDataNode.h:73
otb::Wrapper::XML::Write
OTBApplicationEngine_EXPORT void Write(const std::string &filename, Application::Pointer application)
otb::MapFileProductWriter::SizeType
InputImageType::SizeType SizeType
Definition: otbMapFileProductWriter.h:88
otb::MapFileProductWriter::VertexType
PolygonType::VertexType VertexType
Definition: otbMapFileProductWriter.h:100
otb::MapFileProductWriter::m_VectorDataIndexTile
VectorDataType::Pointer m_VectorDataIndexTile
Definition: otbMapFileProductWriter.h:214
otb::MapFileProductWriter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMapFileProductWriter.h:76
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MapFileProductWriter::m_IndexShapeFileName
std::string m_IndexShapeFileName
Definition: otbMapFileProductWriter.h:227
otb::MapFileProductWriter::m_FileName
std::string m_FileName
Definition: otbMapFileProductWriter.h:226
otb::MapFileProductWriter
This class produces Map file product ie a file .map, the tiles to draw in a mapserver,...
Definition: otbMapFileProductWriter.h:70
otbMapFileProductWriter.hxx
otb::MapFileProductWriter::VectorImageExtractROIFilterType
MultiChannelExtractROI< InternalPixelType, OutputPixelType > VectorImageExtractROIFilterType
Multi channels Extract ROI filter.
Definition: otbMapFileProductWriter.h:106
otb::GenericRSResampleImageFilter
This class is a composite filter that allows you to project an input image from any coordinate system...
Definition: otbGenericRSResampleImageFilter.h:56
otb::MapFileProductWriter::Self
MapFileProductWriter Self
Definition: otbMapFileProductWriter.h:74
otb::GenericRSTransform::OutputPointType
itk::Point< ScalarType, NOutputDimensions > OutputPointType
Definition: otbGenericRSTransform.h:73
otb::MapFileProductWriter::Update
void Update() override
Definition: otbMapFileProductWriter.h:156
otb::MapFileProductWriter::m_VectorImage
InputImagePointer m_VectorImage
Definition: otbMapFileProductWriter.h:195
otb::MapFileProductWriter::DataNodeType
VectorDataType::DataNodeType DataNodeType
Definition: otbMapFileProductWriter.h:98
otb::MapFileProductWriter::m_TileSize
unsigned int m_TileSize
Definition: otbMapFileProductWriter.h:222
otb::MapFileProductWriter::m_StreamingShrinkImageFilter
StreamingShrinkImageFilterType::Pointer m_StreamingShrinkImageFilter
Definition: otbMapFileProductWriter.h:205
otb::MultiChannelExtractROI
Extract a spatial or spectral subset of a multi-channel image.
Definition: otbMultiChannelExtractROI.h:47
otb::ImageFileWriter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImageFileWriter.h:72
otb::MapFileProductWriter::m_GenericRSResampler
GenericRSResamplerPointerType m_GenericRSResampler
Definition: otbMapFileProductWriter.h:219
otb::MapFileProductWriter::m_VectorImageExtractROIFilter
VectorImageExtractROIFilterType::Pointer m_VectorImageExtractROIFilter
Definition: otbMapFileProductWriter.h:199
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::VectorDataFileWriter
This class writes vector data file format (shapefile and KML)
Definition: otbVectorDataFileWriter.h:66
otb::MapFileProductWriter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMapFileProductWriter.h:77
otb::MapFileProductWriter::GenericRSResamplerPointerType
GenericRSResamplerType::Pointer GenericRSResamplerPointerType
Definition: otbMapFileProductWriter.h:119
otb::MapFileProductWriter::m_File
std::ofstream m_File
Definition: otbMapFileProductWriter.h:231
otb::MapFileProductWriter::VectorDataType
VectorData< double, 2 > VectorDataType
Definition: otbMapFileProductWriter.h:97
otb::MapFileProductWriter::VectorDataFileWriterType
VectorDataFileWriter< VectorDataType > VectorDataFileWriterType
Definition: otbMapFileProductWriter.h:102
otb::MapFileProductWriter::m_Folder
DataNodeType::Pointer m_Folder
Definition: otbMapFileProductWriter.h:216
otb::GenericRSTransform::InputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
Definition: otbGenericRSTransform.h:72
otb::MapFileProductWriter::InputPointType
TransformType::InputPointType InputPointType
Definition: otbMapFileProductWriter.h:123
otbGenericRSResampleImageFilter.h
otbVectorRescaleIntensityImageFilter.h
otb::MapFileProductWriter::TransformType
GenericRSTransform TransformType
Definition: otbMapFileProductWriter.h:122
otb::Polygon::VertexType
Superclass::VertexType VertexType
Definition: otbPolygon.h:58
otb::MapFileProductWriter::OutputImageType
VectorImage< OutputPixelType > OutputImageType
Definition: otbMapFileProductWriter.h:95
otbVectorData.h
otb::MapFileProductWriter::m_VectorWriter
VectorWriterType::Pointer m_VectorWriter
Definition: otbMapFileProductWriter.h:202
otb::MapFileProductWriter::m_Transform
TransformType::Pointer m_Transform
Definition: otbMapFileProductWriter.h:211
otb::MapFileProductWriter::m_Polygon
DataNodeType::Pointer m_Polygon
Definition: otbMapFileProductWriter.h:215
otb::ImageFileWriter
Writes image data to a single file with streaming process.
Definition: otbImageFileWriter.h:66
otb::MapFileProductWriter::VectorWriterType
ImageFileWriter< OutputImageType > VectorWriterType
Definition: otbMapFileProductWriter.h:109
otb::VectorRescaleIntensityImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbVectorRescaleIntensityImageFilter.h:230
otbImageFileWriter.h
otb::Polygon
This class represent a 2D polygon.
Definition: otbPolygon.h:44
otb::MapFileProductWriter::m_VectorRescaleIntensityImageFilter
VectorRescaleIntensityImageFilterType::Pointer m_VectorRescaleIntensityImageFilter
Definition: otbMapFileProductWriter.h:208
otb::MapFileProductWriter::m_ShapeIndexPath
std::string m_ShapeIndexPath
Definition: otbMapFileProductWriter.h:229
otb::MapFileProductWriter::InputImagePointer
InputImageType::Pointer InputImagePointer
Definition: otbMapFileProductWriter.h:90
otb::MapFileProductWriter::m_CurrentDepth
unsigned int m_CurrentDepth
Definition: otbMapFileProductWriter.h:223
otb::MapFileProductWriter::m_ResampleVectorImage
InputImagePointer m_ResampleVectorImage
Definition: otbMapFileProductWriter.h:196
otb::MapFileProductWriter::OutputPointType
TransformType::OutputPointType OutputPointType
Definition: otbMapFileProductWriter.h:124
otb::MapFileProductWriter::InputImageType
TInputImage InputImageType
Definition: otbMapFileProductWriter.h:83
otb::StreamingShrinkImageFilter
Generates a quicklook of the input image.
Definition: otbStreamingShrinkImageFilter.h:266
otb::GenericRSResampleImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSResampleImageFilter.h:62
otbStreamingShrinkImageFilter.h
otb::MapFileProductWriter::IndexType
InputImageType::IndexType IndexType
Definition: otbMapFileProductWriter.h:89
otb::VectorImage
Creation of an "otb" vector image which contains metadata.
Definition: otbVectorImage.h:45