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 
38 namespace te
39 {
40  namespace rp
41  {
42  /*!
43  \class GeoMosaic
44  \brief Create a mosaic from a set of geo-referenced rasters.
45  \note The first raster will always be taken as reference to define the mosaic resolution and SRS.
46  \ingroup rp_mos
47  */
49  {
50  public:
51 
52  /*!
53  \class InputParameters
54  \brief GeoMosaic input parameters
55  */
57  {
58  public:
59 
60  FeederConstRaster* m_feederRasterPtr; //!< Input rasters feeder.
61 
62  std::vector< std::vector< unsigned int > > m_inputRastersBands; //!< Bands to process for each input raster.
63 
64  te::rst::Interpolator::Method m_interpMethod; //!< The raster interpolator method (default:NearestNeighbor).
65 
66  double m_noDataValue; //!< The pixel value used where no raster data is avaliable (defaul:0).
67 
68  bool m_forceInputNoDataValue; //!< If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
69 
70  te::rp::Blender::BlendMethod m_blendMethod; //!< The pixel blending method (default: NoBlendMethod).
71 
72  bool m_autoEqualize; //!< Auto equalization will be performed using the overlaped image areas (default:true).
73 
74  bool m_useRasterCache; //!< Enable(true) or disable the use of raster caching (default:true).
75 
76  bool m_enableProgress; //!< Enable/Disable the progress interface (default:false).
77 
78  bool m_enableMultiThread; //!< Enable/disable the use of threads (default:true).
79 
81 
83 
85 
86  //overload
87  void reset() _NOEXCEPT_OP(false);
88 
89  //overload
90  const InputParameters& operator=( const InputParameters& params );
91 
92  //overload
93  AbstractParameters* clone() const;
94  };
95 
96  /*!
97  \class OutputParameters
98  \brief GeoMosaic output parameters
99  */
101  {
102  public:
103 
104  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
105 
106  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
107 
108  std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
109 
111 
113 
115 
116  //overload
117  void reset() _NOEXCEPT_OP(false);
118 
119  //overload
120  const OutputParameters& operator=( const OutputParameters& params );
121 
122  //overload
123  AbstractParameters* clone() const;
124  };
125 
127 
129 
130  //overload
131  bool execute( AlgorithmOutputParameters& outputParams ) _NOEXCEPT_OP(false);
132 
133  //overload
134  void reset() _NOEXCEPT_OP(false);
135 
136  //overload
137  bool initialize( const AlgorithmInputParameters& inputParams ) _NOEXCEPT_OP(false);
138 
139  bool isInitialized() const;
140 
141  protected:
142 
143  GeoMosaic::InputParameters m_inputParameters; //!< Input execution parameters.
144 
145  bool m_isInitialized; //!< Tells if this instance is initialized.
146 
147  /*!
148  \brief Execute a mosaic of georeferenced images.
149  \param outputParams The algorithm execution parameters.
150  \return true if ok, false on errors.
151  */
152  bool executeGeoMosaic( GeoMosaic::OutputParameters& outputParams );
153 
154 
155  /*!
156  \brief Raster band statistics calcule.
157  \param raster Input raster
158  \param bandIndex Input raster band index.
159  \param forceNoDataValue Force the noDataValue to be used as the band no-data value.
160  \param noDataValue The no-data value to use.
161  \param mean Pixels mean.
162  \param variance Pixels variance.
163  */
164  static void calcBandStatistics( const te::rst::Raster& raster,
165  const unsigned int bandIndex,
166  const bool& forceNoDataValue,
167  const double& noDataValue,
168  double& mean,
169  double& variance );
170 
171  };
172 
173  } // end namespace rp
174 } // end namespace te
175 
176 #endif
177 
te::rp::GeoMosaic::OutputParameters::reset
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::rp::AlgorithmOutputParameters
Raster Processing algorithm output parameters base interface.
Definition: AlgorithmOutputParameters.h:40
te::rp::GeoMosaic::InputParameters::~InputParameters
~InputParameters()
te::rp::GeoMosaic::InputParameters::m_inputRastersBands
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
Definition: GeoMosaic.h:62
te::rp::GeoMosaic
Create a mosaic from a set of geo-referenced rasters.
Definition: GeoMosaic.h:49
te::rp::AlgorithmInputParameters
Raster Processing algorithm input parameters base interface.
Definition: AlgorithmInputParameters.h:40
te::rp::FeederConstRaster
Feeder from a input rasters.
Definition: FeedersRaster.h:47
_NOEXCEPT_OP
#define _NOEXCEPT_OP(x)
Definition: NoExceptDefinition.h:36
te::rp::GeoMosaic::InputParameters::m_noDataValue
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
Definition: GeoMosaic.h:66
te::rp::GeoMosaic::OutputParameters::~OutputParameters
~OutputParameters()
te::rp::GeoMosaic::OutputParameters::m_outputRasterPtr
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
Definition: GeoMosaic.h:108
te::rp::Algorithm
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
FeedersRaster.h
Raster objects feeders.
te::rp::GeoMosaic::InputParameters::m_enableMultiThread
bool m_enableMultiThread
Enable/disable the use of threads (default:true).
Definition: GeoMosaic.h:78
te::rst::InterpolationMethod
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
te::rp::GeoMosaic::InputParameters::m_forceInputNoDataValue
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
Definition: GeoMosaic.h:68
te::rp::GeoMosaic::OutputParameters::m_rType
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: GeoMosaic.h:104
te::rp::GeoMosaic::InputParameters::m_interpMethod
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: GeoMosaic.h:64
te::rp::GeoMosaic::InputParameters::m_autoEqualize
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
Definition: GeoMosaic.h:72
Blender.h
Blended pixel value calculation for two overlaped rasters.
te::rp::GeoMosaic::OutputParameters
GeoMosaic output parameters.
Definition: GeoMosaic.h:101
te::rp::GeoMosaic::InputParameters::reset
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
te::rp::GeoMosaic::InputParameters::InputParameters
InputParameters(const InputParameters &)
TERPEXPORT
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
te::rp::GeoMosaic::InputParameters
GeoMosaic input parameters.
Definition: GeoMosaic.h:57
te::rp::GeoMosaic::InputParameters::m_useRasterCache
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
Definition: GeoMosaic.h:74
te::rp::GeoMosaic::InputParameters::m_feederRasterPtr
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
Definition: GeoMosaic.h:60
te::rp::GeoMosaic::OutputParameters::OutputParameters
OutputParameters()
te::rp::Blender::BlendMethod
BlendMethod
Definition: Blender.h:66
Algorithm.h
Abstract algorithm.
te::rp::GeoMosaic::InputParameters::InputParameters
InputParameters()
te::rp::GeoMosaic::OutputParameters::m_rInfo
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:106
te::rp::GeoMosaic::InputParameters::m_enableProgress
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: GeoMosaic.h:76
te::rp::GeoMosaic::OutputParameters::OutputParameters
OutputParameters(const OutputParameters &)
te::rp::GeoMosaic::InputParameters::m_blendMethod
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
Definition: GeoMosaic.h:70