25#ifndef __TERRALIB_RP_INTERNAL_BLENDER_H
26#define __TERRALIB_RP_INTERNAL_BLENDER_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"
41#include <boost/noncopyable.hpp>
42#include <boost/ptr_container/ptr_vector.hpp>
103 const std::vector< unsigned int >& raster1Bands,
105 const std::vector< unsigned int >& raster2Bands,
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,
119 const unsigned int threadsNumber,
120 const bool enableProgressInterface,
122 const bool enableRasterCache );
134 double*
const values )
137 (this->*m_primaryBlendFuncPtr)( line, col, values );
163 typedef void (
Blender::*PrimaryBlendFunctPtr)(
const double& line,
164 const double& col,
double*
const values );
348 double*
const values );
357 double*
const values );
366 double*
const values );
375 double*
const values );
384 double*
const values );
393 double*
const values );
408 std::vector< std::pair< te::gm::Coord2D, te::gm::Coord2D > >& segments )
const;
419 boost::ptr_vector< te::rst::TileIndexer >& tileIndexers )
const;
#define TERP_DEBUG_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
MultiPolygon is a MultiSurface whose elements are Polygons.
A point with x and y coordinate values.
The parameters passed to blendIntoRaster1Thread method.
bool m_forceRaster1NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
bool m_forceRaster2NoDataValue
Use noDataValue as the input rasters no-data value (The original rasters no-data values will be ignor...
te::rst::RasterSynchronizer * m_sync2Ptr
Raster 1 syncronizer pointer.
te::gm::GeometricTransformation const * m_geomTransformationPtr
A transformation mapping raster 1 pixels ( te::gm::GTParameters::TiePoint::first ) to raster 2 pixels...
std::vector< unsigned int > const * m_raster1BandsPtr
Input raster 1 band indexes to use.
unsigned int * m_processedBlocksNmbPtr
std::vector< double > const * m_pixelOffsets1Ptr
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
te::rst::RasterSynchronizer * m_sync1Ptr
Raster 1 syncronizer pointer.
double m_noDataValue
The value returned where there is no pixel data bo blend.
te::gm::MultiPolygon const * m_r1ValidDataDelimiterPtr
A pointer to a geometry (raster 1 world/projected coords) delimiting the raster region with valid dat...
BlendMethod m_blendMethod
The blend method to apply.
std::vector< double > const * m_pixelScales2Ptr
The values scale to be applied to raster 2 pixel values before the blended value calcule (one element...
std::vector< unsigned int > const * m_raster2BandsPtr
Input raster 2 band indexes to use (this vector has the same size as raster1Bands).
unsigned long int m_maxRasterCachedBlocks
The maximum number of raster cache blocks.
BlenderRule const * m_rulePtr
bool m_useProgress
If enabled each thread will use its own progress interface, if false only a signal will be emitted on...
std::mutex * m_blockProcessedSignalMutexPtr
Mutex used to update the main process progress update.
BlendIntoRaster1ThreadParams()
unsigned int * m_runningThreadsCounterPtr
a pointer to the running threads counter.
te::gm::MultiPolygon const * m_r2ValidDataDelimiterPtr
A pointer to a geometry (raster 2 world/projected coords) delimiting the raster region with valid dat...
std::mutex * m_mutexPtr
mutex pointer.
std::condition_variable * m_blockProcessedSignalPtr
Signal used to update the main process progress update.
BlendIntoRaster1ThreadParams(const BlendIntoRaster1ThreadParams &)
std::vector< RasterBlockInfo > * m_raster1BlocksInfosPtr
blocks to process.
std::vector< double > const * m_pixelOffsets2Ptr
The values offset to be applied to raster 2 pixel values before the blended value calcule (one elemen...
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
bool * m_returnValuePtr
A pointer to the threadreturn value.
std::vector< double > const * m_pixelScales1Ptr
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
~BlendIntoRaster1ThreadParams()
BlendIntoRaster1ThreadParams & operator=(const BlendIntoRaster1ThreadParams &)
bool * m_abortValuePtr
A pointer to the abort execution value.
Blended pixel value calculation for two overlaped rasters.
bool m_forceRaster1NoDataValue
Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be igno...
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 ...
double m_maxMethodImp_Point2Line
unsigned int m_sumMethodImp_IntersectionTileIndexersIdx
std::vector< double > m_pixelOffsets1
The values offset to be applied to raster 1 pixel values before the blended value calcule (one elemen...
bool m_euclideanDistanceMethodImp_PointInsideIntersection
double m_euclideanDistanceMethodImp_Point2Col
std::complex< double > m_noBlendMethodImp_cValue
bool m_euclideanDistanceMethodImp_pixel1IsValid
std::vector< unsigned int > m_raster2Bands
Input raster 2 band indexes to use.
double m_noBlendMethodImp_Point2Col
te::gm::Point m_euclideanDistanceMethodImp_auxPoint
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.
te::rst::Interpolator::Method m_interpMethod2
The interpolation method to use when reading raster 2 data.
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_ruleMethodImp_Point2Line
std::vector< std::complex< double > > m_noBlendMethodImp_pixel1Values
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
unsigned int m_raster1BandsSize
bool m_noBlendMethodImp_pixel2IsValid
double m_euclideanDistanceMethodImp_aux1
double m_noBlendMethodImp_Point1YProj2
std::complex< double > m_maxMethodImp_cValue1
std::unique_ptr< te::rst::Interpolator > m_interp1Ptr
Raster 1 interpolator instance pointer.
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::...
unsigned int m_threadsNumber
The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of thre...
std::vector< std::complex< double > > m_euclideanDistanceMethodImp_pixel2Values
void maxMethodImp(const double &line1, const double &col1, double *const values)
Implementation for MaxMethod.
bool m_sumMethodImp_PointInsideIntersection
double m_euclideanDistanceMethodImp_dist2
double m_euclideanDistanceMethodImp_Point2Line
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...
bool m_euclideanDistanceMethodImp_pixel2IsValid
te::rst::Raster * m_raster1Ptr
Input raster 1.
unsigned int m_minMethodImp_IntersectionTileIndexersIdx
double m_noBlendMethodImp_Value
te::rst::Interpolator::Method m_interpMethod1
The interpolation method to use when reading raster 1 data.
bool m_minMethodImp_PointInsideIntersection
void getBlendedValues(const double &line, const double &col, double *const values)
Blend a pixel value using the current parameters.
std::vector< std::complex< double > > m_euclideanDistanceMethodImp_pixel1Values
std::size_t m_r1IntersectionSegmentsPointsSize
Size of m_r1IntersectionSegmentsPoints;.
std::complex< double > m_minMethodImp_cValue1
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...
bool blendIntoRaster1()
Execute blending of the given input rasters and write the result into raster1.
double m_minMethodImp_Point2Col
std::complex< double > m_maxMethodImp_cValue2
std::unique_ptr< te::rst::Interpolator > m_interp2Ptr
Raster 2 interpolator instance pointer.
double m_noBlendMethodImp_Point1YProj1
double m_sumMethodImp_Point2Col
double m_sumMethodImp_Point2Line
BlendMethod m_blendMethod
The blend method to apply.
std::string m_errorMessage
Current error message.
double m_noBlendMethodImp_Point2Line
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_minMethodImp_cValue2
te::rst::Raster const * m_raster2Ptr
Input raster 2.
double m_maxMethodImp_Point2Col
void initState()
Reset the instance to its initial default state.
te::gm::Point m_minMethodImp_auxPoint
std::complex< double > m_euclideanDistanceMethodImp_cValue1
te::rp::blender::BlendMethod BlendMethod
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).
unsigned int m_sumMethodImp_BandIdx
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
double m_outputNoDataValue
The output raster no-data value.
unsigned int m_euclideanDistanceMethodImp_BandIdx
std::vector< double > m_pixelScales1
The values scale to be applied to raster 1 pixel values before the blended value calcule (one element...
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...
unsigned int m_maxMethodImp_BandIdx
double m_noBlendMethodImp_Point1XProj1
std::unique_ptr< te::gm::Geometry > m_intersectionPtr
The Intersection geometry ( raster 1 indexed coods).
std::complex< double > m_euclideanDistanceMethodImp_cValue2
std::size_t m_euclideanDistanceMethodImp_vecIdx
static void blendIntoRaster1Thread(BlendIntoRaster1ThreadParams *paramsPtr)
Thread entry for the method blendIntoRaster1.
double m_ruleMethodImp_Point2Col
std::unique_ptr< BlenderRule > m_rulePtr
Blender rule pointer.
unsigned int m_noBlendMethodImp_BandIdx
bool m_forceRaster2NoDataValue
Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be igno...
std::complex< double > m_sumMethodImp_cValue1
double m_euclideanDistanceMethodImp_aux2
unsigned int m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx
te::gm::Point m_maxMethodImp_auxPoint
bool m_maxMethodImp_PointInsideIntersection
double m_euclideanDistanceMethodImp_currDist
unsigned int m_minMethodImp_BandIdx
unsigned int m_raster2BandsSize
bool m_enableRasterCache
enable/disable the use of raster cache.
bool m_enableProgressInterface
Enable progress interface.
std::size_t m_r2IntersectionSegmentsPointsSize
Size of m_r2IntersectionSegmentsPoints;.
void clear()
Clear all internal allocated resources.
bool m_noBlendMethodImp_pixel1IsValid
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
double m_noBlendMethodImp_Point1XProj2
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 ...
double m_minMethodImp_Point2Line
te::gm::Point m_sumMethodImp_auxPoint
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
std::vector< double > m_raster2NoDataValues
Raster 2 no-data values (on value per band).
std::vector< unsigned int > m_raster1Bands
Input raster 1 band indexes to use.
An access synchronizer to be used in SynchronizedRaster raster instances.
An abstract class for raster data strucutures.
InterpolationMethod
Allowed interpolation methods.
unsigned int m_firstRasterCol2Process
unsigned int m_rasterRows2ProcessBound
unsigned int m_blkTotalPixelsNumber
unsigned int m_rasterCols2ProcessBound
unsigned int m_firstRasterRow2Process
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Proxy configuration file for TerraView (see terraview_config.h).