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 
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 
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 
143 
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 
te::rp::TiePointsMosaic::InputParameters::reset
void reset()
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::TiePointsMosaic::InputParameters::m_geomTransfName
std::string m_geomTransfName
The name of the geometric transformation used if tie-points are supplied (see each te::gm::GTFactory ...
Definition: TiePointsMosaic.h:78
te::rp::TiePointsMosaic::InputParameters::m_autoEqualize
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
Definition: TiePointsMosaic.h:88
te::rp::TiePointsMosaic::InputParameters::m_noDataValue
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
Definition: TiePointsMosaic.h:82
te::rp::TiePointsMosaic::OutputParameters::m_outputRasterPtr
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
Definition: TiePointsMosaic.h:124
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
te::rp::TiePointsMosaic::InputParameters::InputParameters
InputParameters()
te::rp::Algorithm
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
FeedersRaster.h
Raster objects feeders.
te::rp::TiePointsMosaic::InputParameters::InputParameters
InputParameters(const InputParameters &)
te::rp::TiePointsMosaic::InputParameters::~InputParameters
~InputParameters()
te::rp::TiePointsMosaic::InputParameters::m_tiePoints
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 ...
Definition: TiePointsMosaic.h:74
te::rp::TiePointsMosaic::OutputParameters::OutputParameters
OutputParameters()
te::rp::TiePointsMosaic::InputParameters::TiePointsLinkType
TiePointsLinkType
Definition: TiePointsMosaic.h:64
te::rp::TiePointsMosaic::InputParameters
Mosaic input parameters.
Definition: TiePointsMosaic.h:59
te::rst::InterpolationMethod
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
te::rp::TiePointsMosaic::InputParameters::m_enableMultiThread
bool m_enableMultiThread
Enable/disable the use of threads (default:true).
Definition: TiePointsMosaic.h:94
Blender.h
Blended pixel value calculation for two overlaped rasters.
te::rp::TiePointsMosaic
Create a mosaic from a set of rasters using tie-points.
Definition: TiePointsMosaic.h:51
te::rp::TiePointsMosaic::OutputParameters::m_rType
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: TiePointsMosaic.h:120
te::rp::TiePointsMosaic::InputParameters::m_forceInputNoDataValue
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
Definition: TiePointsMosaic.h:84
te::rp::TiePointsMosaic::InputParameters::m_inputRastersBands
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
Definition: TiePointsMosaic.h:72
te::Exception
Base exception class for plugin module.
Definition: Exception.h:42
te::rp::TiePointsMosaic::InputParameters::m_feederRasterPtr
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
Definition: TiePointsMosaic.h:70
te::rp::TiePointsMosaic::InputParameters::m_enableProgress
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: TiePointsMosaic.h:92
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::TiePointsMosaic::OutputParameters
Mosaic output parameters.
Definition: TiePointsMosaic.h:117
te::rp::TiePointsMosaic::OutputParameters::~OutputParameters
~OutputParameters()
te::rp::Blender::BlendMethod
BlendMethod
Definition: Blender.h:66
te::rp::TiePointsMosaic::OutputParameters::reset
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
Algorithm.h
Abstract algorithm.
te::rp::TiePointsMosaic::OutputParameters::OutputParameters
OutputParameters(const OutputParameters &)
te::rp::TiePointsMosaic::InputParameters::m_useRasterCache
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
Definition: TiePointsMosaic.h:90
te::rp::TiePointsMosaic::InputParameters::m_interpMethod
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: TiePointsMosaic.h:80
te::rp::TiePointsMosaic::InputParameters::m_tiePointsLinkType
TiePointsLinkType m_tiePointsLinkType
The given tie points linking type, see TiePointsLinkType.
Definition: TiePointsMosaic.h:76
te::rp::TiePointsMosaic::InputParameters::m_blendMethod
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
Definition: TiePointsMosaic.h:86
te::rp::TiePointsMosaic::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: TiePointsMosaic.h:122