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 "../raster/Grid.h"
31 #include "../raster/Raster.h"
32 #include "../raster/Interpolator.h"
33 #include "../raster/RasterSynchronizer.h"
34 #include "../raster/TileIndexer.h"
35 #include "../geometry/Polygon.h"
36 #include "../geometry/MultiPolygon.h"
37 #include "../geometry/Point.h"
38 #include "../geometry/GeometricTransformation.h"
39 
40 #include <boost/noncopyable.hpp>
41 #include <boost/ptr_container/ptr_vector.hpp>
42 #include <boost/thread/mutex.hpp>
43 #include <boost/thread/condition_variable.hpp>
44 
45 #include <vector>
46 #include <complex>
47 #include <memory>
48 
49 namespace 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  /*! \enum BlendMethod Pixel Blend methods. */
66  {
67  InvalidBlendMethod, //!< Invalid blending method.
68  NoBlendMethod, //!< No blending performed.
69  EuclideanDistanceMethod, //!< Euclidean distance method.
70  SumMethod, //!< Pixels will be summed inside the raster overlapped area.
71  MaxMethod, //!< Keep the maximum value of two overlapping pixels.
72  MinMethod //!< Keep the minimum value of two overlapping pixels.
73  };
74 
75  /*! Default constructor. */
77 
78  /*! Default destructor. */
80 
81  /*!
82  \brief Inititate the blender instance.
83  \param raster1 Input raster 1.
84  \param raster1Bands Input raster 1 band indexes to use.
85  \param raster2 Input raster 2.
86  \param raster2Bands Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
87  \param blendMethod The blend method to apply.
88  \param interpMethod1 The interpolation method to use when reading raster 1 data.
89  \param interpMethod2 The interpolation method to use when reading raster 2 data.
90  \param noDataValue The value returned where there is no pixel data bo blend.
91  \param forceRaster1NoDataValue Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
92  \param forceRaster2NoDataValue Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
93  \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).
94  \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).
95  \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).
96  \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).
97  \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.
98  \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.
99  \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).
100  \param threadsNumber Enable/disable the use of threads when applicable (0:automatic , 1:disabled, any other integer dictates the number of threads).
101  \param enableProgressInterface Enable/disable the use of a progress interface when applicable.
102  \return true if ok, false on errors
103  \note Aboute scale and offset parametrs: outValue = ( ( inputValue + offsetA ) * scale ) + offsetB
104  */
105  bool initialize(
106  te::rst::Raster& raster1,
107  const std::vector< unsigned int >& raster1Bands,
108  const te::rst::Raster& raster2,
109  const std::vector< unsigned int >& raster2Bands,
110  const BlendMethod& blendMethod,
111  const te::rst::Interpolator::Method& interpMethod1,
112  const te::rst::Interpolator::Method& interpMethod2,
113  const double& noDataValue,
114  const bool forceRaster1NoDataValue,
115  const bool forceRaster2NoDataValue,
116  const std::vector< double >& pixelOffsets1,
117  const std::vector< double >& pixelScales1,
118  const std::vector< double >& pixelOffsets2,
119  const std::vector< double >& pixelScales2,
120  te::gm::MultiPolygon const * const r1ValidDataDelimiterPtr,
121  te::gm::MultiPolygon const * const r2ValidDataDelimiterPtr,
122  const te::gm::GeometricTransformation& geomTransformation,
123  const unsigned int threadsNumber,
124  const bool enableProgressInterface );
125 
126 
127  /*!
128  \brief Blend a pixel value using the current parameters.
129  \param line Line (raster 1 reference).
130  \param col Column (raster 1 reference).
131  \param values A pointer to a pre-allocated vector where the blended values will be stored.
132  \note The caller of this method must be aware that the returned blended value may be outside the original input rasters valid values range.
133  \note Raster 1 values have precedence over raster 2 values (when applicable).
134  */
135  inline void getBlendedValues( const double& line, const double& col,
136  double* const values )
137  {
138  TERP_DEBUG_TRUE_OR_THROW( m_blendFuncPtr, "Invalid blend function pointer" );
139  (this->*m_blendFuncPtr)( line, col, values );
140  };
141 
142  /*!
143  \brief Execute blending of the given input rasters and write the result into raster1.
144  \note Raster 1 values have precedence over raster 2 values (when applicable).
145  */
147 
148  protected:
149 
150  /*!
151  \brief Type definition for the a bleding function pointer.
152  \param line Raster 1 Line.
153  \param col Raster 1 Column.
154  \param values A pointer to a pre-allocated vector where the blended values will be stored.
155  \note The caller of this method must be aware that the returned blended value may be outside the original input rasters valid values range.
156  \note Raster 1 values have precedence over raster 2 values (when applicable).
157  */
158  typedef void (Blender::*BlendFunctPtr)( const double& line,
159  const double& col, double* const values );
160 
161  /*!
162  \brief Raster block info
163  */
165  {
167  unsigned int m_blkX;
168  unsigned int m_blkY;
174  };
175 
176  /*!
177  \brief The parameters passed to blendIntoRaster1Thread method.
178  */
180  {
181  public :
182 
183  bool* m_returnValuePtr; //!< A pointer to the threadreturn value.
184  bool* m_abortValuePtr; //!< A pointer to the abort execution value.
185  te::rst::RasterSynchronizer* m_sync1Ptr; //!< Raster 1 syncronizer pointer.
186  te::rst::RasterSynchronizer* m_sync2Ptr; //!< Raster 1 syncronizer pointer.
187  std::vector< RasterBlockInfo >* m_raster1BlocksInfosPtr; //!< blocks to process.
188  boost::mutex* m_mutexPtr; //!< mutex pointer.
189  boost::mutex* m_blockProcessedSignalMutexPtr; //!< Mutex used to update the main process progress update.
190  boost::condition_variable* m_blockProcessedSignalPtr; //!< Signal used to update the main process progress update.
191  unsigned int* m_runningThreadsCounterPtr; //!< a pointer to the running threads counter.
192  std::vector< unsigned int > m_raster1Bands; //!< Input raster 1 band indexes to use.
193  std::vector< unsigned int > m_raster2Bands; //!< Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
194  BlendMethod m_blendMethod; //!< The blend method to apply.
195  te::rst::Interpolator::Method m_interpMethod2; //!< The interpolation method to use when reading raster 2 data.
196  double m_noDataValue; //!< The value returned where there is no pixel data bo blend.
197  bool m_forceRaster1NoDataValue; //!< Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignored)
198  bool m_forceRaster2NoDataValue; //!< Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignored)
199  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).
200  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).
201  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).
202  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).
203  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.
204  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.
205  std::unique_ptr< te::gm::GeometricTransformation > 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).
206  unsigned long int m_maxRasterCachedBlocks; //!< The maximum number of raster cache blocks.
207  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.
208 
210 
212 
214 
216  };
217 
218  bool m_enableProgressInterface; //!< Enable progress interface.
219  bool m_forceRaster1NoDataValue; //!< Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
220  bool m_forceRaster2NoDataValue; //!< Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be ignored)
221  unsigned int m_threadsNumber; //!< The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of threads)..
222  BlendMethod m_blendMethod; //!< The blend method to apply.
223  BlendFunctPtr m_blendFuncPtr; //!< The current blend function.
224  te::rst::Raster * m_raster1Ptr; //!< Input raster 1.
225  te::rst::Raster const * m_raster2Ptr; //!< Input raster 2.
226  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.
227  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.
228  std::unique_ptr< te::gm::Geometry > m_intersectionPtr; //!< The Intersection geometry ( raster 1 indexed coods).
229  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).
230  std::size_t m_r1IntersectionSegmentsPointsSize; //!< Size of m_r1IntersectionSegmentsPoints;
231  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).
232  std::size_t m_r2IntersectionSegmentsPointsSize; //!< Size of m_r2IntersectionSegmentsPoints;
233  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).
234  te::rst::Interpolator::Method m_interpMethod1; //!< The interpolation method to use when reading raster 1 data.
235  te::rst::Interpolator::Method m_interpMethod2; //!< The interpolation method to use when reading raster 2 data.
236  double m_outputNoDataValue; //!< The output raster no-data value.
237  std::unique_ptr< te::rst::Interpolator > m_interp1Ptr; //!< Raster 1 interpolator instance pointer.
238  std::unique_ptr< te::rst::Interpolator > m_interp2Ptr; //!< Raster 2 interpolator instance pointer.
239  std::vector< unsigned int > m_raster1Bands; //!< Input raster 1 band indexes to use.
240  std::vector< unsigned int > m_raster2Bands; //!< Input raster 2 band indexes to use.
241  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).
242  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).
243  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).
244  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).
245  std::vector< double > m_raster1NoDataValues; //!< Raster 1 no-data values (on value per band).
246  std::vector< double > m_raster2NoDataValues; //!< Raster 2 no-data values (on value per band).
247  boost::ptr_vector< te::rst::TileIndexer > m_intersectionTileIndexers; //!< The Intersection geometry tile indexers( raster 1 indexed coods), one indexer for each intersection polygon.
248 
249  // variables used by the noBlendMethodImp method
256  std::complex< double > m_noBlendMethodImp_cValue;
259 
260  // variables used by the euclideanDistanceMethodImp method
264  std::complex< double > m_euclideanDistanceMethodImp_cValue1;
265  std::complex< double > m_euclideanDistanceMethodImp_cValue2;
275 
276  // variables used by the sumMethodImp method
280  std::complex< double > m_sumMethodImp_cValue1;
281  std::complex< double > m_sumMethodImp_cValue2;
282  unsigned int m_sumMethodImp_BandIdx;
285 
286  // variables used by the maxMethodImp method
290  std::complex< double > m_maxMethodImp_cValue1;
291  std::complex< double > m_maxMethodImp_cValue2;
292  unsigned int m_maxMethodImp_BandIdx;
295 
296  // variables used by the minMethodImp method
300  std::complex< double > m_minMethodImp_cValue1;
301  std::complex< double > m_minMethodImp_cValue2;
302  unsigned int m_minMethodImp_BandIdx;
305 
306  /*! \brief Reset the instance to its initial default state. */
307  void initState();
308 
309  /*! \brief Clear all internal allocated resources. */
310  void clear();
311 
312  /*! \brief Set the value of m_blendFuncPtr following the given blend method. */
313  void setBlendFunctionPonter( const BlendMethod blendMethod );
314 
315  /*!
316  \brief Implementation for NoBlendMethod.
317  \param line Raster 1 Line.
318  \param col Raster 1 Column.
319  \param values A pointer to a pre-allocated vector where the blended values will be stored.
320  */
321  void noBlendMethodImp( const double& line1, const double& col1,
322  double* const values );
323 
324  /*!
325  \brief Implementation for EuclideanDistanceMethod.
326  \param line Raster 1 Line.
327  \param col Raster 1 Column.
328  \param values A pointer to a pre-allocated vector where the blended values will be stored.
329  */
330  void euclideanDistanceMethodImp( const double& line1, const double& col1,
331  double* const values );
332 
333  /*!
334  \brief Implementation for SumMethod.
335  \param line Raster 1 Line.
336  \param col Raster 1 Column.
337  \param values A pointer to a pre-allocated vector where the blended values will be stored.
338  */
339  void sumMethodImp( const double& line1, const double& col1,
340  double* const values );
341 
342  /*!
343  \brief Implementation for MaxMethod.
344  \param line Raster 1 Line.
345  \param col Raster 1 Column.
346  \param values A pointer to a pre-allocated vector where the blended values will be stored.
347  */
348  void maxMethodImp( const double& line1, const double& col1,
349  double* const values );
350 
351  /*!
352  \brief Implementation for MinMethod.
353  \param line Raster 1 Line.
354  \param col Raster 1 Column.
355  \param values A pointer to a pre-allocated vector where the blended values will be stored.
356  */
357  void minMethodImp( const double& line1, const double& col1,
358  double* const values );
359 
360  /*!
361  \brief Thread entry for the method blendIntoRaster1.
362 
363  */
365 
366  /*!
367  \brief Extract segments from the given geometry.
368  \param geometryPtr Input geometry.
369  \param segments Found segments (appended here).
370  \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).
371  */
372  void getSegments( te::gm::Geometry const * const geometryPtr,
373  std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > >& segments ) const;
374 
375 
376  /*!
377  \brief Creater polygon tile indexers from the given geometry (only if it is a polygon or a collection of polygons).
378  \param geometryPtr Input geometry.
379  \param tileIndexers Created indexers (appended here).
380  \return true if OK, false on errors.
381  \note No indexers will be returned for geometries other than polygons or collections of polygons.
382  */
383  bool getTileIndexers( te::gm::Geometry const * const geometryPtr,
384  boost::ptr_vector< te::rst::TileIndexer >& tileIndexers ) const;
385  };
386 
387  } // end namespace rp
388 } // end namespace te
389 
390 #endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
391 
te::rp::Blender::BlendIntoRaster1ThreadParams::m_sync2Ptr
te::rst::RasterSynchronizer * m_sync2Ptr
Raster 1 syncronizer pointer.
Definition: Blender.h:186
te::rp::Blender::BlendIntoRaster1ThreadParams::m_abortValuePtr
bool * m_abortValuePtr
A pointer to the abort execution value.
Definition: Blender.h:184
te::rp::Blender::m_euclideanDistanceMethodImp_currDist
double m_euclideanDistanceMethodImp_currDist
Definition: Blender.h:267
te::rp::Blender
Blended pixel value calculation for two overlaped rasters.
Definition: Blender.h:61
te::rp::Blender::SumMethod
@ SumMethod
Pixels will be summed inside the raster overlapped area.
Definition: Blender.h:70
te::rp::Blender::RasterBlockInfo::m_rasterRows2ProcessBound
unsigned int m_rasterRows2ProcessBound
Definition: Blender.h:171
te::rp::Blender::maxMethodImp
void maxMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MaxMethod.
te::rp::Blender::m_maxMethodImp_Point2Line
double m_maxMethodImp_Point2Line
Definition: Blender.h:288
te::rp::Blender::m_pixelScales1
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:242
te::rp::Blender::m_noBlendMethodImp_BandIdx
unsigned int m_noBlendMethodImp_BandIdx
Definition: Blender.h:258
te::rp::Blender::InvalidBlendMethod
@ InvalidBlendMethod
Invalid blending method.
Definition: Blender.h:67
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::rp::Blender::m_forceRaster2NoDataValue
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:220
te::rp::Blender::m_minMethodImp_PointInsideIntersection
bool m_minMethodImp_PointInsideIntersection
Definition: Blender.h:304
te::rp::Blender::BlendIntoRaster1ThreadParams::m_forceRaster1NoDataValue
bool m_forceRaster1NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
Definition: Blender.h:197
Macros.h
te::rp::Blender::m_noBlendMethodImp_Point2Col
double m_noBlendMethodImp_Point2Col
Definition: Blender.h:255
te::rp::Blender::RasterBlockInfo::m_wasProcessed
bool m_wasProcessed
Definition: Blender.h:166
te::rp::Blender::m_minMethodImp_BandIdx
unsigned int m_minMethodImp_BandIdx
Definition: Blender.h:302
te::rp::Blender::m_r2ValidDataDelimiterPtr
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:227
te::rp::Blender::m_interpMethod1
te::rst::Interpolator::Method m_interpMethod1
The interpolation method to use when reading raster 1 data.
Definition: Blender.h:234
te::rp::Blender::BlendIntoRaster1ThreadParams::m_runningThreadsCounterPtr
unsigned int * m_runningThreadsCounterPtr
a pointer to the running threads counter.
Definition: Blender.h:191
te::rp::Blender::BlendIntoRaster1ThreadParams
The parameters passed to blendIntoRaster1Thread method.
Definition: Blender.h:180
te::rp::Blender::initialize
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)
Inititate the blender instance.
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::rp::Blender::BlendIntoRaster1ThreadParams::m_raster1Bands
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
Definition: Blender.h:192
te::rp::Blender::m_euclideanDistanceMethodImp_PointInsideIntersection
bool m_euclideanDistanceMethodImp_PointInsideIntersection
Definition: Blender.h:274
te::rp::Blender::m_r1IntersectionSegmentsPointsSize
std::size_t m_r1IntersectionSegmentsPointsSize
Size of m_r1IntersectionSegmentsPoints;.
Definition: Blender.h:230
te::rp::Blender::m_sumMethodImp_cValue1
std::complex< double > m_sumMethodImp_cValue1
Definition: Blender.h:280
te::rp::Blender::getSegments
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.
te::rp::Blender::BlendIntoRaster1ThreadParams::m_blendMethod
BlendMethod m_blendMethod
The blend method to apply.
Definition: Blender.h:194
te::rp::Blender::BlendIntoRaster1ThreadParams::m_sync1Ptr
te::rst::RasterSynchronizer * m_sync1Ptr
Raster 1 syncronizer pointer.
Definition: Blender.h:185
te::rp::Blender::euclideanDistanceMethodImp
void euclideanDistanceMethodImp(const double &line1, const double &col1, double *const values)
Implementation for EuclideanDistanceMethod.
te::rst::RasterSynchronizer
An access synchronizer to be used in SynchronizedRaster raster instances.
Definition: RasterSynchronizer.h:55
te::rp::Blender::m_noBlendMethodImp_Point1XProj1
double m_noBlendMethodImp_Point1XProj1
Definition: Blender.h:250
te::rp::Blender::minMethodImp
void minMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MinMethod.
te::rp::Blender::m_euclideanDistanceMethodImp_auxPoint
te::gm::Point m_euclideanDistanceMethodImp_auxPoint
Definition: Blender.h:261
te::rp::Blender::BlendIntoRaster1ThreadParams::m_raster1BlocksInfosPtr
std::vector< RasterBlockInfo > * m_raster1BlocksInfosPtr
blocks to process.
Definition: Blender.h:187
te::rp::Blender::sumMethodImp
void sumMethodImp(const double &line1, const double &col1, double *const values)
Implementation for SumMethod.
te::rp::Blender::setBlendFunctionPonter
void setBlendFunctionPonter(const BlendMethod blendMethod)
Set the value of m_blendFuncPtr following the given blend method.
te::rp::Blender::m_forceRaster1NoDataValue
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:219
te::rp::Blender::m_minMethodImp_IntersectionTileIndexersIdx
unsigned int m_minMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:303
te::rp::Blender::m_blendFuncPtr
BlendFunctPtr m_blendFuncPtr
The current blend function.
Definition: Blender.h:223
te::rp::Blender::m_euclideanDistanceMethodImp_cValue2
std::complex< double > m_euclideanDistanceMethodImp_cValue2
Definition: Blender.h:265
te::rp::Blender::m_noBlendMethodImp_Value
double m_noBlendMethodImp_Value
Definition: Blender.h:257
te::rp::Blender::Blender
Blender()
te::rp::Blender::BlendIntoRaster1ThreadParams::m_mutexPtr
boost::mutex * m_mutexPtr
mutex pointer.
Definition: Blender.h:188
te::rp::Blender::m_raster1Bands
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
Definition: Blender.h:239
te::rp::Blender::BlendIntoRaster1ThreadParams::m_blockProcessedSignalPtr
boost::condition_variable * m_blockProcessedSignalPtr
Signal used to update the main process progress update.
Definition: Blender.h:190
te::rp::Blender::EuclideanDistanceMethod
@ EuclideanDistanceMethod
Euclidean distance method.
Definition: Blender.h:69
te::rp::Blender::m_euclideanDistanceMethodImp_vecIdx
std::size_t m_euclideanDistanceMethodImp_vecIdx
Definition: Blender.h:270
te::rp::Blender::m_r2IntersectionSegmentsPoints
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:231
te::rp::Blender::RasterBlockInfo::m_blkTotalPixelsNumber
unsigned int m_blkTotalPixelsNumber
Definition: Blender.h:169
te::rp::Blender::m_euclideanDistanceMethodImp_Point2Line
double m_euclideanDistanceMethodImp_Point2Line
Definition: Blender.h:262
te::rp::Blender::m_blendMethod
BlendMethod m_blendMethod
The blend method to apply.
Definition: Blender.h:222
te::rp::Blender::m_intersectionTileIndexers
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:247
te::rp::Blender::m_raster1NoDataValues
std::vector< double > m_raster1NoDataValues
Raster 1 no-data values (on value per band).
Definition: Blender.h:245
te::rp::Blender::m_euclideanDistanceMethodImp_Point2Col
double m_euclideanDistanceMethodImp_Point2Col
Definition: Blender.h:263
te::rp::Blender::m_raster2Bands
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use.
Definition: Blender.h:240
te::rp::Blender::m_noBlendMethodImp_Point1YProj1
double m_noBlendMethodImp_Point1YProj1
Definition: Blender.h:251
te::rp::Blender::m_noBlendMethodImp_Point1XProj2
double m_noBlendMethodImp_Point1XProj2
Definition: Blender.h:252
te::rp::Blender::m_euclideanDistanceMethodImp_dist2
double m_euclideanDistanceMethodImp_dist2
Definition: Blender.h:269
te::rp::Blender::BlendIntoRaster1ThreadParams::m_interpMethod2
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
Definition: Blender.h:195
te::rp::Blender::RasterBlockInfo::m_firstRasterRow2Process
unsigned int m_firstRasterRow2Process
Definition: Blender.h:170
te::rp::Blender::m_noBlendMethodImp_cValue
std::complex< double > m_noBlendMethodImp_cValue
Definition: Blender.h:256
te::rp::Blender::m_euclideanDistanceMethodImp_dist1
double m_euclideanDistanceMethodImp_dist1
Definition: Blender.h:268
te::rp::Blender::m_sumMethodImp_auxPoint
te::gm::Point m_sumMethodImp_auxPoint
Definition: Blender.h:277
te::rst::InterpolationMethod
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
te::rp::Blender::BlendIntoRaster1ThreadParams::m_pixelOffsets2
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:201
te::rp::Blender::m_sumMethodImp_Point2Col
double m_sumMethodImp_Point2Col
Definition: Blender.h:279
te::rp::Blender::m_sumMethodImp_cValue2
std::complex< double > m_sumMethodImp_cValue2
Definition: Blender.h:281
te::rp::Blender::m_minMethodImp_Point2Col
double m_minMethodImp_Point2Col
Definition: Blender.h:299
te::rp::Blender::m_r1IntersectionSegmentsPoints
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:229
te::rp::Blender::blendIntoRaster1
bool blendIntoRaster1()
Execute blending of the given input rasters and write the result into raster1.
te::rp::Blender::RasterBlockInfo
Raster block info.
Definition: Blender.h:165
TERP_DEBUG_TRUE_OR_THROW
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
Definition: Macros.h:400
te::rp::Blender::m_minMethodImp_cValue2
std::complex< double > m_minMethodImp_cValue2
Definition: Blender.h:301
te::rp::Blender::BlendIntoRaster1ThreadParams::m_pixelOffsets1
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:199
te::gm::MultiPolygon
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:51
te::rp::Blender::m_maxMethodImp_IntersectionTileIndexersIdx
unsigned int m_maxMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:293
te::rp::Blender::m_intersectionPtr
std::unique_ptr< te::gm::Geometry > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
Definition: Blender.h:228
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::Blender::noBlendMethodImp
void noBlendMethodImp(const double &line1, const double &col1, double *const values)
Implementation for NoBlendMethod.
te::rp::Blender::BlendIntoRaster1ThreadParams::m_maxRasterCachedBlocks
unsigned long int m_maxRasterCachedBlocks
The maximum number of raster cache blocks.
Definition: Blender.h:206
te::rp::Blender::RasterBlockInfo::m_blkX
unsigned int m_blkX
Definition: Blender.h:167
te::rp::Blender::MaxMethod
@ MaxMethod
Keep the maximum value of two overlapping pixels.
Definition: Blender.h:71
te::rp::Blender::BlendIntoRaster1ThreadParams::m_useProgress
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:207
te::rp::Blender::m_geomTransformationPtr
te::gm::GeometricTransformation * m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 ( te::...
Definition: Blender.h:233
te::rp::Blender::m_pixelScales2
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:244
te::rp::Blender::BlendIntoRaster1ThreadParams::m_pixelScales1
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:200
te::rp::Blender::m_enableProgressInterface
bool m_enableProgressInterface
Enable progress interface.
Definition: Blender.h:218
te::rp::Blender::m_maxMethodImp_cValue1
std::complex< double > m_maxMethodImp_cValue1
Definition: Blender.h:290
te::rp::Blender::m_sumMethodImp_BandIdx
unsigned int m_sumMethodImp_BandIdx
Definition: Blender.h:282
te::rp::Blender::~Blender
~Blender()
te::rp::Blender::m_minMethodImp_auxPoint
te::gm::Point m_minMethodImp_auxPoint
Definition: Blender.h:297
te::rp::Blender::RasterBlockInfo::m_firstRasterCol2Process
unsigned int m_firstRasterCol2Process
Definition: Blender.h:172
te::rp::Blender::initState
void initState()
Reset the instance to its initial default state.
te::rp::Blender::m_raster2NoDataValues
std::vector< double > m_raster2NoDataValues
Raster 2 no-data values (on value per band).
Definition: Blender.h:246
te::rp::Blender::m_maxMethodImp_Point2Col
double m_maxMethodImp_Point2Col
Definition: Blender.h:289
te::rp::Blender::m_threadsNumber
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:221
te::rp::Blender::m_maxMethodImp_auxPoint
te::gm::Point m_maxMethodImp_auxPoint
Definition: Blender.h:287
te::rp::Blender::BlendIntoRaster1ThreadParams::m_noDataValue
double m_noDataValue
The value returned where there is no pixel data bo blend.
Definition: Blender.h:196
te::rp::Blender::m_euclideanDistanceMethodImp_cValue1
std::complex< double > m_euclideanDistanceMethodImp_cValue1
Definition: Blender.h:264
te::rp::Blender::BlendIntoRaster1ThreadParams::BlendIntoRaster1ThreadParams
BlendIntoRaster1ThreadParams(const BlendIntoRaster1ThreadParams &rhs)
te::rp::Blender::BlendMethod
BlendMethod
Definition: Blender.h:66
te::rp::Blender::m_interp1Ptr
std::unique_ptr< te::rst::Interpolator > m_interp1Ptr
Raster 1 interpolator instance pointer.
Definition: Blender.h:237
te::rp::Blender::m_interp2Ptr
std::unique_ptr< te::rst::Interpolator > m_interp2Ptr
Raster 2 interpolator instance pointer.
Definition: Blender.h:238
te::rp::Blender::clear
void clear()
Clear all internal allocated resources.
te::rp::Blender::BlendIntoRaster1ThreadParams::m_returnValuePtr
bool * m_returnValuePtr
A pointer to the threadreturn value.
Definition: Blender.h:183
te::rp::Blender::m_r2IntersectionSegmentsPointsSize
std::size_t m_r2IntersectionSegmentsPointsSize
Size of m_r2IntersectionSegmentsPoints;.
Definition: Blender.h:232
te::rp::Blender::m_sumMethodImp_IntersectionTileIndexersIdx
unsigned int m_sumMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:283
te::gm::GeometricTransformation
2D Geometric transformation base class.
Definition: GeometricTransformation.h:57
te::rp::Blender::m_euclideanDistanceMethodImp_BandIdx
unsigned int m_euclideanDistanceMethodImp_BandIdx
Definition: Blender.h:266
te::rp::Blender::BlendIntoRaster1ThreadParams::BlendIntoRaster1ThreadParams
BlendIntoRaster1ThreadParams()
te::rp::Blender::m_pixelOffsets2
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:243
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::rp::Blender::BlendIntoRaster1ThreadParams::operator=
BlendIntoRaster1ThreadParams & operator=(const BlendIntoRaster1ThreadParams &rhs)
te::rp::Blender::BlendIntoRaster1ThreadParams::~BlendIntoRaster1ThreadParams
~BlendIntoRaster1ThreadParams()
te::rp::Blender::m_noBlendMethodImp_Point1YProj2
double m_noBlendMethodImp_Point1YProj2
Definition: Blender.h:253
te::rp::Blender::m_r1ValidDataDelimiterPtr
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:226
te::rp::Blender::m_sumMethodImp_PointInsideIntersection
bool m_sumMethodImp_PointInsideIntersection
Definition: Blender.h:284
te::rp::Blender::blendIntoRaster1Thread
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
te::rp::Blender::m_raster2Ptr
te::rst::Raster const * m_raster2Ptr
Input raster 2.
Definition: Blender.h:225
te::rp::Blender::BlendIntoRaster1ThreadParams::m_r2ValidDataDelimiterPtr
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:204
te::rp::Blender::m_sumMethodImp_Point2Line
double m_sumMethodImp_Point2Line
Definition: Blender.h:278
te::rp::Blender::getBlendedValues
void getBlendedValues(const double &line, const double &col, double *const values)
Blend a pixel value using the current parameters.
Definition: Blender.h:135
te::rp::Blender::NoBlendMethod
@ NoBlendMethod
No blending performed.
Definition: Blender.h:68
te::rp::Blender::BlendIntoRaster1ThreadParams::m_blockProcessedSignalMutexPtr
boost::mutex * m_blockProcessedSignalMutexPtr
Mutex used to update the main process progress update.
Definition: Blender.h:189
te::rp::Blender::BlendIntoRaster1ThreadParams::m_forceRaster2NoDataValue
bool m_forceRaster2NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
Definition: Blender.h:198
te::rp::Blender::m_euclideanDistanceMethodImp_aux1
double m_euclideanDistanceMethodImp_aux1
Definition: Blender.h:271
te::rp::Blender::m_outputNoDataValue
double m_outputNoDataValue
The output raster no-data value.
Definition: Blender.h:236
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::rp::Blender::m_interpMethod2
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
Definition: Blender.h:235
te::rp::Blender::m_noBlendMethodImp_Point2Line
double m_noBlendMethodImp_Point2Line
Definition: Blender.h:254
te::rp::Blender::BlendIntoRaster1ThreadParams::m_geomTransformationPtr
std::unique_ptr< te::gm::GeometricTransformation > m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels...
Definition: Blender.h:205
te::rp::Blender::m_maxMethodImp_BandIdx
unsigned int m_maxMethodImp_BandIdx
Definition: Blender.h:292
te::rp::Blender::m_euclideanDistanceMethodImp_aux2
double m_euclideanDistanceMethodImp_aux2
Definition: Blender.h:272
te::rp::Blender::m_pixelOffsets1
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:241
te::rp::Blender::m_minMethodImp_Point2Line
double m_minMethodImp_Point2Line
Definition: Blender.h:298
te::gm::Point
A point with x and y coordinate values.
Definition: Point.h:51
te::rp::Blender::RasterBlockInfo::m_blkY
unsigned int m_blkY
Definition: Blender.h:168
te::rp::Blender::BlendIntoRaster1ThreadParams::m_pixelScales2
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:202
te::rp::Blender::m_maxMethodImp_cValue2
std::complex< double > m_maxMethodImp_cValue2
Definition: Blender.h:291
te::rp::Blender::m_minMethodImp_cValue1
std::complex< double > m_minMethodImp_cValue1
Definition: Blender.h:300
te::rp::Blender::getTileIndexers
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...
te::rp::Blender::m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx
unsigned int m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx
Definition: Blender.h:273
te::rp::Blender::BlendIntoRaster1ThreadParams::m_raster2Bands
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
Definition: Blender.h:193
te::rp::Blender::m_raster1Ptr
te::rst::Raster * m_raster1Ptr
Input raster 1.
Definition: Blender.h:224
te::rp::Blender::m_maxMethodImp_PointInsideIntersection
bool m_maxMethodImp_PointInsideIntersection
Definition: Blender.h:294
te::rp::Blender::BlendIntoRaster1ThreadParams::m_r1ValidDataDelimiterPtr
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:203
te::rp::Blender::RasterBlockInfo::m_rasterCols2ProcessBound
unsigned int m_rasterCols2ProcessBound
Definition: Blender.h:173