Go to the documentation of this file.
25 #ifndef __TERRALIB_RP_INTERNAL_BLENDER_H
26 #define __TERRALIB_RP_INTERNAL_BLENDER_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"
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>
107 const std::vector< unsigned int >& raster1Bands,
109 const std::vector< unsigned int >& raster2Bands,
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,
123 const unsigned int threadsNumber,
124 const bool enableProgressInterface );
136 double*
const values )
139 (this->*m_blendFuncPtr)( line, col, values );
158 typedef void (
Blender::*BlendFunctPtr)(
const double& line,
159 const double& col,
double*
const values );
322 double*
const values );
331 double*
const values );
340 double*
const values );
349 double*
const values );
358 double*
const values );
373 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > >& segments )
const;
384 boost::ptr_vector< te::rst::TileIndexer >& tileIndexers )
const;
390 #endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
te::rst::RasterSynchronizer * m_sync2Ptr
Raster 1 syncronizer pointer.
bool * m_abortValuePtr
A pointer to the abort execution value.
double m_euclideanDistanceMethodImp_currDist
Blended pixel value calculation for two overlaped rasters.
@ SumMethod
Pixels will be summed inside the raster overlapped area.
unsigned int m_rasterRows2ProcessBound
void maxMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MaxMethod.
double m_maxMethodImp_Point2Line
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
unsigned int m_noBlendMethodImp_BandIdx
@ InvalidBlendMethod
Invalid blending method.
bool m_forceRaster2NoDataValue
Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be igno...
bool m_minMethodImp_PointInsideIntersection
bool m_forceRaster1NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
double m_noBlendMethodImp_Point2Col
unsigned int m_minMethodImp_BandIdx
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...
te::rst::Interpolator::Method m_interpMethod1
The interpolation method to use when reading raster 1 data.
unsigned int * m_runningThreadsCounterPtr
a pointer to the running threads counter.
The parameters passed to blendIntoRaster1Thread method.
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.
An abstract class for raster data strucutures.
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
bool m_euclideanDistanceMethodImp_PointInsideIntersection
std::size_t m_r1IntersectionSegmentsPointsSize
Size of m_r1IntersectionSegmentsPoints;.
std::complex< double > m_sumMethodImp_cValue1
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.
BlendMethod m_blendMethod
The blend method to apply.
te::rst::RasterSynchronizer * m_sync1Ptr
Raster 1 syncronizer pointer.
void euclideanDistanceMethodImp(const double &line1, const double &col1, double *const values)
Implementation for EuclideanDistanceMethod.
An access synchronizer to be used in SynchronizedRaster raster instances.
double m_noBlendMethodImp_Point1XProj1
void minMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MinMethod.
te::gm::Point m_euclideanDistanceMethodImp_auxPoint
std::vector< RasterBlockInfo > * m_raster1BlocksInfosPtr
blocks to process.
void sumMethodImp(const double &line1, const double &col1, double *const values)
Implementation for SumMethod.
void setBlendFunctionPonter(const BlendMethod blendMethod)
Set the value of m_blendFuncPtr following the given blend method.
bool m_forceRaster1NoDataValue
Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be igno...
unsigned int m_minMethodImp_IntersectionTileIndexersIdx
BlendFunctPtr m_blendFuncPtr
The current blend function.
std::complex< double > m_euclideanDistanceMethodImp_cValue2
double m_noBlendMethodImp_Value
boost::mutex * m_mutexPtr
mutex pointer.
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
boost::condition_variable * m_blockProcessedSignalPtr
Signal used to update the main process progress update.
@ EuclideanDistanceMethod
Euclidean distance method.
std::size_t m_euclideanDistanceMethodImp_vecIdx
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 ...
unsigned int m_blkTotalPixelsNumber
double m_euclideanDistanceMethodImp_Point2Line
BlendMethod m_blendMethod
The blend method to apply.
boost::ptr_vector< te::rst::TileIndexer > m_intersectionTileIndexers
The Intersection geometry tile indexers( raster 1 indexed coods), one indexer for each intersection p...
std::vector< double > m_raster1NoDataValues
Raster 1 no-data values (on value per band).
double m_euclideanDistanceMethodImp_Point2Col
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use.
double m_noBlendMethodImp_Point1YProj1
double m_noBlendMethodImp_Point1XProj2
double m_euclideanDistanceMethodImp_dist2
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
unsigned int m_firstRasterRow2Process
std::complex< double > m_noBlendMethodImp_cValue
double m_euclideanDistanceMethodImp_dist1
te::gm::Point m_sumMethodImp_auxPoint
InterpolationMethod
Allowed interpolation methods.
std::vector< double > m_pixelOffsets2
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
double m_sumMethodImp_Point2Col
std::complex< double > m_sumMethodImp_cValue2
double m_minMethodImp_Point2Col
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 ...
bool blendIntoRaster1()
Execute blending of the given input rasters and write the result into raster1.
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
std::complex< double > m_minMethodImp_cValue2
std::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
MultiPolygon is a MultiSurface whose elements are Polygons.
unsigned int m_maxMethodImp_IntersectionTileIndexersIdx
std::unique_ptr< te::gm::Geometry > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
void noBlendMethodImp(const double &line1, const double &col1, double *const values)
Implementation for NoBlendMethod.
unsigned long int m_maxRasterCachedBlocks
The maximum number of raster cache blocks.
@ MaxMethod
Keep the maximum value of two overlapping pixels.
bool m_useProgress
If enabled each thread will use its own progress interface, if false only a signal will be emitted on...
te::gm::GeometricTransformation * m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 ( te::...
std::vector< double > m_pixelScales2
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
bool m_enableProgressInterface
Enable progress interface.
std::complex< double > m_maxMethodImp_cValue1
unsigned int m_sumMethodImp_BandIdx
te::gm::Point m_minMethodImp_auxPoint
unsigned int m_firstRasterCol2Process
void initState()
Reset the instance to its initial default state.
std::vector< double > m_raster2NoDataValues
Raster 2 no-data values (on value per band).
double m_maxMethodImp_Point2Col
unsigned int m_threadsNumber
The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of thre...
te::gm::Point m_maxMethodImp_auxPoint
double m_noDataValue
The value returned where there is no pixel data bo blend.
std::complex< double > m_euclideanDistanceMethodImp_cValue1
BlendIntoRaster1ThreadParams(const BlendIntoRaster1ThreadParams &rhs)
std::unique_ptr< te::rst::Interpolator > m_interp1Ptr
Raster 1 interpolator instance pointer.
std::unique_ptr< te::rst::Interpolator > m_interp2Ptr
Raster 2 interpolator instance pointer.
void clear()
Clear all internal allocated resources.
bool * m_returnValuePtr
A pointer to the threadreturn value.
std::size_t m_r2IntersectionSegmentsPointsSize
Size of m_r2IntersectionSegmentsPoints;.
unsigned int m_sumMethodImp_IntersectionTileIndexersIdx
unsigned int m_euclideanDistanceMethodImp_BandIdx
BlendIntoRaster1ThreadParams()
std::vector< double > m_pixelOffsets2
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
Proxy configuration file for TerraView (see terraview_config.h).
BlendIntoRaster1ThreadParams & operator=(const BlendIntoRaster1ThreadParams &rhs)
~BlendIntoRaster1ThreadParams()
double m_noBlendMethodImp_Point1YProj2
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...
bool m_sumMethodImp_PointInsideIntersection
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
te::rst::Raster const * m_raster2Ptr
Input raster 2.
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...
double m_sumMethodImp_Point2Line
void getBlendedValues(const double &line, const double &col, double *const values)
Blend a pixel value using the current parameters.
@ NoBlendMethod
No blending performed.
boost::mutex * m_blockProcessedSignalMutexPtr
Mutex used to update the main process progress update.
bool m_forceRaster2NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
double m_euclideanDistanceMethodImp_aux1
double m_outputNoDataValue
The output raster no-data value.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
double m_noBlendMethodImp_Point2Line
std::unique_ptr< te::gm::GeometricTransformation > m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels...
unsigned int m_maxMethodImp_BandIdx
double m_euclideanDistanceMethodImp_aux2
std::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
double m_minMethodImp_Point2Line
A point with x and y coordinate values.
std::vector< double > m_pixelScales2
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
std::complex< double > m_maxMethodImp_cValue2
std::complex< double > m_minMethodImp_cValue1
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...
unsigned int m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
te::rst::Raster * m_raster1Ptr
Input raster 1.
bool m_maxMethodImp_PointInsideIntersection
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...
unsigned int m_rasterCols2ProcessBound