Loading...
Searching...
No Matches
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
40namespace 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() ;
106
107 //overload
109
110 //overload
111 AbstractParameters* clone() const;
112
113 //overload
114 bool serialize ( AlgorithmParametersSerializer& serializer ) const;
115 };
116
117 /*!
118 \class OutputParameters
119 \brief Mosaic output parameters
120 */
122 {
123 public:
124
125 std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
126
127 std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
128
129 std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output mosaic raster.
130
132
134
136
137 //overload
138 void reset() ;
139
140 //overload
142
143 //overload
144 AbstractParameters* clone() const;
145 };
146
148
150
151 //overload
152 bool execute( AlgorithmOutputParameters& outputParams ) ;
153
154 //overload
155 void reset() ;
156
157 //overload
158 bool initialize( const AlgorithmInputParameters& inputParams ) ;
159
160 bool isInitialized() const;
161
162 protected:
163
164 TiePointsMosaic::InputParameters m_inputParameters; //!< Input execution parameters.
165
166 bool m_isInitialized; //!< Tells if this instance is initialized.
167
168 /*!
169 \brief Execute a mosaic of georeferenced images.
170 \param outputParams The algorithm execution parameters.
171 \return true if ok, false on errors.
172 */
174
175 /*!
176 \brief Execute a mosaic of images linket by tie-points.
177 \param outputParams The algorithm execution parameters.
178 \return true if ok, false on errors.
179 */
181
182 /*!
183 \brief Raster band statistics calcule.
184 \param raster Input raster
185 \param bandIndex Input raster band index.
186 \param forceNoDataValue Force the noDataValue to be used as the band no-data value.
187 \param noDataValue The no-data value to use.
188 \param mean Pixels mean.
189 \param variance Pixels variance.
190 \return true if ok, false on errors.
191 */
193 const unsigned int bandIndex,
194 const bool& forceNoDataValue,
195 const double& noDataValue,
196 double& mean,
197 double& variance );
198
199 };
200
201 } // end namespace rp
202} // end namespace te
203
204#endif
205
Blended pixel value calculation for two overlaped rasters.
Raster objects feeders.
Raster Processing algorithm input parameters base interface.
Raster Processing algorithm output parameters base interface.
A class to standardize algorithm parameters serialization.
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
Feeder from a input rasters.
Definition: FeedersRaster.h:47
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 ...
bool m_autoEqualize
Auto equalization will be performed using the overlaped image areas (default:true).
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
bool m_useRasterCache
Enable(true) or disable the use of raster caching (default:true).
bool m_forceInputNoDataValue
If true, m_noDataValue will be used as the no-data value for input rasters (defalt:false).
TiePointsLinkType m_tiePointsLinkType
The given tie points linking type, see TiePointsLinkType.
InputParameters(const InputParameters &)
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
bool m_enableProgress
Enable/Disable the progress interface (default:false).
std::vector< std::vector< unsigned int > > m_inputRastersBands
Bands to process for each input raster.
bool m_enableAutoValidAreaDetect
Enable/disable the auto-detection of raster valid area pixels (this option allows better mosaic resul...
FeederConstRaster * m_feederRasterPtr
Input rasters feeder.
double m_noDataValue
The pixel value used where no raster data is avaliable (defaul:0).
te::rp::Blender::BlendMethod m_blendMethod
The pixel blending method (default: NoBlendMethod).
const InputParameters & operator=(const InputParameters &params)
AbstractParameters * clone() const
Create a clone copy of this instance.
bool serialize(AlgorithmParametersSerializer &serializer) const
Returns a parameter serialization object.
std::string m_geomTransfName
The name of the geometric transformation used if tie-points are supplied (see each te::gm::GTFactory ...
bool m_enableMultiThread
Enable/disable the use of threads (default:true).
const OutputParameters & operator=(const OutputParameters &params)
OutputParameters(const OutputParameters &)
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
AbstractParameters * clone() const
Create a clone copy of this instance.
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output mosaic raster.
Create a mosaic from a set of rasters using tie-points.
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state.
bool executeTiePointsMosaic(TiePointsMosaic::OutputParameters &outputParams)
Execute a mosaic of images linket by tie-points.
bool executeGeoMosaic(TiePointsMosaic::OutputParameters &outputParams)
Execute a mosaic of georeferenced images.
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
bool calcBandStatistics(const te::rst::Raster &raster, const unsigned int bandIndex, const bool &forceNoDataValue, const double &noDataValue, double &mean, double &variance)
Raster band statistics calcule.
bool m_isInitialized
Tells if this instance is initialized.
TiePointsMosaic::InputParameters m_inputParameters
Input execution parameters.
An abstract class for raster data strucutures.
Definition: Raster.h:72
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Abstract algorithm.