Composed pixel value calculation for two overlaped rasters. More...

#include <Composer.h>

Classes

class  ComposeIntoRaster3ThreadParams
 The parameters passed to composeIntoRaster1Thread method. More...
 
struct  RasterBlockInfo
 Raster block info. More...
 

Public Member Functions

bool composeIntoRaster3 ()
 Execute a composition of the given input rasters and write the result into raster 3. More...
 
 Composer ()
 
void getComposedValues (const double &line, const double &col, double *const values)
 Compose 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, te::rst::Raster &raster3, const std::vector< unsigned int > &raster3Bands, 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, const unsigned int threadsNumber, const bool enableProgressInterface, ComposerRule const *const rulePtr, const bool enableRasterCache)
 Inititate the composer instance. More...
 
 ~Composer ()
 

Protected Member Functions

void clear ()
 Clear all internal allocated resources. More...
 
void initState ()
 Reset the instance to its initial default state. More...
 
void setErrorMessage (const std::string &newErrorMessage)
 Set the current error message. More...
 

Static Protected Member Functions

static void composeIntoRaster3Thread (ComposeIntoRaster3ThreadParams *paramsPtr)
 Thread entry for the method composeIntoRaster1. More...
 

Protected Attributes

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...
 
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::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...
 
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 composeed 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 composeed 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 composeed 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 composeed value calcule (one element for each used raster channel/band). More...
 
std::vector< unsigned int > m_raster1Bands
 Input raster 1 band indexes to use. More...
 
te::rst::Raster const * m_raster1Ptr
 Raster 1. More...
 
std::vector< unsigned int > m_raster2Bands
 Input raster 2 band indexes to use. More...
 
te::rst::Raster const * m_raster2Ptr
 Raster 2. More...
 
std::vector< unsigned int > m_raster3Bands
 Input raster 3 band indexes to use. More...
 
te::rst::Rasterm_raster3Ptr
 Raster 3. More...
 
std::unique_ptr< ComposerRulem_rulePtr
 Composer rule pointer. More...
 
unsigned int m_threadsNumber
 The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of threads).. More...
 

Private Member Functions

 Composer (const Composer &other)
 
Composeroperator= (const Composer &other)
 

Detailed Description

Composed pixel value calculation for two overlaped rasters.

A rule used by the te::rst::Composer 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.

Note
Optimized for rasters where all bands have the same blocking scheme.

Definition at line 54 of file Composer.h.

Constructor & Destructor Documentation

◆ Composer() [1/2]

te::rp::Composer::Composer ( )

Default constructor.

◆ ~Composer()

te::rp::Composer::~Composer ( )

Default destructor.

◆ Composer() [2/2]

te::rp::Composer::Composer ( const Composer other)
private

Member Function Documentation

◆ clear()

void te::rp::Composer::clear ( )
protected

Clear all internal allocated resources.

◆ composeIntoRaster3()

bool te::rp::Composer::composeIntoRaster3 ( )

Execute a composition of the given input rasters and write the result into raster 3.

Note
Raster 1 values have precedence over raster 2 values (when applicable).

◆ composeIntoRaster3Thread()

static void te::rp::Composer::composeIntoRaster3Thread ( ComposeIntoRaster3ThreadParams paramsPtr)
staticprotected

Thread entry for the method composeIntoRaster1.

◆ getComposedValues()

void te::rp::Composer::getComposedValues ( const double &  line,
const double &  col,
double *const  values 
)
inline

Compose a pixel value using the current parameters.

Parameters
lineLine (raster 3 reference).
colColumn (raster 3 reference).
valuesA pointer to a pre-allocated vector where the composeed values will be stored.
Note
The caller of this method must be aware that the returned composeed value may be outside the original input rasters valid values range.
Raster 1 values have precedence over raster 2 values (when applicable).

Definition at line 119 of file Composer.h.

References TERP_DEBUG_TRUE_OR_THROW.

◆ getErrorMessage()

const std::string& te::rp::Composer::getErrorMessage ( ) const

Return the current error message if there is any.

Returns
Return the current error message if there is any.

◆ initialize()

bool te::rp::Composer::initialize ( te::rst::Raster raster1,
const std::vector< unsigned int > &  raster1Bands,
const te::rst::Raster raster2,
const std::vector< unsigned int > &  raster2Bands,
te::rst::Raster raster3,
const std::vector< unsigned int > &  raster3Bands,
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,
const unsigned int  threadsNumber,
const bool  enableProgressInterface,
ComposerRule const *const  rulePtr,
const bool  enableRasterCache 
)

Inititate the composer instance.

