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 
96  bool m_enableAutoValidAreaDetect; //!< Enable/disable the auto-detection of raster valid area pixels (this option allows better mosaic result for rasters with no-data pixels on borders. Default:true).
97 
99 
101 
103 
104  //overload
105  void reset() throw( te::rp::Exception );
106 
107  //overload
108  const InputParameters& operator=( const InputParameters& params );
109 
110  //overload
111  AbstractParameters* clone() const;
112  };
113 
114  /*!
115  \class OutputParameters
116  \brief Mosaic output parameters
117  */
119  {
120  public:
121 
122  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
123 
124  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
125 
126  std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
127 
129 
131 
133 
134  //overload
135  void reset() throw( te::rp::Exception );
136 
137  //overload
138  const OutputParameters& operator=( const OutputParameters& params );
139 
140  //overload
141  AbstractParameters* clone() const;
142  };
143 
145 
147 
148  //overload
149  bool execute( AlgorithmOutputParameters& outputParams ) throw( te::rp::Exception );
150 
151  //overload
152  void reset() throw( te::rp::Exception );
153 
154  //overload
155  bool initialize( const AlgorithmInputParameters& inputParams ) throw( te::rp::Exception );
156 
157  bool isInitialized() const;
158 
159  protected:
160 
161  TiePointsMosaic::InputParameters m_inputParameters; //!< Input execution parameters.
162 
163  bool m_isInitialized; //!< Tells if this instance is initialized.
164 
165  /*!
166  \brief Execute a mosaic of georeferenced images.
167  \param outputParams The algorithm execution parameters.
168  \return true if ok, false on errors.
169  */
170  bool executeGeoMosaic( TiePointsMosaic::OutputParameters& outputParams );
171 
172  /*!
173  \brief Execute a mosaic of images linket by tie-points.
174  \param outputParams The algorithm execution parameters.
175  \return true if ok, false on errors.
176  */
177  bool executeTiePointsMosaic( TiePointsMosaic::OutputParameters& outputParams );
178 
179  /*!
180  \brief Raster band statistics calcule.
181  \param raster Input raster
182  \param bandIndex Input raster band index.
183  \param forceNoDataValue Force the noDataValue to be used as the band no-data value.
184  \param noDataValue The no-data value to use.
185  \param mean Pixels mean.
186  \param variance Pixels variance.
187  */
188  static void calcBandStatistics( const te::rst::Raster& raster,
189  const unsigned int bandIndex,
190  const bool& forceNoDataValue,
191  const double& noDataValue,
192  double& mean,
193  double& variance );
194 
195  };
196 
197  } // end namespace rp
198 } // end namespace te
199 
200 #endif
201 
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_enableAutoValidAreaDetect
bool m_enableAutoValidAreaDetect
Enable/disable the auto-detection of raster valid area pixels (this option allows better mosaic resul...
Definition: TiePointsMosaic.h:96
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:126
te::rp::AlgorithmInputParameters
Raster Processing algorithm input parameters base interface.
Definition: AlgorithmInputParameters.h:40
te::rp::blender::BlendMethod
BlendMethod
Definition: BlenderTypeDefs.h:33
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:122
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:119
te::rp::TiePointsMosaic::OutputParameters::~OutputParameters
~OutputParameters()
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:124