Loading...
Searching...
No Matches
Blender.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/Blender.h
22 \brief Blended pixel value calculation for two overlaped rasters.
23 */
24
25#ifndef __TERRALIB_RP_INTERNAL_BLENDER_H
26#define __TERRALIB_RP_INTERNAL_BLENDER_H
27
28#include "Config.h"
29#include "Macros.h"
30#include "BlenderRule.h"
31#include "../raster/Grid.h"
32#include "../raster/Raster.h"
33#include "../raster/Interpolator.h"
34#include "../raster/RasterSynchronizer.h"
35#include "../raster/TileIndexer.h"
36#include "../geometry/Polygon.h"
37#include "../geometry/MultiPolygon.h"
38#include "../geometry/Point.h"
39#include "../geometry/GeometricTransformation.h"
40
41#include <boost/noncopyable.hpp>
42#include <boost/ptr_container/ptr_vector.hpp>
43
44#include <vector>
45#include <complex>
46#include <memory>
47#include <thread>
48
49namespace te
50{
51 namespace rp
52 {
53 /*!
54 \class Blender
55 \brief Blended pixel value calculation for two overlaped rasters.
56 \details The overlap between the two images is modeled by the given geometric transformation direct mapping input raster 1 indexed coords (line, column) to input raster 2 indexed coords.
57 \note Optimized for rasters where all bands have the same blocking scheme.
58 \ingroup rp_aux
59 */
60 class TERPEXPORT Blender : public boost::noncopyable
61 {
62 public:
63
64 /*!
65 \typedef BlendMethod te::rp::Blender class pixel blend methods.
66 */
68
69 /*! Default constructor. */
71
72 /*! Default destructor. */
74
75 /*!
76 \brief Inititate the blender instance.
77 \param raster1 Input raster 1.
78 \param raster1Bands Input raster 1 band indexes to use.
79 \param raster2 Input raster 2.
80 \param raster2Bands Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
81 \param blendMethod The blend method to apply.
82 \param interpMethod1 The interpolation method to use when reading raster 1 data.
83 \param interpMethod2 The interpolation method to use when reading raster 2 data.
84 \param noDataValue The value returned where there is no pixel data bo blend.
85 \param forceRaster1NoDataValue Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
86 \param forceRaster2NoDataValue Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
87 \param pixelOffsets1 The values offset to be applied to raster 1 pixel values before the blended value calcule (one element for each used raster channel/band).
88 \param pixelScales1 The values scale to be applied to raster 1 pixel values before the blended value calcule (one element for each used raster channel/band).
89 \param pixelOffsets2 The values offset to be applied to raster 2 pixel values before the blended value calcule (one element for each used raster channel/band).
90 \param pixelScales2 The values scale to be applied to raster 2 pixel values before the blended value calcule (one element for each used raster channel/band).
91 \param r1ValidDataDelimiterPtr A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid data, or null if all raster data area is valid.
92 \param r2ValidDataDelimiterPtr A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid data, or null if all raster data area is valid.
93 \param geomTransformation A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels ( te::gm::GTParameters::TiePoint::second ) (Note: all coords are indexed by lines/columns).
94 \param threadsNumber Enable/disable the use of threads when applicable (0:automatic , 1:disabled, any other integer dictates the number of threads).
95 \param enableProgressInterface Enable/disable the use of a progress interface when applicable.
96 \param rulePtr A pointer to a valid blender rule (this implies using RulesMethod on the blendMethod parameter) or a null pointer.
97 \param enableRasterCache Enable/disable the use of raster cache.
98 \return true if ok, false on errors
99 \note Aboute scale and offset parametrs: outValue = ( inputValue * scale ) + offset
100 */
102 te::rst::Raster& raster1,
103 const std::vector< unsigned int >& raster1Bands,
104 const te::rst::Raster& raster2,
105 const std::vector< unsigned int >& raster2Bands,
106 const BlendMethod& blendMethod,
107 const te::rst::Interpolator::Method& interpMethod1,
108 const te::rst::Interpolator::Method& interpMethod2,
109 const double& noDataValue,
110 const bool forceRaster1NoDataValue,
111 const bool forceRaster2NoDataValue,
112 const std::vector< double >& pixelOffsets1,
113 const std::vector< double >& pixelScales1,
114 const std::vector< double >& pixelOffsets2,
115 const std::vector< double >& pixelScales2,
116 te::gm::MultiPolygon const * const r1ValidDataDelimiterPtr,
117 te::gm::MultiPolygon const * const r2ValidDataDelimiterPtr,
118 const te::gm::GeometricTransformation& geomTransformation,
119 const unsigned int threadsNumber,
120 const bool enableProgressInterface,
121 BlenderRule const * const rulePtr,
122 const bool enableRasterCache );
123
124
125 /*!
126 \brief Blend a pixel value using the current parameters.
127 \param line Line (raster 1 reference).
128 \param col Column (raster 1 reference).
129 \param values A pointer to a pre-allocated vector where the blended values will be stored.
130 \note The caller of this method must be aware that the returned blended value may be outside the original input rasters valid values range.
131 \note Raster 1 values have precedence over raster 2 values (when applicable).
132 */
133 inline void getBlendedValues( const double& line, const double& col,
134 double* const values )
135 {
136 TERP_DEBUG_TRUE_OR_THROW( m_primaryBlendFuncPtr, "Invalid blend function pointer" );
137 (this->*m_primaryBlendFuncPtr)( line, col, values );
138 };
139
140 /*!
141 \brief Execute blending of the given input rasters and write the result into raster1.
142 \note Raster 1 values have precedence over raster 2 values (when applicable).
143 */
145
146 /*!
147 \brief Return the current error message if there is any.
148
149 \return Return the current error message if there is any.
150 */
151 const std::string& getErrorMessage() const;
152
153 protected:
154
155 /*!
156 \brief Type definition for the a primary bleding function pointer.
157 \param line Raster 1 Line.
158 \param col Raster 1 Column.
159 \param values A pointer to a pre-allocated vector where the blended values will be stored.
160 \note The caller of this method must be aware that the returned blended value may be outside the original input rasters valid values range.
161 \note Raster 1 values have precedence over raster 2 values (when applicable).
162 */
163 typedef void (Blender::*PrimaryBlendFunctPtr)( const double& line,
164 const double& col, double* const values );
165
166 /*!
167 \brief Raster block info
168 */
170 {
172 unsigned int m_blkX;
173 unsigned int m_blkY;
179 };
180
181 /*!
182 \brief The parameters passed to blendIntoRaster1Thread method.
183 */
185 {
186 public :
187
188 bool* m_returnValuePtr; //!< A pointer to the threadreturn value.
189 bool* m_abortValuePtr; //!< A pointer to the abort execution value.
190 te::rst::RasterSynchronizer* m_sync1Ptr; //!< Raster 1 syncronizer pointer.
191 te::rst::RasterSynchronizer* m_sync2Ptr; //!< Raster 1 syncronizer pointer.
192 std::vector< RasterBlockInfo >* m_raster1BlocksInfosPtr; //!< blocks to process.
193 std::mutex* m_mutexPtr; //!< mutex pointer.
194 std::mutex* m_blockProcessedSignalMutexPtr; //!< Mutex used to update the main process progress update.
195 std::condition_variable* m_blockProcessedSignalPtr; //!< Signal used to update the main process progress update.
196 unsigned int* m_runningThreadsCounterPtr; //!< a pointer to the running threads counter.
197 std::vector< unsigned int > const* m_raster1BandsPtr; //!< Input raster 1 band indexes to use.
198 std::vector< unsigned int > const* m_raster2BandsPtr; //!< Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
199 BlendMethod m_blendMethod; //!< The blend method to apply.
200 te::rst::Interpolator::Method m_interpMethod2; //!< The interpolation method to use when reading raster 2 data.
201 double m_noDataValue; //!< The value returned where there is no pixel data bo blend.
202 bool m_forceRaster1NoDataValue; //!< Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignored)
203 bool m_forceRaster2NoDataValue; //!< Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignored)
204 std::vector< double > const* m_pixelOffsets1Ptr; //!< The values offset to be applied to raster 1 pixel values before the blended value calcule (one element for each used raster channel/band).
205 std::vector< double > const* m_pixelScales1Ptr; //!< The values scale to be applied to raster 1 pixel values before the blended value calcule (one element for each used raster channel/band).
206 std::vector< double > const* m_pixelOffsets2Ptr; //!< The values offset to be applied to raster 2 pixel values before the blended value calcule (one element for each used raster channel/band).
207 std::vector< double > const* m_pixelScales2Ptr; //!< The values scale to be applied to raster 2 pixel values before the blended value calcule (one element for each used raster channel/band).
208 te::gm::MultiPolygon const* m_r1ValidDataDelimiterPtr; //!< A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid data, or null if all raster data area is valid.
209 te::gm::MultiPolygon const* m_r2ValidDataDelimiterPtr; //!< A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid data, or null if all raster data area is valid.
210 te::gm::GeometricTransformation const* m_geomTransformationPtr; //!< A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels ( te::gm::GTParameters::TiePoint::second ) (Note: all coords are indexed by lines/columns).
211 unsigned long int m_maxRasterCachedBlocks; //!< The maximum number of raster cache blocks.
212 bool m_useProgress; //!< If enabled each thread will use its own progress interface, if false only a signal will be emitted on each processed block.
213 BlenderRule const * m_rulePtr; // a pointer to a rula to be used or a null pointer.
215
217
219
220 protected :
221
223
225 };
226
227 bool m_enableProgressInterface; //!< Enable progress interface.
228 bool m_forceRaster1NoDataValue; //!< Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
229 bool m_forceRaster2NoDataValue; //!< Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be ignored)
230 unsigned int m_threadsNumber; //!< The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of threads)..
231 BlendMethod m_blendMethod; //!< The blend method to apply.
232 PrimaryBlendFunctPtr m_primaryBlendFuncPtr; //!< The primary blend function.
233 te::rst::Raster * m_raster1Ptr; //!< Input raster 1.
234 te::rst::Raster const * m_raster2Ptr; //!< Input raster 2.
235 std::unique_ptr< te::gm::MultiPolygon > m_r1ValidDataDelimiterPtr; //!< A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid data, or null if all raster data area is valid.
236 std::unique_ptr< te::gm::MultiPolygon > m_r2ValidDataDelimiterPtr; //!< A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid data, or null if all raster data area is valid.
237 std::unique_ptr< te::gm::Geometry > m_intersectionPtr; //!< The Intersection geometry ( raster 1 indexed coods).
238 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > m_r1IntersectionSegmentsPoints; //!< A sub-set of the intersection polygon wich is part of raster 1 valid data polygon ( raster 1 indexed coods).
239 std::size_t m_r1IntersectionSegmentsPointsSize; //!< Size of m_r1IntersectionSegmentsPoints;
240 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > m_r2IntersectionSegmentsPoints; //!< A sub-set of the intersection polygon wich is part of raster 2 valid data polygon ( raster 1 indexed coods).
241 std::size_t m_r2IntersectionSegmentsPointsSize; //!< Size of m_r2IntersectionSegmentsPoints;
242 te::gm::GeometricTransformation* m_geomTransformationPtr; //!< A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 ( te::gm::GTParameters::TiePoint::second ) (Note: all coords are indexed by lines/columns).
243 te::rst::Interpolator::Method m_interpMethod1; //!< The interpolation method to use when reading raster 1 data.
244 te::rst::Interpolator::Method m_interpMethod2; //!< The interpolation method to use when reading raster 2 data.
245 double m_outputNoDataValue; //!< The output raster no-data value.
246 std::unique_ptr< te::rst::Interpolator > m_interp1Ptr; //!< Raster 1 interpolator instance pointer.
247 std::unique_ptr< te::rst::Interpolator > m_interp2Ptr; //!< Raster 2 interpolator instance pointer.
248 std::vector< unsigned int > m_raster1Bands; //!< Input raster 1 band indexes to use.
249 std::vector< unsigned int > m_raster2Bands; //!< Input raster 2 band indexes to use.
250 unsigned int m_raster1BandsSize;
251 unsigned int m_raster2BandsSize;
252 std::vector< double > m_pixelOffsets1; //!< The values offset to be applied to raster 1 pixel values before the blended value calcule (one element for each used raster channel/band).
253 std::vector< double > m_pixelScales1; //!< The values scale to be applied to raster 1 pixel values before the blended value calcule (one element for each used raster channel/band).
254 std::vector< double > m_pixelOffsets2; //!< The values offset to be applied to raster 2 pixel values before the blended value calcule (one element for each used raster channel/band).
255 std::vector< double > m_pixelScales2; //!< The values scale to be applied to raster 2 pixel values before the blended value calcule (one element for each used raster channel/band).
256 std::vector< double > m_raster1NoDataValues; //!< Raster 1 no-data values (on value per band).
257 std::vector< double > m_raster2NoDataValues; //!< Raster 2 no-data values (on value per band).
258 boost::ptr_vector< te::rst::TileIndexer > m_intersectionTileIndexers; //!< The Intersection geometry tile indexers( raster 1 indexed coods), one indexer for each intersection polygon.
259 std::unique_ptr< BlenderRule > m_rulePtr; //!< Blender rule pointer.
260 std::string m_errorMessage; //!< Current error message.
261 bool m_enableRasterCache; //!< enable/disable the use of raster cache.
262
263 // variables used by the noBlendMethodImp method
270 std::complex< double > m_noBlendMethodImp_cValue;
275 std::vector< std::complex< double > > m_noBlendMethodImp_pixel1Values;
276 std::vector< std::complex< double > > m_noBlendMethodImp_pixel2Values;
277
278 // variables used by the euclideanDistanceMethodImp method
295 std::vector< std::complex< double > > m_euclideanDistanceMethodImp_pixel1Values;
296 std::vector< std::complex< double > > m_euclideanDistanceMethodImp_pixel2Values;
297
298 // variables used by the sumMethodImp method
302 std::complex< double > m_sumMethodImp_cValue1;
303 std::complex< double > m_sumMethodImp_cValue2;
307
308 // variables used by the maxMethodImp method
312 std::complex< double > m_maxMethodImp_cValue1;
313 std::complex< double > m_maxMethodImp_cValue2;
317
318 // variables used by the minMethodImp method
322 std::complex< double > m_minMethodImp_cValue1;
323 std::complex< double > m_minMethodImp_cValue2;
327
328 // variables used by the ruleMethodImp method
331
332 /*! \brief Reset the instance to its initial default state. */
333 void initState();
334
335 /*! \brief Clear all internal allocated resources. */
336 void clear();
337
338 /*! \brief Set the value of m_blendFuncPtr following the given blend method. */
339 void setBlendFunctionsPonters( const BlendMethod blendMethod );
340
341 /*!
342 \brief Implementation for NoBlendMethod.
343 \param line Raster 1 Line.
344 \param col Raster 1 Column.
345 \param values A pointer to a pre-allocated vector where the blended values will be stored.
346 */
347 void noBlendMethodImp( const double& line1, const double& col1,
348 double* const values );
349
350 /*!
351 \brief Implementation for EuclideanDistanceMethod.
352 \param line Raster 1 Line.
353 \param col Raster 1 Column.
354 \param values A pointer to a pre-allocated vector where the blended values will be stored.
355 */
356 void euclideanDistanceMethodImp( const double& line1, const double& col1,
357 double* const values );
358
359 /*!
360 \brief Implementation for SumMethod.
361 \param line Raster 1 Line.
362 \param col Raster 1 Column.
363 \param values A pointer to a pre-allocated vector where the blended values will be stored.
364 */
365 void sumMethodImp( const double& line1, const double& col1,
366 double* const values );
367
368 /*!
369 \brief Implementation for MaxMethod.
370 \param line Raster 1 Line.
371 \param col Raster 1 Column.
372 \param values A pointer to a pre-allocated vector where the blended values will be stored.
373 */
374 void maxMethodImp( const double& line1, const double& col1,
375 double* const values );
376
377 /*!
378 \brief Implementation for MinMethod.
379 \param line Raster 1 Line.
380 \param col Raster 1 Column.
381 \param values A pointer to a pre-allocated vector where the blended values will be stored.
382 */
383 void minMethodImp( const double& line1, const double& col1,
384 double* const values );
385
386 /*!
387 \brief Rule based Implementation.
388 \param line Raster 1 Line.
389 \param col Raster 1 Column.
390 \param values A pointer to a pre-allocated vector where the blended values will be stored.
391 */
392 void ruleMethodImp( const double& line1, const double& col1,
393 double* const values );
394
395 /*!
396 \brief Thread entry for the method blendIntoRaster1.
397
398 */
400
401 /*!
402 \brief Extract segments from the given geometry.
403 \param geometryPtr Input geometry.
404 \param segments Found segments (appended here).
405 \note The only supported geometry types are those composed by te::gm::LineString or te::gm::CircularString (for other types no segments will be returned).
406 */
407 void getSegments( te::gm::Geometry const * const geometryPtr,
408 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > >& segments ) const;
409
410
411 /*!
412 \brief Creater polygon tile indexers from the given geometry (only if it is a polygon or a collection of polygons).
413 \param geometryPtr Input geometry.
414 \param tileIndexers Created indexers (appended here).
415 \return true if OK, false on errors.
416 \note No indexers will be returned for geometries other than polygons or collections of polygons.
417 */
418 bool getTileIndexers( te::gm::Geometry const * const geometryPtr,
419 boost::ptr_vector< te::rst::TileIndexer >& tileIndexers ) const;
420
421 /*!
422 \brief Set the current error message.
423
424 \param newErrorMessage New error message;
425 */
426 void setErrorMessage( const std::string& newErrorMessage );
427 };
428
429 } // end namespace rp
430} // end namespace te
431
432#endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
433
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
Definition: Macros.h:445
2D Geometric transformation base class.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:51
A point with x and y coordinate values.
Definition: Point.h:51
The parameters passed to blendIntoRaster1Thread method.
Definition: Blender.h:185
bool m_forceRaster1NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
Definition: Blender.h:202
bool m_forceRaster2NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
Definition: Blender.h:203
te::rst::RasterSynchronizer * m_sync2Ptr
Raster 1 syncronizer pointer.
Definition: Blender.h:191
te::gm::GeometricTransformation const * m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels...
Definition: Blender.h:210
std::vector< unsigned int > const * m_raster1BandsPtr
Input raster 1 band indexes to use.
Definition: Blender.h:197
std::vector< double > const * m_pixelOffsets1Ptr
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
Definition: Blender.h:204
te::rst::RasterSynchronizer * m_sync1Ptr
Raster 1 syncronizer pointer.
Definition: Blender.h:190
double m_noDataValue
The value returned where there is no pixel data bo blend.
Definition: Blender.h:201
te::gm::MultiPolygon const * m_r1ValidDataDelimiterPtr
A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid dat...
Definition: Blender.h:208
BlendMethod m_blendMethod
The blend method to apply.
Definition: Blender.h:199
std::vector< double > const * m_pixelScales2Ptr
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
Definition: Blender.h:207
std::vector< unsigned int > const * m_raster2BandsPtr
Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
Definition: Blender.h:198
unsigned long int m_maxRasterCachedBlocks
The maximum number of raster cache blocks.
Definition: Blender.h:211
bool m_useProgress
If enabled each thread will use its own progress interface, if false only a signal will be emitted on...
Definition: Blender.h:212
std::mutex * m_blockProcessedSignalMutexPtr
Mutex used to update the main process progress update.
Definition: Blender.h:194
unsigned int * m_runningThreadsCounterPtr
a pointer to the running threads counter.
Definition: Blender.h:196
te::gm::MultiPolygon const * m_r2ValidDataDelimiterPtr
A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid dat...
Definition: Blender.h:209
std::mutex * m_mutexPtr
mutex pointer.
Definition: Blender.h:193
std::condition_variable * m_blockProcessedSignalPtr
Signal used to update the main process progress update.
Definition: Blender.h:195
BlendIntoRaster1ThreadParams(const BlendIntoRaster1ThreadParams &)
Definition: Blender.h:222
std::vector< RasterBlockInfo > * m_raster1BlocksInfosPtr
blocks to process.
Definition: Blender.h:192
std::vector< double > const * m_pixelOffsets2Ptr
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
Definition: Blender.h:206
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
Definition: Blender.h:200
bool * m_returnValuePtr
A pointer to the threadreturn value.
Definition: Blender.h:188
std::vector< double > const * m_pixelScales1Ptr
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
Definition: Blender.h:205
BlendIntoRaster1ThreadParams & operator=(const BlendIntoRaster1ThreadParams &)
Definition: Blender.h:224
bool * m_abortValuePtr
A pointer to the abort execution value.
Definition: Blender.h:189
Blended pixel value calculation for two overlaped rasters.
Definition: Blender.h:61
bool m_forceRaster1NoDataValue
Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be igno...
Definition: Blender.h:228
std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > m_r1IntersectionSegmentsPoints
A sub-set of the intersection polygon wich is part of raster 1 valid data polygon ( raster 1 indexed ...
Definition: Blender.h:238
double m_maxMethodImp_Point2Line
Definition: Blender.h:310
unsigned int m_sumMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:305
std::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
Definition: Blender.h:252
bool m_euclideanDistanceMethodImp_PointInsideIntersection
Definition: Blender.h:292
double m_euclideanDistanceMethodImp_Point2Col
Definition: Blender.h:281
std::complex< double > m_noBlendMethodImp_cValue
Definition: Blender.h:270
bool m_euclideanDistanceMethodImp_pixel1IsValid
Definition: Blender.h:293
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use.
Definition: Blender.h:249
double m_noBlendMethodImp_Point2Col
Definition: Blender.h:269
te::gm::Point m_euclideanDistanceMethodImp_auxPoint
Definition: Blender.h:279
void setErrorMessage(const std::string &newErrorMessage)
Set the current error message.
void ruleMethodImp(const double &line1, const double &col1, double *const values)
Rule based Implementation.
PrimaryBlendFunctPtr m_primaryBlendFuncPtr
The primary blend function.
Definition: Blender.h:232
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
Definition: Blender.h:244
std::vector< double > m_pixelOffsets2
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
Definition: Blender.h:254
double m_ruleMethodImp_Point2Line
Definition: Blender.h:329
std::vector< std::complex< double > > m_noBlendMethodImp_pixel1Values
Definition: Blender.h:275
void noBlendMethodImp(const double &line1, const double &col1, double *const values)
Implementation for NoBlendMethod.
void setBlendFunctionsPonters(const BlendMethod blendMethod)
Set the value of m_blendFuncPtr following the given blend method.
std::vector< std::complex< double > > m_noBlendMethodImp_pixel2Values
Definition: Blender.h:276
unsigned int m_raster1BandsSize
Definition: Blender.h:250
bool m_noBlendMethodImp_pixel2IsValid
Definition: Blender.h:274
double m_euclideanDistanceMethodImp_aux1
Definition: Blender.h:289
double m_noBlendMethodImp_Point1YProj2
Definition: Blender.h:267
std::complex< double > m_maxMethodImp_cValue1
Definition: Blender.h:312
std::unique_ptr< te::rst::Interpolator > m_interp1Ptr
Raster 1 interpolator instance pointer.
Definition: Blender.h:246
const std::string & getErrorMessage() const
Return the current error message if there is any.
te::gm::GeometricTransformation * m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 ( te::...
Definition: Blender.h:242
unsigned int m_threadsNumber
The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of thre...
Definition: Blender.h:230
std::vector< std::complex< double > > m_euclideanDistanceMethodImp_pixel2Values
Definition: Blender.h:296
void maxMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MaxMethod.
bool m_sumMethodImp_PointInsideIntersection
Definition: Blender.h:306
double m_euclideanDistanceMethodImp_dist2
Definition: Blender.h:287
double m_euclideanDistanceMethodImp_Point2Line
Definition: Blender.h:280
std::unique_ptr< te::gm::MultiPolygon > m_r2ValidDataDelimiterPtr
A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid dat...
Definition: Blender.h:236
bool m_euclideanDistanceMethodImp_pixel2IsValid
Definition: Blender.h:294
te::rst::Raster * m_raster1Ptr
Input raster 1.
Definition: Blender.h:233
unsigned int m_minMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:325
double m_noBlendMethodImp_Value
Definition: Blender.h:271
te::rst::Interpolator::Method m_interpMethod1
The interpolation method to use when reading raster 1 data.
Definition: Blender.h:243
bool m_minMethodImp_PointInsideIntersection
Definition: Blender.h:326
void getBlendedValues(const double &line, const double &col, double *const values)
Blend a pixel value using the current parameters.
Definition: Blender.h:133
std::vector< std::complex< double > > m_euclideanDistanceMethodImp_pixel1Values
Definition: Blender.h:295
std::size_t m_r1IntersectionSegmentsPointsSize
Size of m_r1IntersectionSegmentsPoints;.
Definition: Blender.h:239
std::complex< double > m_minMethodImp_cValue1
Definition: Blender.h:322
void euclideanDistanceMethodImp(const double &line1, const double &col1, double *const values)
Implementation for EuclideanDistanceMethod.
boost::ptr_vector< te::rst::TileIndexer > m_intersectionTileIndexers
The Intersection geometry tile indexers( raster 1 indexed coods), one indexer for each intersection p...
Definition: Blender.h:258
bool blendIntoRaster1()
Execute blending of the given input rasters and write the result into raster1.
double m_minMethodImp_Point2Col
Definition: Blender.h:321
std::complex< double > m_maxMethodImp_cValue2
Definition: Blender.h:313
std::unique_ptr< te::rst::Interpolator > m_interp2Ptr
Raster 2 interpolator instance pointer.
Definition: Blender.h:247
double m_noBlendMethodImp_Point1YProj1
Definition: Blender.h:265
double m_sumMethodImp_Point2Col
Definition: Blender.h:301
double m_sumMethodImp_Point2Line
Definition: Blender.h:300
BlendMethod m_blendMethod
The blend method to apply.
Definition: Blender.h:231
std::string m_errorMessage
Current error message.
Definition: Blender.h:260
double m_noBlendMethodImp_Point2Line
Definition: Blender.h:268
std::vector< double > m_pixelScales2
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
Definition: Blender.h:255
std::complex< double > m_minMethodImp_cValue2
Definition: Blender.h:323
te::rst::Raster const * m_raster2Ptr
Input raster 2.
Definition: Blender.h:234
double m_maxMethodImp_Point2Col
Definition: Blender.h:311
void initState()
Reset the instance to its initial default state.
te::gm::Point m_minMethodImp_auxPoint
Definition: Blender.h:319
std::complex< double > m_euclideanDistanceMethodImp_cValue1
Definition: Blender.h:282
te::rp::blender::BlendMethod BlendMethod
Definition: Blender.h:67
void minMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MinMethod.
std::vector< double > m_raster1NoDataValues
Raster 1 no-data values (on value per band).
Definition: Blender.h:256
unsigned int m_sumMethodImp_BandIdx
Definition: Blender.h:304
bool initialize(te::rst::Raster &raster1, const std::vector< unsigned int > &raster1Bands, const te::rst::Raster &raster2, const std::vector< unsigned int > &raster2Bands, const BlendMethod &blendMethod, const te::rst::Interpolator::Method &interpMethod1, const te::rst::Interpolator::Method &interpMethod2, const double &noDataValue, const bool forceRaster1NoDataValue, const bool forceRaster2NoDataValue, const std::vector< double > &pixelOffsets1, const std::vector< double > &pixelScales1, const std::vector< double > &pixelOffsets2, const std::vector< double > &pixelScales2, te::gm::MultiPolygon const *const r1ValidDataDelimiterPtr, te::gm::MultiPolygon const *const r2ValidDataDelimiterPtr, const te::gm::GeometricTransformation &geomTransformation, const unsigned int threadsNumber, const bool enableProgressInterface, BlenderRule const *const rulePtr, const bool enableRasterCache)
Inititate the blender instance.
double m_euclideanDistanceMethodImp_dist1
Definition: Blender.h:286
double m_outputNoDataValue
The output raster no-data value.
Definition: Blender.h:245
unsigned int m_euclideanDistanceMethodImp_BandIdx
Definition: Blender.h:284
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
Definition: Blender.h:253
void sumMethodImp(const double &line1, const double &col1, double *const values)
Implementation for SumMethod.
std::unique_ptr< te::gm::MultiPolygon > m_r1ValidDataDelimiterPtr
A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid dat...
Definition: Blender.h:235
unsigned int m_maxMethodImp_BandIdx
Definition: Blender.h:314
double m_noBlendMethodImp_Point1XProj1
Definition: Blender.h:264
std::unique_ptr< te::gm::Geometry > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
Definition: Blender.h:237
std::complex< double > m_euclideanDistanceMethodImp_cValue2
Definition: Blender.h:283
std::size_t m_euclideanDistanceMethodImp_vecIdx
Definition: Blender.h:288
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
double m_ruleMethodImp_Point2Col
Definition: Blender.h:330
std::unique_ptr< BlenderRule > m_rulePtr
Blender rule pointer.
Definition: Blender.h:259
unsigned int m_noBlendMethodImp_BandIdx
Definition: Blender.h:272
bool m_forceRaster2NoDataValue
Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be igno...
Definition: Blender.h:229
std::complex< double > m_sumMethodImp_cValue1
Definition: Blender.h:302
double m_euclideanDistanceMethodImp_aux2
Definition: Blender.h:290
unsigned int m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:291
te::gm::Point m_maxMethodImp_auxPoint
Definition: Blender.h:309
bool m_maxMethodImp_PointInsideIntersection
Definition: Blender.h:316
double m_euclideanDistanceMethodImp_currDist
Definition: Blender.h:285
unsigned int m_minMethodImp_BandIdx
Definition: Blender.h:324
unsigned int m_raster2BandsSize
Definition: Blender.h:251
bool m_enableRasterCache
enable/disable the use of raster cache.
Definition: Blender.h:261
bool m_enableProgressInterface
Enable progress interface.
Definition: Blender.h:227
std::size_t m_r2IntersectionSegmentsPointsSize
Size of m_r2IntersectionSegmentsPoints;.
Definition: Blender.h:241
void clear()
Clear all internal allocated resources.
bool m_noBlendMethodImp_pixel1IsValid
Definition: Blender.h:273
bool getTileIndexers(te::gm::Geometry const *const geometryPtr, boost::ptr_vector< te::rst::TileIndexer > &tileIndexers) const
Creater polygon tile indexers from the given geometry (only if it is a polygon or a collection of pol...
std::complex< double > m_sumMethodImp_cValue2
Definition: Blender.h:303
double m_noBlendMethodImp_Point1XProj2
Definition: Blender.h:266
std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > m_r2IntersectionSegmentsPoints
A sub-set of the intersection polygon wich is part of raster 2 valid data polygon ( raster 1 indexed ...
Definition: Blender.h:240
double m_minMethodImp_Point2Line
Definition: Blender.h:320
te::gm::Point m_sumMethodImp_auxPoint
Definition: Blender.h:299
void getSegments(te::gm::Geometry const *const geometryPtr, std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > > &segments) const
Extract segments from the given geometry.
unsigned int m_maxMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:315
std::vector< double > m_raster2NoDataValues
Raster 2 no-data values (on value per band).
Definition: Blender.h:257
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
Definition: Blender.h:248
An access synchronizer to be used in SynchronizedRaster raster instances.
An abstract class for raster data strucutures.
Definition: Raster.h:72
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
TerraLib.
Raster block info.
Definition: Blender.h:170
unsigned int m_firstRasterCol2Process
Definition: Blender.h:177
unsigned int m_rasterRows2ProcessBound
Definition: Blender.h:176
unsigned int m_blkTotalPixelsNumber
Definition: Blender.h:174
unsigned int m_rasterCols2ProcessBound
Definition: Blender.h:178
unsigned int m_firstRasterRow2Process
Definition: Blender.h:175
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Proxy configuration file for TerraView (see terraview_config.h).