Parameters
raster1Raster 1.
raster1BandsRaster 1 band indexes to use.
raster2Raster 2.
raster2BandsRaster 2 band indexes to use (this vector has the same size as raster1Bands).
raster3Raster 3.
raster3BandsRaster 3 band indexes to use (this vector has the same size as raster1Bands).
interpMethod1The interpolation method to use when reading raster 1 data.
interpMethod2The interpolation method to use when reading raster 2 data.
noDataValueThe value returned where there is no pixel data bo compose.
forceRaster1NoDataValueUse noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
forceRaster2NoDataValueUse noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)
pixelOffsets1The values offset to be applied to raster 1 pixel values before the composeed value calcule (one element for each used raster channel/band).
pixelScales1The values scale to be applied to raster 1 pixel values before the composeed value calcule (one element for each used raster channel/band).
pixelOffsets2The values offset to be applied to raster 2 pixel values before the composeed value calcule (one element for each used raster channel/band).
pixelScales2The values scale to be applied to raster 2 pixel values before the composeed value calcule (one element for each used raster channel/band).
threadsNumberEnable/disable the use of threads when applicable (0:automatic , 1:disabled, any other integer dictates the number of threads).
enableProgressInterfaceEnable/disable the use of a progress interface when applicable.
rulePtrA pointer to a valid composer rule.
enableRasterCacheEnable/disable the use of raster cache.
Returns
true if ok, false on errors
Note
Aboute scale and offset parametrs: outValue = ( inputValue * scale ) + offset
All raster 3 bands must have the same blocking scheme.

◆ initState()

void te::rp::Composer::initState ( )
protected

Reset the instance to its initial default state.

◆ operator=()

Composer& te::rp::Composer::operator= ( const Composer other)
private

◆ setErrorMessage()

void te::rp::Composer::setErrorMessage ( const std::string &  newErrorMessage)
protected

Set the current error message.

Parameters
newErrorMessageNew error message;

Member Data Documentation

◆ m_enableProgressInterface

bool te::rp::Composer::m_enableProgressInterface
protected

Enable progress interface.

Definition at line 201 of file Composer.h.

◆ m_enableRasterCache

bool te::rp::Composer::m_enableRasterCache
protected

enable/disable the use of raster cache.

Definition at line 220 of file Composer.h.

◆ m_errorMessage

std::string te::rp::Composer::m_errorMessage
protected

Current error message.

Definition at line 219 of file Composer.h.

◆ m_forceRaster1NoDataValue

bool te::rp::Composer::m_forceRaster1NoDataValue
protected

Use noDataValue as the input raster 1 no-data value (The original rasters no-data values will be ignored)

Definition at line 202 of file Composer.h.

◆ m_forceRaster2NoDataValue

bool te::rp::Composer::m_forceRaster2NoDataValue
protected

Use noDataValue as the input raster 2 no-data value (The original rasters no-data values will be ignored)

Definition at line 203 of file Composer.h.

◆ m_interpMethod1

te::rst::Interpolator::Method te::rp::Composer::m_interpMethod1
protected

The interpolation method to use when reading raster 1 data.

Definition at line 208 of file Composer.h.

◆ m_interpMethod2

te::rst::Interpolator::Method te::rp::Composer::m_interpMethod2
protected

The interpolation method to use when reading raster 2 data.

Definition at line 209 of file Composer.h.

◆ m_outputNoDataValue

double te::rp::Composer::m_outputNoDataValue
protected

The output raster no-data value.

Definition at line 210 of file Composer.h.

◆ m_pixelOffsets1

std::vector< double > te::rp::Composer::m_pixelOffsets1
protected

The values offset to be applied to raster 1 pixel values before the composeed value calcule (one element for each used raster channel/band).

Definition at line 214 of file Composer.h.

◆ m_pixelOffsets2

std::vector< double > te::rp::Composer::m_pixelOffsets2
protected

The values offset to be applied to raster 2 pixel values before the composeed value calcule (one element for each used raster channel/band).

Definition at line 216 of file Composer.h.

◆ m_pixelScales1

std::vector< double > te::rp::Composer::m_pixelScales1
protected

The values scale to be applied to raster 1 pixel values before the composeed value calcule (one element for each used raster channel/band).

Definition at line 215 of file Composer.h.

◆ m_pixelScales2

std::vector< double > te::rp::Composer::m_pixelScales2
protected

The values scale to be applied to raster 2 pixel values before the composeed value calcule (one element for each used raster channel/band).

Definition at line 217 of file Composer.h.

◆ m_raster1Bands

std::vector< unsigned int > te::rp::Composer::m_raster1Bands
protected

Input raster 1 band indexes to use.

Definition at line 211 of file Composer.h.

◆ m_raster1Ptr

te::rst::Raster const* te::rp::Composer::m_raster1Ptr
protected

Raster 1.

Definition at line 205 of file Composer.h.

◆ m_raster2Bands

std::vector< unsigned int > te::rp::Composer::m_raster2Bands
protected

Input raster 2 band indexes to use.

Definition at line 212 of file Composer.h.

◆ m_raster2Ptr

te::rst::Raster const* te::rp::Composer::m_raster2Ptr
protected

Raster 2.

Definition at line 206 of file Composer.h.

◆ m_raster3Bands

std::vector< unsigned int > te::rp::Composer::m_raster3Bands
protected

Input raster 3 band indexes to use.

Definition at line 213 of file Composer.h.

◆ m_raster3Ptr

te::rst::Raster* te::rp::Composer::m_raster3Ptr
protected

Raster 3.

Definition at line 207 of file Composer.h.

◆ m_rulePtr

std::unique_ptr< ComposerRule > te::rp::Composer::m_rulePtr
protected

Composer rule pointer.

Definition at line 218 of file Composer.h.

◆ m_threadsNumber

unsigned int te::rp::Composer::m_threadsNumber
protected

The number of threads to use (0:automatic , 1:disabled, any other integer dictates the number of threads)..

Definition at line 204 of file Composer.h.


The documentation for this class was generated from the following file: