TiePointsMosaic.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/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  \ingroup rp_mos
49  */
51  {
52  public:
53 
54  /*!
55  \class InputParameters
56  \brief Mosaic input parameters
57  */
59  {
60  public:
61 
62  /*! \enum TiePointsLinkType The tie pionts linking type (what rasters are linked by the supplied tie-points. */
64  {
65  InvalidTiePointsT = 0, //!< Invalid linking type.
66  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).
67  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).
68  };
69 
70  FeederConstRaster* m_feederRasterPtr; //!< Input rasters feeder.
71 
72  std::vector< std::vector< unsigned int > > m_inputRastersBands; //!< Bands to process for each input raster.
73 
74  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).
75 
76  TiePointsLinkType m_tiePointsLinkType; //!< The given tie points linking type, see TiePointsLinkType.
77 
78  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).
79 
80  te::rst::Interpolator::Method m_interpMethod; //!< The raster interpolator method (default:NearestNeighbor).
81 
82  double m_noDataValue; //!< The pixel value used where no raster data is avaliable (defaul:0).
83 
84  bool m_forceInputNoDataValue; //!< If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
85 
86  te::rp::Blender::BlendMethod m_blendMethod; //!< The pixel blending method (default: NoBlendMethod).
87 
88  bool m_autoEqualize; //!< Auto equalization will be performed using the overlaped image areas (default:true).
89 
90  bool m_useRasterCache; //!< Enable(true) or disable the use of raster caching (default:true).
91 
92  bool m_enableProgress; //!< Enable/Disable the progress interface (default:false).
93 
94  bool m_enableMultiThread; //!< Enable/disable the use of threads (default:true).
95 
97 
99 
100  ~InputParameters();
101 
102  //overload
103  void reset() throw( te::rp::Exception );
104 
105  //overload
106  const InputParameters& operator=( const InputParameters& params );
107 
108  //overload
109  AbstractParameters* clone() const;
110  };
111 
112  /*!
113  \class OutputParameters
114  \brief Mosaic output parameters
115  */
117  {
118  public:
119 
120  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
121 
122  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
123 
124  std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
125 
127 
129 
130  ~OutputParameters();
131 
132  //overload
133  void reset() throw( te::rp::Exception );
134 
135  //overload
136  const OutputParameters& operator=( const OutputParameters& params );
137 
138  //overload
139  AbstractParameters* clone() const;
140  };
141 
142  TiePointsMosaic();
143 
144  ~TiePointsMosaic();
145 
146  //overload
147  bool execute( AlgorithmOutputParameters& outputParams ) throw( te::rp::Exception );
148 
149  //overload
150  void reset() throw( te::rp::Exception );
151 
152  //overload
153  bool initialize( const AlgorithmInputParameters& inputParams ) throw( te::rp::Exception );
154 
155  bool isInitialized() const;
156 
157  protected:
158 
159  TiePointsMosaic::InputParameters m_inputParameters; //!< Input execution parameters.
160 
161  bool m_isInitialized; //!< Tells if this instance is initialized.
162 
163  /*!
164  \brief Execute a mosaic of georeferenced images.
165  \param outputParams The algorithm execution parameters.
166  \return true if ok, false on errors.
167  */
168  bool executeGeoMosaic( TiePointsMosaic::OutputParameters& outputParams );
169 
170  /*!
171  \brief Execute a mosaic of images linket by tie-points.
172  \param outputParams The algorithm execution parameters.
173  \return true if ok, false on errors.
174  */
175  bool executeTiePointsMosaic( TiePointsMosaic::OutputParameters& outputParams );
176 
177  /*!
178  \brief Raster band statistics calcule.
179  \param raster Input raster
180  \param bandIndex Input raster band index.
181  \param forceNoDataValue Force the noDataValue to be used as the band no-data value.
182  \param noDataValue The no-data value to use.
183  \param mean Pixels mean.
184  \param variance Pixels variance.
185  */
186  static void calcBandStatistics( const te::rst::Raster& raster,
187  const unsigned int bandIndex,
188  const bool& forceNoDataValue,
189  const double& noDataValue,
190  double& mean,
191  double& variance );
192 
193  };
194 
195  } // end namespace rp
196 } // end namespace te
197 
198 #endif
199 
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Base exception class for plugin module.
Definition: Exception.h:42
Blended pixel value calculation for two overlaped rasters.
Raster Processing algorithm output parameters base interface.
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
Raster Processing algorithm base interface class.
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
bool m_enableMultiThread
Enable/disable the use of threads (default:true).
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
Raster Processing algorithm base interface.
Definition: Algorithm.h:41
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 ...
TiePointsLinkType m_tiePointsLinkType
The given tie points linking type, see TiePointsLinkType.
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Create a mosaic from a set of rasters using tie-points.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
Feeder from a input rasters.
Definition: FeedersRaster.h:46
std::string m_geomTransfName
The name of the geometric transformation used if tie-points are supplied (see each te::gm::GTFactory ...
Raster Processing algorithm input parameters base interface.
Raster objects feeders.
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).