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 
84  ~InputParameters();
85 
86  //overload
87  void reset() throw( te::rp::Exception );
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::auto_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
109 
111 
113 
114  ~OutputParameters();
115 
116  //overload
117  void reset() throw( te::rp::Exception );
118 
119  //overload
120  const OutputParameters& operator=( const OutputParameters& params );
121 
122  //overload
123  AbstractParameters* clone() const;
124  };
125 
126  GeoMosaic();
127 
128  ~GeoMosaic();
129 
130  //overload
131  bool execute( AlgorithmOutputParameters& outputParams ) throw( te::rp::Exception );
132 
133  //overload
134  void reset() throw( te::rp::Exception );
135 
136  //overload
137  bool initialize( const AlgorithmInputParameters& inputParams ) throw( te::rp::Exception );
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 band Input raster band.
158  \param forceNoDataValue Force the noDataValue to be used as the band no-data value.
159  \param noDataValue The no-data value to use.
160  \param mean Pixels mean.
161  \param variance Pixels variance.
162  */
163  static void calcBandStatistics( const te::rst::Band& band,
164  const bool& forceNoDataValue,
165  const double& noDataValue,
166  double& mean,
167  double& variance );
168 
169  };
170 
171  } // end namespace rp
172 } // end namespace te
173 
174 #endif
175 
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: GeoMosaic.h:64
Base exception class for plugin module.
Definition: Exception.h:42
GeoMosaic input parameters.
Definition: GeoMosaic.h:56
Blended pixel value calculation for two overlaped rasters.
Raster Processing algorithm output parameters base interface.
Create a mosaic from a set of geo-referenced rasters.
Definition: GeoMosaic.h:48
Raster Processing algorithm base interface class.
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: GeoMosaic.h:104
Raster Processing algorithm base interface.
Definition: Algorithm.h:41
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: GeoMosaic.h:76
URI C++ Library.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
Definition: GeoMosaic.h:70
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
Definition: GeoMosaic.h:108
Feeder from a input rasters.
Definition: FeedersRaster.h:46
GeoMosaic output parameters.
Definition: GeoMosaic.h:100
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
Definition: GeoMosaic.h:72
bool m_enableMultiThread
Enable/disable the use of threads (default:true).
Definition: GeoMosaic.h:78
Raster Processing algorithm input parameters base interface.
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
Definition: GeoMosaic.h:68
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
Definition: GeoMosaic.h:62
Raster objects feeders.
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
Definition: GeoMosaic.h:66
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
Definition: GeoMosaic.h:74
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
Definition: GeoMosaic.h:60
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