te::rst::Interpolator Class Reference

It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neighbor, Bilinear, and Bicubic. More...

#include <Interpolator.h>

Inheritance diagram for te::rst::Interpolator:

Public Types

typedef InterpolationMethod Method
 Allowed interpolation methods. More...
 

Public Member Functions

te::rst::Interpolatorclone () const
 Create a clone copy of this instance. More...
 
void getValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Get the interpolated value at specific band. More...
 
void getValues (const double &c, const double &r, std::vector< std::complex< double > > &values)
 Get the interpolated value for all bands. More...
 
unsigned int getWindowRadius () const
 Get the interpolator windows radius around the target pixel (when applicable). More...
 
 Interpolator (Raster const *r, int m)
 Constructor. More...
 
 Interpolator (Raster const *r, int m, const std::vector< std::complex< double > > &noDataValues)
 Constructor. More...
 
 Interpolator (Raster const *r, int m, const std::vector< std::complex< double > > &noDataValues, const unsigned int windowRadius)
 Constructor. More...
 
virtual ~Interpolator ()
 Destructor. More...
 

Static Public Member Functions

static void getInterpMethodsInfo (std::vector< std::pair< te::rst::InterpolationMethod, std::string > > &info)
 

Protected Types

typedef void(Interpolator::* InterpolationFunction) (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Type definition for the interpolation function. More...
 

Protected Member Functions

void bicubicGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Bicubic interpolation method. More...
 
void bilinearGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Bilinear interpolation method. More...
 
bool initialize (Raster const *const rasterPointer, int method, const std::vector< std::complex< double > > &noDataValues, const unsigned int windowRadius)
 Initialize this instance.. More...
 
void maxGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Max interpolation method. More...
 
void meanGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Mean interpolation method. More...
 
void medianGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Median interpolation method. More...
 
void minGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Min interpolation method. More...
 
void modeGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Mode interpolation method. More...
 
void nearestNeighborGetValue (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
 Nearest neighbor interpolation method. More...
 

Protected Attributes

double m_bicBbufferImag [4][4]
 
double m_bicBbufferReal [4][4]
 
unsigned m_bicBufCol
 
unsigned m_bicBufRow
 
double m_bicColBound
 Last column available for bicubic interpolation. More...
 
unsigned m_bicGridCol
 
unsigned m_bicGridRow
 
double m_bicHSum
 
double m_bicHWeights [4]
 
double m_bicKernel
 
double m_bicOffsetX
 
double m_bicOffsetY
 
double m_bicReadImagValue
 
double m_bicReadRealValue
 
double m_bicRowAccumImag
 
double m_bicRowAccumReal
 
double m_bicRowBound
 Last row available for bicubic interpolation. More...
 
double m_bicRowsValuesImag [4]
 
double m_bicRowsValuesReal [4]
 
double m_bicVSum
 
double m_bicVWeights [4]
 
double m_bilColDifMax
 Maximum difference between columns (min/max). More...
 
double m_bilColDifMin
 Minimum difference between columns (min/max). More...
 
double m_bilColMax
 Maximum column for bilinear interpolation. More...
 
double m_bilColMin
 Minimum column for bilinear interpolation. More...
 
double m_bilDistances [4]
 Bilinear distances. More...
 
double m_bilLastCol
 Last column available for bilinear interpolation. More...
 
double m_bilLastRow
 Last row available for bilinear interpolation. More...
 
double m_bilRowDifMax
 Maximum difference between rows (min/max). More...
 
double m_bilRowDifMin
 Minimum difference between rows (min/max). More...
 
double m_bilRowMax
 Maximum row for bilinear interpolation. More...
 
double m_bilRowMin
 Minimum row for bilinear interpolation. More...
 
std::vector< std::complex< double > > m_bilValues
 Bilinear values;. More...
 
double m_bilWeights [4]
 Bilinear weights;. More...
 
InterpolationFunction m_function
 The current interpolation function pointer. More...
 
int m_method
 The interpolation method. More...
 
unsigned int m_nnCR
 
double m_nnLastCol
 Last column available for nearest Neighbor interpolation. More...
 
double m_nnLastRow
 Last row available for nearest Neighbor interpolation. More...
 
unsigned int m_nnRR
 
std::vector< std::complex< double > > m_noDataValues
 Raster no-data values (for each band);. More...
 
Raster const * m_raster
 My input raster. More...
 
unsigned int m_rasterNCols
 Last raster column index. More...
 
unsigned int m_rasterNRows
 Last raster row index. More...
 
unsigned int m_windowRadius
 Interpolator windows radius around the target pixel (when applicable). More...
 
std::complex< double > m_wInterpAuxCValue
 
std::vector< std::complex< double > > m_wInterpAuxCValues
 
std::vector< unsigned int > m_wInterpAuxCValuesFreq
 
std::size_t m_wInterpAuxCValuesIdx
 
std::size_t m_wInterpAuxCValuesSize
 
bool m_wInterpValueFound
 
long int m_wInterpWindowCol
 
long int m_wInterpWindowColsBound
 
long int m_wInterpWindowFirstCol
 
long int m_wInterpWindowFirstRow
 
long int m_wInterpWindowRow
 
long int m_wInterpWindowRowsBound
 
unsigned int m_wInterpWindowValidElementsCount
 

Detailed Description

It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neighbor, Bilinear, and Bicubic.

Definition at line 55 of file Interpolator.h.

Member Typedef Documentation

◆ InterpolationFunction

typedef void(Interpolator::* te::rst::Interpolator::InterpolationFunction) (const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
protected

Type definition for the interpolation function.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

Definition at line 147 of file Interpolator.h.

◆ Method

Allowed interpolation methods.

Definition at line 62 of file Interpolator.h.

Constructor & Destructor Documentation

◆ Interpolator() [1/3]

te::rst::Interpolator::Interpolator ( Raster const *  r,
int  m 
)

Constructor.

Parameters
rThe raster where to resample.
mThe method of interpolation to apply.

◆ Interpolator() [2/3]

te::rst::Interpolator::Interpolator ( Raster const *  r,
int  m,
const std::vector< std::complex< double > > &  noDataValues 
)

Constructor.

Parameters
rThe raster where to resample.
mThe method of interpolation to apply.
noDataValuesA vector with no-data values (will overwride the input raster no-data values) or an empty vectory if the input raster no-data values must be used.

◆ Interpolator() [3/3]

te::rst::Interpolator::Interpolator ( Raster const *  r,
int  m,
const std::vector< std::complex< double > > &  noDataValues,
const unsigned int  windowRadius 
)

Constructor.

Parameters
rThe raster where to resample.
mThe method of interpolation to apply.
noDataValuesA vector with no-data values (will overwride the input raster no-data values) or an empty vectory if the input raster no-data values must be used.
windowRadiusInterpolator windows radius around the target pixel (when applicable).

◆ ~Interpolator()

virtual te::rst::Interpolator::~Interpolator ( )
virtual

Destructor.

Member Function Documentation

◆ bicubicGetValue()

void te::rst::Interpolator::bicubicGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Bicubic interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ bilinearGetValue()

void te::rst::Interpolator::bilinearGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Bilinear interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ clone()

te::rst::Interpolator* te::rst::Interpolator::clone ( ) const

Create a clone copy of this instance.

Returns
A clone copy of this instance (the caller of this method must take the ownership of the returned object).

◆ getInterpMethodsInfo()

static void te::rst::Interpolator::getInterpMethodsInfo ( std::vector< std::pair< te::rst::InterpolationMethod, std::string > > &  info)
static

◆ getValue()

void te::rst::Interpolator::getValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
inline

Get the interpolated value at specific band.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value or the current input raster no-data value if the requested coordinates are outside the valid image bounds.
bThe band to obtain the value.
Note
The caller of this method must be aware that the returned value may be outside the original input rasters valid values range.

Definition at line 104 of file Interpolator.h.

◆ getValues()

void te::rst::Interpolator::getValues ( const double &  c,
const double &  r,
std::vector< std::complex< double > > &  values 
)

Get the interpolated value for all bands.

Parameters
cThe column position (double).
rThe row position (double).
vA vector of values, for all bands, or the current input raster no-data values if the requested coordinates are outside the valid image bounds..
Note
The caller of this method must be aware that the returned values may be outside the original input rasters valid values range.

◆ getWindowRadius()

unsigned int te::rst::Interpolator::getWindowRadius ( ) const

Get the interpolator windows radius around the target pixel (when applicable).

Returns
Get the interpolator windows radius around the target pixel (when applicable).

◆ initialize()

bool te::rst::Interpolator::initialize ( Raster const *const  rasterPointer,
int  method,
const std::vector< std::complex< double > > &  noDataValues,
const unsigned int  windowRadius 
)
protected

Initialize this instance..

Parameters
rThe raster where to resample.
methodThe method of interpolation to apply.
noDataValuesA vector with no-data values (will overwride the input raster no-data values) or an empty vectory if the input raster no-data values must be used.
windowRadiusInterpolator windows radius around the target pixel (when applicable).
Returns
true if OK, false on errors.

◆ maxGetValue()

void te::rst::Interpolator::maxGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Max interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ meanGetValue()

void te::rst::Interpolator::meanGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Mean interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ medianGetValue()

void te::rst::Interpolator::medianGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Median interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ minGetValue()

void te::rst::Interpolator::minGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Min interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ modeGetValue()

void te::rst::Interpolator::modeGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Mode interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

◆ nearestNeighborGetValue()

void te::rst::Interpolator::nearestNeighborGetValue ( const double &  c,
const double &  r,
std::complex< double > &  v,
const std::size_t &  b 
)
protected

Nearest neighbor interpolation method.

Parameters
cThe column position (double).
rThe row position (double).
vThe output value.
bThe band to obtain the value.

Member Data Documentation

◆ m_bicBbufferImag

double te::rst::Interpolator::m_bicBbufferImag[4][4]
protected

Definition at line 283 of file Interpolator.h.

◆ m_bicBbufferReal

double te::rst::Interpolator::m_bicBbufferReal[4][4]
protected

Definition at line 282 of file Interpolator.h.

◆ m_bicBufCol

unsigned te::rst::Interpolator::m_bicBufCol
protected

Definition at line 279 of file Interpolator.h.

◆ m_bicBufRow

unsigned te::rst::Interpolator::m_bicBufRow
protected

Definition at line 278 of file Interpolator.h.

◆ m_bicColBound

double te::rst::Interpolator::m_bicColBound
protected

Last column available for bicubic interpolation.

Definition at line 296 of file Interpolator.h.

◆ m_bicGridCol

unsigned te::rst::Interpolator::m_bicGridCol
protected

Definition at line 277 of file Interpolator.h.

◆ m_bicGridRow

unsigned te::rst::Interpolator::m_bicGridRow
protected

Definition at line 276 of file Interpolator.h.

◆ m_bicHSum

double te::rst::Interpolator::m_bicHSum
protected

Definition at line 289 of file Interpolator.h.

◆ m_bicHWeights

double te::rst::Interpolator::m_bicHWeights[4]
protected

Definition at line 287 of file Interpolator.h.

◆ m_bicKernel

double te::rst::Interpolator::m_bicKernel
protected

Definition at line 286 of file Interpolator.h.

◆ m_bicOffsetX

double te::rst::Interpolator::m_bicOffsetX
protected

Definition at line 284 of file Interpolator.h.

◆ m_bicOffsetY

double te::rst::Interpolator::m_bicOffsetY
protected

Definition at line 285 of file Interpolator.h.

◆ m_bicReadImagValue

double te::rst::Interpolator::m_bicReadImagValue
protected

Definition at line 281 of file Interpolator.h.

◆ m_bicReadRealValue

double te::rst::Interpolator::m_bicReadRealValue
protected

Definition at line 280 of file Interpolator.h.

◆ m_bicRowAccumImag

double te::rst::Interpolator::m_bicRowAccumImag
protected

Definition at line 292 of file Interpolator.h.

◆ m_bicRowAccumReal

double te::rst::Interpolator::m_bicRowAccumReal
protected

Definition at line 291 of file Interpolator.h.

◆ m_bicRowBound

double te::rst::Interpolator::m_bicRowBound
protected

Last row available for bicubic interpolation.

Definition at line 295 of file Interpolator.h.

◆ m_bicRowsValuesImag

double te::rst::Interpolator::m_bicRowsValuesImag[4]
protected

Definition at line 294 of file Interpolator.h.

◆ m_bicRowsValuesReal

double te::rst::Interpolator::m_bicRowsValuesReal[4]
protected

Definition at line 293 of file Interpolator.h.

◆ m_bicVSum

double te::rst::Interpolator::m_bicVSum
protected

Definition at line 290 of file Interpolator.h.

◆ m_bicVWeights

double te::rst::Interpolator::m_bicVWeights[4]
protected

Definition at line 288 of file Interpolator.h.

◆ m_bilColDifMax

double te::rst::Interpolator::m_bilColDifMax
protected

Maximum difference between columns (min/max).

Definition at line 268 of file Interpolator.h.

◆ m_bilColDifMin

double te::rst::Interpolator::m_bilColDifMin
protected

Minimum difference between columns (min/max).

Definition at line 267 of file Interpolator.h.

◆ m_bilColMax

double te::rst::Interpolator::m_bilColMax
protected

Maximum column for bilinear interpolation.

Definition at line 264 of file Interpolator.h.

◆ m_bilColMin

double te::rst::Interpolator::m_bilColMin
protected

Minimum column for bilinear interpolation.

Definition at line 263 of file Interpolator.h.

◆ m_bilDistances

double te::rst::Interpolator::m_bilDistances[4]
protected

Bilinear distances.

Definition at line 269 of file Interpolator.h.

◆ m_bilLastCol

double te::rst::Interpolator::m_bilLastCol
protected

Last column available for bilinear interpolation.

Definition at line 273 of file Interpolator.h.

◆ m_bilLastRow

double te::rst::Interpolator::m_bilLastRow
protected

Last row available for bilinear interpolation.

Definition at line 272 of file Interpolator.h.

◆ m_bilRowDifMax

double te::rst::Interpolator::m_bilRowDifMax
protected

Maximum difference between rows (min/max).

Definition at line 266 of file Interpolator.h.

◆ m_bilRowDifMin

double te::rst::Interpolator::m_bilRowDifMin
protected

Minimum difference between rows (min/max).

Definition at line 265 of file Interpolator.h.

◆ m_bilRowMax

double te::rst::Interpolator::m_bilRowMax
protected

Maximum row for bilinear interpolation.

Definition at line 262 of file Interpolator.h.

◆ m_bilRowMin

double te::rst::Interpolator::m_bilRowMin
protected

Minimum row for bilinear interpolation.

Definition at line 261 of file Interpolator.h.

◆ m_bilValues

std::vector<std::complex<double> > te::rst::Interpolator::m_bilValues
protected

Bilinear values;.

Definition at line 271 of file Interpolator.h.

◆ m_bilWeights

double te::rst::Interpolator::m_bilWeights[4]
protected

Bilinear weights;.

Definition at line 270 of file Interpolator.h.

◆ m_function

InterpolationFunction te::rst::Interpolator::m_function
protected

The current interpolation function pointer.

Definition at line 246 of file Interpolator.h.

◆ m_method

int te::rst::Interpolator::m_method
protected

The interpolation method.

Definition at line 245 of file Interpolator.h.

◆ m_nnCR

unsigned int te::rst::Interpolator::m_nnCR
protected

Definition at line 254 of file Interpolator.h.

◆ m_nnLastCol

double te::rst::Interpolator::m_nnLastCol
protected

Last column available for nearest Neighbor interpolation.

Definition at line 257 of file Interpolator.h.

◆ m_nnLastRow

double te::rst::Interpolator::m_nnLastRow
protected

Last row available for nearest Neighbor interpolation.

Definition at line 256 of file Interpolator.h.

◆ m_nnRR

unsigned int te::rst::Interpolator::m_nnRR
protected

Definition at line 255 of file Interpolator.h.

◆ m_noDataValues

std::vector< std::complex<double> > te::rst::Interpolator::m_noDataValues
protected

Raster no-data values (for each band);.

Definition at line 247 of file Interpolator.h.

◆ m_raster

Raster const* te::rst::Interpolator::m_raster
protected

My input raster.

Definition at line 244 of file Interpolator.h.

◆ m_rasterNCols

unsigned int te::rst::Interpolator::m_rasterNCols
protected

Last raster column index.

Definition at line 250 of file Interpolator.h.

◆ m_rasterNRows

unsigned int te::rst::Interpolator::m_rasterNRows
protected

Last raster row index.

Definition at line 249 of file Interpolator.h.

◆ m_windowRadius

unsigned int te::rst::Interpolator::m_windowRadius
protected

Interpolator windows radius around the target pixel (when applicable).

Definition at line 248 of file Interpolator.h.

◆ m_wInterpAuxCValue

std::complex<double> te::rst::Interpolator::m_wInterpAuxCValue
protected

Definition at line 309 of file Interpolator.h.

◆ m_wInterpAuxCValues

std::vector< std::complex<double> > te::rst::Interpolator::m_wInterpAuxCValues
protected

Definition at line 310 of file Interpolator.h.

◆ m_wInterpAuxCValuesFreq

std::vector< unsigned int > te::rst::Interpolator::m_wInterpAuxCValuesFreq
protected

Definition at line 311 of file Interpolator.h.

◆ m_wInterpAuxCValuesIdx

std::size_t te::rst::Interpolator::m_wInterpAuxCValuesIdx
protected

Definition at line 308 of file Interpolator.h.

◆ m_wInterpAuxCValuesSize

std::size_t te::rst::Interpolator::m_wInterpAuxCValuesSize
protected

Definition at line 307 of file Interpolator.h.

◆ m_wInterpValueFound

bool te::rst::Interpolator::m_wInterpValueFound
protected

Definition at line 306 of file Interpolator.h.

◆ m_wInterpWindowCol

long int te::rst::Interpolator::m_wInterpWindowCol
protected

Definition at line 304 of file Interpolator.h.

◆ m_wInterpWindowColsBound

long int te::rst::Interpolator::m_wInterpWindowColsBound
protected

Definition at line 302 of file Interpolator.h.

◆ m_wInterpWindowFirstCol

long int te::rst::Interpolator::m_wInterpWindowFirstCol
protected

Definition at line 300 of file Interpolator.h.

◆ m_wInterpWindowFirstRow

long int te::rst::Interpolator::m_wInterpWindowFirstRow
protected

Definition at line 299 of file Interpolator.h.

◆ m_wInterpWindowRow

long int te::rst::Interpolator::m_wInterpWindowRow
protected

Definition at line 303 of file Interpolator.h.

◆ m_wInterpWindowRowsBound

long int te::rst::Interpolator::m_wInterpWindowRowsBound
protected

Definition at line 301 of file Interpolator.h.

◆ m_wInterpWindowValidElementsCount

unsigned int te::rst::Interpolator::m_wInterpWindowValidElementsCount
protected

Definition at line 305 of file Interpolator.h.


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