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...
 
 Interpolator (Raster const *r, int m)
 Constructor. More...
 
 Interpolator (Raster const *r, int m, const std::vector< std::complex< double > > &noDataValues)
 Constructor. More...
 
virtual ~Interpolator ()
 Destructor. More...
 

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)
 Initialize this instance.. 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...
 

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

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 156 of file Interpolator.h.

Allowed interpolation methods.

Definition at line 62 of file Interpolator.h.

Constructor & Destructor Documentation

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

Constructor.

Parameters
rThe raster where to resample.
mThe method of interpolation to apply.
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.
virtual te::rst::Interpolator::~Interpolator ( )
virtual

Destructor.

Member Function Documentation

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.
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.
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).
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 93 of file Interpolator.h.

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.
bool te::rst::Interpolator::initialize ( Raster const *const  rasterPointer,
int  method,
const std::vector< std::complex< double > > &  noDataValues 
)
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.
Returns
true if OK, false on errors.
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

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

Definition at line 207 of file Interpolator.h.

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

Definition at line 206 of file Interpolator.h.

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

Definition at line 203 of file Interpolator.h.

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

Definition at line 202 of file Interpolator.h.

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

Last column available for bicubic interpolation.

Definition at line 220 of file Interpolator.h.

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

Definition at line 201 of file Interpolator.h.

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

Definition at line 200 of file Interpolator.h.

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

Definition at line 213 of file Interpolator.h.

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

Definition at line 211 of file Interpolator.h.

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

Definition at line 210 of file Interpolator.h.

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

Definition at line 208 of file Interpolator.h.

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

Definition at line 209 of file Interpolator.h.

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

Definition at line 205 of file Interpolator.h.

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

Definition at line 204 of file Interpolator.h.

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

Definition at line 216 of file Interpolator.h.

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

Definition at line 215 of file Interpolator.h.

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

Last row available for bicubic interpolation.

Definition at line 219 of file Interpolator.h.

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

Definition at line 218 of file Interpolator.h.

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

Definition at line 217 of file Interpolator.h.

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

Definition at line 214 of file Interpolator.h.

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

Definition at line 212 of file Interpolator.h.

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

Maximum difference between columns (min/max).

Definition at line 192 of file Interpolator.h.

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

Minimum difference between columns (min/max).

Definition at line 191 of file Interpolator.h.

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

Maximum column for bilinear interpolation.

Definition at line 188 of file Interpolator.h.

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

Minimum column for bilinear interpolation.

Definition at line 187 of file Interpolator.h.

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

Bilinear distances.

Definition at line 193 of file Interpolator.h.

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

Last column available for bilinear interpolation.

Definition at line 197 of file Interpolator.h.

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

Last row available for bilinear interpolation.

Definition at line 196 of file Interpolator.h.

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

Maximum difference between rows (min/max).

Definition at line 190 of file Interpolator.h.

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

Minimum difference between rows (min/max).

Definition at line 189 of file Interpolator.h.

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

Maximum row for bilinear interpolation.

Definition at line 186 of file Interpolator.h.

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

Minimum row for bilinear interpolation.

Definition at line 185 of file Interpolator.h.

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

Bilinear values;.

Definition at line 195 of file Interpolator.h.

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

Bilinear weights;.

Definition at line 194 of file Interpolator.h.

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

The current interpolation function pointer.

Definition at line 173 of file Interpolator.h.

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

The interpolation method.

Definition at line 172 of file Interpolator.h.

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

Definition at line 178 of file Interpolator.h.

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

Last column available for nearest Neighbor interpolation.

Definition at line 181 of file Interpolator.h.

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

Last row available for nearest Neighbor interpolation.

Definition at line 180 of file Interpolator.h.

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

Definition at line 179 of file Interpolator.h.

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

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

Definition at line 174 of file Interpolator.h.

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

My input raster.

Definition at line 171 of file Interpolator.h.


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