GeoMosaic.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/rp/GeoMosaic.h
22  \brief Create a mosaic from a set of geo-referenced rasters.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_GEOMOSAIC_H
26 #define __TERRALIB_RP_INTERNAL_GEOMOSAIC_H
27 
28 #include "Algorithm.h"
29 #include "FeedersRaster.h"
30 #include "Blender.h"
31 #include "../raster/Interpolator.h"
32 
33 #include <vector>
34 #include <string>
35 #include <map>
36 #include <memory>
37 #include <utility>
38 
39 namespace te
40 {
41  namespace rp
42  {
43  class GeoComposition;
44 
45  /*!
46  \class GeoMosaic
47  \brief Create a mosaic from a set of geo-referenced rasters.
48  \ingroup rp_mos
49  */
51  {
52  public:
53 
54  /*!
55  \class InputParameters
56  \brief GeoMosaic input parameters
57  */
59  {
60  public:
61 
62  friend class GeoMosaic;
63  friend class GeoComposition;
64 
65  /*! \enum EqType The mosaic equalization type.*/
66  enum EqType
67  {
68  InvalidEqType = 0, //!< Invalid equalization type.
69  NoEqType = 1, //!< No equalization performed.
70  CenterEqType = 2, //!< Mosaic will be equalized following the center raster.
71  TargetEqtype = 3, //!< Mosaic will be equalized following the supplied target means (m_mosaicTargetMeans) and std devs (m_mosaicTargetStdDevs).
72  LocalEqType = 4 //!< Mosaic will be equalized following a local strategy.
73  };
74 
75  FeederConstRaster* m_feederRasterPtr; //!< Input rasters feeder.
76 
77  std::vector< std::vector< unsigned int > > m_inputRastersBands; //!< Bands to process for each input raster.
78 
79  te::rst::Interpolator::Method m_interpMethod; //!< The raster interpolator method (default:NearestNeighbor).
80 
81  double m_noDataValue; //!< The pixel value used where no raster data is avaliable (defaul:0).
82 
83  bool m_forceInputNoDataValue; //!< If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
84 
85  te::rp::Blender::BlendMethod m_blendMethod; //!< The pixel blending method (default: NoBlendMethod).
86 
87  EqType m_equalizationType; //!< Equalization type (default:CenterEqType ).
88 
89  bool m_useRasterCache; //!< Enable(true) or disable the use of raster caching (default:true).
90 
91  bool m_enableProgress; //!< Enable/Disable the progress interface (default:false).
92 
93  bool m_enableMultiThread; //!< Enable/disable the use of threads (default:true).
94 
95  bool m_enableAutoValidAreaDetect; //!< Enable/disable the auto-detection of raster valid area pixels (this option allows better mosaic result for rasters with no-data pixels on borders. Default:true).
96 
97  std::vector< double > m_mosaicTargetMeans; //!< An empty vector for automatic mosaic target means calcule or a vector of target means for each mosaic baind.
98 
99  std::vector< double > m_mosaicTargetStdDevs; //!< An empty vector for automatic mosaic target standart deviation values calcule or a vector of target standart deviantion values for each mosaic baind.
100 
101  bool m_abortOnFirstError; //!< if true the processing will be stopped on the first error, if false the processing of the next rasters will continue on the event of an error (default: true).
102 
103  bool m_skipInsideRasters; //!< Rasters covering mosaic areas already covered by other rasters will be skipped (default: false).
104 
105  unsigned int m_localEqMaxNeighborRasters; //!< Maximum number of neighbor rasters to use in Local equalization mode (default: 4).
106 
108 
110 
112 
113  //overload
114  void reset() _NOEXCEPT_OP(false);
115 
116  //overload
117  const InputParameters& operator=( const InputParameters& params );
118 
119  //overload
120  AbstractParameters* clone() const;
121 
122  //overload
123  bool serialize ( AlgorithmParametersSerializer& serializer ) const;
124 
125  /*!
126  \brief Returns all current supported equalization type infos.
127  \param eqTypesInfo current supported equalization type infos.
128  */
129  static void getEqTypesInfo( std::vector< std::pair< EqType, std::string > >& eqTypesInfo );
130 
131  protected :
132 
133  BlenderRule const * m_blenderRulePtr;
134  };
135 
136  /*!
137  \class OutputParameters
138  \brief GeoMosaic output parameters
139  */
141  {
142  public:
143 
144  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
145 
146  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
147 
148  std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
149 
151 
153 
155 
156  //overload
157  void reset() _NOEXCEPT_OP(false);
158 
159  //overload
160  const OutputParameters& operator=( const OutputParameters& params );
161 
162  //overload
163  AbstractParameters* clone() const;
164  };
165 
167 
169 
170  //overload
171  bool execute( AlgorithmOutputParameters& outputParams ) _NOEXCEPT_OP(false);
172 
173  //overload
174  void reset() _NOEXCEPT_OP(false);
175 
176  //overload
177  bool initialize( const AlgorithmInputParameters& inputParams ) _NOEXCEPT_OP(false);
178 
179  bool isInitialized() const;
180 
181  protected:
182 
183  GeoMosaic::InputParameters m_inputParameters; //!< Input execution parameters.
184 
185  bool m_isInitialized; //!< Tells if this instance is initialized.
186 
187  };
188 
189  } // end namespace rp
190 } // end namespace te
191 
192 #endif
193 
Blended pixel value calculation for two overlaped rasters.
Raster objects feeders.
#define _NOEXCEPT_OP(x)
Raster Processing algorithm input parameters base interface.
Raster Processing algorithm output parameters base interface.
A class to standardize algorithm parameters serialization.
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
Feeder from a input rasters.
Definition: FeedersRaster.h:47
GeoMosaic input parameters.
Definition: GeoMosaic.h:59
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
Definition: GeoMosaic.h:83
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: GeoMosaic.h:79
unsigned int m_localEqMaxNeighborRasters
Maximum number of neighbor rasters to use in Local equalization mode (default: 4).
Definition: GeoMosaic.h:105
EqType m_equalizationType
Equalization type (default:CenterEqType ).
Definition: GeoMosaic.h:87
std::vector< double > m_mosaicTargetMeans
An empty vector for automatic mosaic target means calcule or a vector of target means for each mosaic...
Definition: GeoMosaic.h:97
bool m_skipInsideRasters
Rasters covering mosaic areas already covered by other rasters will be skipped (default: false).
Definition: GeoMosaic.h:103
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: GeoMosaic.h:91
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
Definition: GeoMosaic.h:75
InputParameters(const InputParameters &)
bool m_abortOnFirstError
if true the processing will be stopped on the first error, if false the processing of the next raster...
Definition: GeoMosaic.h:101
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
Definition: GeoMosaic.h:85
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
Definition: GeoMosaic.h:81
bool m_enableMultiThread
Enable/disable the use of threads (default:true).
Definition: GeoMosaic.h:93
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
bool m_enableAutoValidAreaDetect
Enable/disable the auto-detection of raster valid area pixels (this option allows better mosaic resul...
Definition: GeoMosaic.h:95
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
Definition: GeoMosaic.h:77
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
Definition: GeoMosaic.h:89
std::vector< double > m_mosaicTargetStdDevs
An empty vector for automatic mosaic target standart deviation values calcule or a vector of target s...
Definition: GeoMosaic.h:99
GeoMosaic output parameters.
Definition: GeoMosaic.h:141
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: GeoMosaic.h:144
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
Definition: GeoMosaic.h:146
OutputParameters(const OutputParameters &)
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
Definition: GeoMosaic.h:148
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
Create a mosaic from a set of geo-referenced rasters.
Definition: GeoMosaic.h:51
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Abstract algorithm.