All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TiePointsMosaic.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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/TiePointsMosaic.h
22  \brief Create a mosaic from a set of rasters using tie-points.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_TIEPOINTSMOSAIC_H
26 #define __TERRALIB_RP_INTERNAL_TIEPOINTSMOSAIC_H
27 
28 #include "Algorithm.h"
29 #include "FeedersRaster.h"
30 #include "Blender.h"
31 #include "../geometry/GTParameters.h"
32 #include "../geometry/GeometricTransformation.h"
33 #include "../raster/Interpolator.h"
34 
35 #include <vector>
36 #include <string>
37 #include <map>
38 #include <memory>
39 
40 namespace te
41 {
42  namespace rp
43  {
44  /*!
45  \class TiePointsMosaic
46  \brief Create a mosaic from a set of rasters using tie-points.
47  \note The first raster will always be taken as reference to define the mosaic resolution and SRS.
48  */
50  {
51  public:
52 
53  /*!
54  \class InputParameters
55  \brief Mosaic input parameters
56  */
58  {
59  public:
60 
61  /*! \enum TiePointsLinkType The tie pionts linking type (what rasters are linked by the supplied tie-points. */
63  {
64  InvalidTiePointsT = 0, //!< Invalid linking type.
65  AdjacentRastersLinkingTiePointsT = 1, //!< Tie-points linking adjacent raster pairs (te::gm::GTParameters::TiePoint::first are raster (with index i) lines/columns, te::gm::GTParameters::TiePoint::second are raster (with index I+1) lines/columns ,and so on).
66  FirstRasterLinkingTiePointsT = 2 //!< Tie-points linking any raster to the first sequence raster (te::gm::GTParameters::TiePoint::first are the first raster lines/columns, te::gm::GTParameters::TiePoint::second are any other sequenced raster lines/columns ,and so on).
67  };
68 
69  FeederConstRaster* m_feederRasterPtr; //!< Input rasters feeder.
70 
71  std::vector< std::vector< unsigned int > > m_inputRastersBands; //!< Bands to process for each input raster.
72 
73  std::vector< std::vector< te::gm::GTParameters::TiePoint > > m_tiePoints; //!< Tie-points between each adjacent raster pair (te::gm::GTParameters::TiePoint::first are raster (with index i) lines/columns, te::gm::GTParameters::TiePoint::second are raster (with index I+1) lines/columns ,and so on).
74 
75  TiePointsLinkType m_tiePointsLinkType; //!< The given tie points linking type, see TiePointsLinkType.
76 
77  std::string m_geomTransfName; //!< The name of the geometric transformation used if tie-points are supplied (see each te::gm::GTFactory inherited classes to find each factory key/name, default:Affine).
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  bool m_autoEqualize; //!< Auto equalization will be performed using the overlaped image areas (default:true).
88 
89  bool m_useRasterCache; //!< Enable(true) or disable the use of raster caching (default:true).
90 
92 
94 
95  ~InputParameters();
96 
97  //overload
98  void reset() throw( te::rp::Exception );
99 
100  //overload
101  const InputParameters& operator=( const InputParameters& params );
102 
103  //overload
104  AbstractParameters* clone() const;
105  };
106 
107  /*!
108  \class OutputParameters
109  \brief Mosaic output parameters
110  */
112  {
113  public:
114 
115  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
116 
117  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
118 
119  std::auto_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
120 
122 
124 
125  ~OutputParameters();
126 
127  //overload
128  void reset() throw( te::rp::Exception );
129 
130  //overload
131  const OutputParameters& operator=( const OutputParameters& params );
132 
133  //overload
134  AbstractParameters* clone() const;
135  };
136 
137  TiePointsMosaic();
138 
139  ~TiePointsMosaic();
140 
141  //overload
142  bool execute( AlgorithmOutputParameters& outputParams ) throw( te::rp::Exception );
143 
144  //overload
145  void reset() throw( te::rp::Exception );
146 
147  //overload
148  bool initialize( const AlgorithmInputParameters& inputParams ) throw( te::rp::Exception );
149 
150  bool isInitialized() const;
151 
152  protected:
153 
154  TiePointsMosaic::InputParameters m_inputParameters; //!< Input execution parameters.
155 
156  bool m_isInitialized; //!< Tells if this instance is initialized.
157 
158  /*!
159  \brief Execute a mosaic of georeferenced images.
160  \param outputParams The algorithm execution parameters.
161  \return true if ok, false on errors.
162  */
163  bool executeGeoMosaic( TiePointsMosaic::OutputParameters& outputParams );
164 
165  /*!
166  \brief Execute a mosaic of images linket by tie-points.
167  \param outputParams The algorithm execution parameters.
168  \return true if ok, false on errors.
169  */
170  bool executeTiePointsMosaic( TiePointsMosaic::OutputParameters& outputParams );
171 
172  /*!
173  \brief Raster band statistics calcule.
174  \param band Input raster band.
175  \param forceNoDataValue Force the noDataValue to be used as the band no-data value.
176  \param noDataValue The no-data value to use.
177  \param mean Pixels mean.
178  \param variance Pixels variance.
179  */
180  static void calcBandStatistics( const te::rst::Band& band,
181  const bool& forceNoDataValue,
182  const double& noDataValue,
183  double& mean,
184  double& variance );
185 
186  };
187 
188  } // end namespace rp
189 } // end namespace te
190 
191 #endif
192 
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
Raster Processing algorithm base interface class.
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
Raster objects feeders.
Method
Allowed interpolation methods.
Definition: Interpolator.h:58
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
std::string m_geomTransfName
The name of the geometric transformation used if tie-points are supplied (see each te::gm::GTFactory ...
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
Create a mosaic from a set of rasters using tie-points.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
Feeder from a input rasters.
Definition: FeedersRaster.h:45
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Raster Processing algorithm output parameters base interface.
TiePointsLinkType m_tiePointsLinkType
The given tie points linking type, see TiePointsLinkType.
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
Blended pixel value calculation for two overlaped rasters.
std::vector< std::vector< te::gm::GTParameters::TiePoint > > m_tiePoints
Tie-points between each adjacent raster pair (te::gm::GTParameters::TiePoint::first are raster (with ...
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:91
Raster Processing algorithm input parameters base interface.