Blended pixel value calculation for two overlaped rasters. More...
#include <Blender.h>
Classes | |
class | BlendIntoRaster1ThreadParams |
The parameters passed to blendIntoRaster1Thread method. More... | |
struct | RasterBlockInfo |
Raster block info. More... | |
Public Types | |
typedef te::rp::blender::BlendMethod | BlendMethod |
Public Member Functions | |
Blender () | |
bool | blendIntoRaster1 () |
Execute blending of the given input rasters and write the result into raster1. More... | |
void | getBlendedValues (const double &line, const double &col, double *const values) |
Blend a pixel value using the current parameters. More... | |
const std::string & | getErrorMessage () const |
Return the current error message if there is any. More... | |
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. More... | |
~Blender () | |
Protected Types | |
typedef void(Blender::* | PrimaryBlendFunctPtr) (const double &line, const double &col, double *const values) |
Type definition for the a primary bleding function pointer. More... | |
Protected Member Functions | |
void | clear () |
Clear all internal allocated resources. More... | |
void | euclideanDistanceMethodImp (const double &line1, const double &col1, double *const values) |
Implementation for EuclideanDistanceMethod. More... | |
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. More... | |
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 polygons). More... | |
void | initState () |
Reset the instance to its initial default state. More... | |
void | maxMethodImp (const double &line1, const double &col1, double *const values) |
Implementation for MaxMethod. More... | |
void | minMethodImp (const double &line1, const double &col1, double *const values) |
Implementation for MinMethod. More... | |
void | noBlendMethodImp (const double &line1, const double &col1, double *const values) |
Implementation for NoBlendMethod. More... | |
void | ruleMethodImp (const double &line1, const double &col1, double *const values) |
Rule based Implementation. More... | |
void | setBlendFunctionsPonters (const BlendMethod blendMethod) |
Set the value of m_blendFuncPtr following the given blend method. More... | |
void | setErrorMessage (const std::string &newErrorMessage) |
Set the current error message. More... | |
void | sumMethodImp (const double &line1, const double &col1, double *const values) |
Implementation for SumMethod. More... | |
Static Protected Member Functions | |
static void | blendIntoRaster1Thread (BlendIntoRaster1ThreadParams *paramsPtr) |
Thread entry for the method blendIntoRaster1. More... | |
Protected Attributes | |
BlendMethod | m_blendMethod |
The blend method to apply. More... | |
bool | m_enableProgressInterface |
Enable progress interface. More... | |
bool | m_enableRasterCache |
enable/disable the use of raster cache. More... | |
std::string | m_errorMessage |
Current error message. More... | |
double | m_euclideanDistanceMethodImp_aux1 |
double | m_euclideanDistanceMethodImp_aux2 |
te::gm::Point | m_euclideanDistanceMethodImp_auxPoint |
unsigned int | m_euclideanDistanceMethodImp_BandIdx |
double | m_euclideanDistanceMethodImp_currDist |
std::complex< double > | m_euclideanDistanceMethodImp_cValue1 |
std::complex< double > | m_euclideanDistanceMethodImp_cValue2 |
double | m_euclideanDistanceMethodImp_dist1 |
double | m_euclideanDistanceMethodImp_dist2 |
unsigned int | m_euclideanDistanceMethodImp_IntersectionTileIndexersIdx |
bool | m_euclideanDistanceMethodImp_pixel1IsValid |
std::vector< std::complex< double > > | m_euclideanDistanceMethodImp_pixel1Values |
bool | m_euclideanDistanceMethodImp_pixel2IsValid |
std::vector< std::complex< double > > | m_euclideanDistanceMethodImp_pixel2Values |
double | m_euclideanDistanceMethodImp_Point2Col |
double | m_euclideanDistanceMethodImp_Point2Line |
bool | m_euclideanDistanceMethodImp_PointInsideIntersection |
std::size_t | m_euclideanDistanceMethodImp_vecIdx |
bool | m_forceRaster1NoDataValue |
Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored) More... | |
bool | m_forceRaster2NoDataValue |
Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be ignored) More... | |
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). More... | |
std::unique_ptr< te::rst::Interpolator > | m_interp1Ptr |
Raster 1 interpolator instance pointer. More... | |
std::unique_ptr< te::rst::Interpolator > | m_interp2Ptr |
Raster 2 interpolator instance pointer. More... | |
te::rst::Interpolator::Method | m_interpMethod1 |
The interpolation method to use when reading raster 1 data. More... | |
te::rst::Interpolator::Method | m_interpMethod2 |
The interpolation method to use when reading raster 2 data. More... | |
std::unique_ptr< te::gm::Geometry > | m_intersectionPtr |
The Intersection geometry ( raster 1 indexed coods). More... | |
boost::ptr_vector< te::rst::TileIndexer > | m_intersectionTileIndexers |
The Intersection geometry tile indexers( raster 1 indexed coods), one indexer for each intersection polygon. More... | |
te::gm::Point | m_maxMethodImp_auxPoint |
unsigned int | m_maxMethodImp_BandIdx |
std::complex< double > | m_maxMethodImp_cValue1 |
std::complex< double > | m_maxMethodImp_cValue2 |
unsigned int | m_maxMethodImp_IntersectionTileIndexersIdx |
double | m_maxMethodImp_Point2Col |
double | m_maxMethodImp_Point2Line |
bool | m_maxMethodImp_PointInsideIntersection |
te::gm::Point | m_minMethodImp_auxPoint |
unsigned int | m_minMethodImp_BandIdx |
std::complex< double > | m_minMethodImp_cValue1 |
std::complex< double > | m_minMethodImp_cValue2 |
unsigned int | m_minMethodImp_IntersectionTileIndexersIdx |
double | m_minMethodImp_Point2Col |
double | m_minMethodImp_Point2Line |
bool | m_minMethodImp_PointInsideIntersection |
unsigned int | m_noBlendMethodImp_BandIdx |
std::complex< double > | m_noBlendMethodImp_cValue |
bool | m_noBlendMethodImp_pixel1IsValid |
std::vector< std::complex< double > > | m_noBlendMethodImp_pixel1Values |
bool | m_noBlendMethodImp_pixel2IsValid |
std::vector< std::complex< double > > | m_noBlendMethodImp_pixel2Values |
double | m_noBlendMethodImp_Point1XProj1 |
double | m_noBlendMethodImp_Point1XProj2 |
double | m_noBlendMethodImp_Point1YProj1 |
double | m_noBlendMethodImp_Point1YProj2 |
double | m_noBlendMethodImp_Point2Col |
double | m_noBlendMethodImp_Point2Line |
double | m_noBlendMethodImp_Value |
double | m_outputNoDataValue |
The output raster no-data value. More... | |
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). More... | |
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). More... | |
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). More... | |
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). More... | |
PrimaryBlendFunctPtr | m_primaryBlendFuncPtr |
The primary blend function. More... | |
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). More... | |
std::size_t | m_r1IntersectionSegmentsPointsSize |
Size of m_r1IntersectionSegmentsPoints;. More... | |
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. More... | |
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). More... | |
std::size_t | m_r2IntersectionSegmentsPointsSize |
Size of m_r2IntersectionSegmentsPoints;. More... | |
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. More... | |
std::vector< unsigned int > | m_raster1Bands |
Input raster 1 band indexes to use. More... | |
unsigned int | m_raster1BandsSize |
std::vector< double > | m_raster1NoDataValues |
Raster 1 no-data values (on value per band). More... | |
te::rst::Raster * | m_raster1Ptr |
Input raster 1. More... | |
std::vector< unsigned int > | m_raster2Bands |
Input raster 2 band indexes to use. More... | |
unsigned int | m_raster2BandsSize |
std::vector< double > | m_raster2NoDataValues |
Raster 2 no-data values (on value per band). More... | |
te::rst::Raster const * | m_raster2Ptr |
Input raster 2. More... | |
double | m_ruleMethodImp_Point2Col |
double | m_ruleMethodImp_Point2Line |
std::unique_ptr< BlenderRule > | m_rulePtr |
Blender rule pointer. More... | |
te::gm::Point | m_sumMethodImp_auxPoint |
unsigned int | m_sumMethodImp_BandIdx |
std::complex< double > | m_sumMethodImp_cValue1 |
std::complex< double > | m_sumMethodImp_cValue2 |
unsigned int | m_sumMethodImp_IntersectionTileIndexersIdx |
double | m_sumMethodImp_Point2Col |
double | m_sumMethodImp_Point2Line |
bool | m_sumMethodImp_PointInsideIntersection |
unsigned int | m_threadsNumber |
The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of threads).. More... | |
Blended pixel value calculation for two overlaped rasters.
A rule used by the te::rst::Blender classe.
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.
|
protected |
Type definition for the a primary bleding function pointer.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
te::rp::Blender::Blender | ( | ) |
Default constructor.
te::rp::Blender::~Blender | ( | ) |
Default destructor.
bool te::rp::Blender::blendIntoRaster1 | ( | ) |
Execute blending of the given input rasters and write the result into raster1.
|
staticprotected |
Thread entry for the method blendIntoRaster1.
|
protected |
Clear all internal allocated resources.
|
protected |
Implementation for EuclideanDistanceMethod.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
|
inline |
Blend a pixel value using the current parameters.
line | Line (raster 1 reference). |
col | Column (raster 1 reference). |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
Definition at line 133 of file Blender.h.
References TERP_DEBUG_TRUE_OR_THROW.
const std::string & te::rp::Blender::getErrorMessage | ( | ) | const |
Return the current error message if there is any.
|
protected |
Extract segments from the given geometry.
geometryPtr | Input geometry. |
segments | Found segments (appended here). |
|
protected |
Creater polygon tile indexers from the given geometry (only if it is a polygon or a collection of polygons).
geometryPtr | Input geometry. |
tileIndexers | Created indexers (appended here). |
bool te::rp::Blender::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.
raster1 | Input raster 1. |
raster1Bands | Input raster 1 band indexes to use. |
raster2 | Input raster 2. |
raster2Bands | Input raster 2 band indexes to use (this vector has the same size as raster1Bands). |
blendMethod | The blend method to apply. |
interpMethod1 | The interpolation method to use when reading raster 1 data. |
interpMethod2 | The interpolation method to use when reading raster 2 data. |
noDataValue | The value returned where there is no pixel data bo blend. |
forceRaster1NoDataValue | Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored) |
forceRaster2NoDataValue | Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored) |
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). |
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). |
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). |
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). |
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. |
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. |
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). |
threadsNumber | Enable/disable the use of threads when applicable (0:automatic , 1:disabled, any other integer dictates the number of threads). |
enableProgressInterface | Enable/disable the use of a progress interface when applicable. |
rulePtr | A pointer to a valid blender rule (this implies using RulesMethod on the blendMethod parameter) or a null pointer. |
enableRasterCache | Enable/disable the use of raster cache. |
|
protected |
Reset the instance to its initial default state.
|
protected |
Implementation for MaxMethod.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
|
protected |
Implementation for MinMethod.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
|
protected |
Implementation for NoBlendMethod.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
|
protected |
Rule based Implementation.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
|
protected |
Set the value of m_blendFuncPtr following the given blend method.
|
protected |
Set the current error message.
newErrorMessage | New error message; |
|
protected |
Implementation for SumMethod.
line | Raster 1 Line. |
col | Raster 1 Column. |
values | A pointer to a pre-allocated vector where the blended values will be stored. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |