36 #define BICUBIC_MODULE( x ) ( ( x < 0 ) ? ( -1 * x ) : x ) 37 #define BICUBIC_K1( x , a ) ( ( ( a + 2 ) * x * x * x ) - \ 38 ( ( a + 3 ) * x * x ) + 1 ) 39 #define BICUBIC_K2( x , a ) ( ( a * x * x * x ) - ( 5 * a * x * x ) + \ 40 ( 8 * a * x ) - ( 4 * a ) ) 41 #define BICUBIC_RANGES(x,a) \ 42 ( ( ( 0 <= x ) && ( x <= 1 ) ) ? \ 44 : ( ( ( 1 < x ) && ( x <= 2 ) ) ? \ 47 #define BICUBIC_KERNEL( x , a ) BICUBIC_RANGES( BICUBIC_MODULE(x) , a ) 51 if( !
initialize( r, m, std::vector< std::complex<double> >() ) )
53 throw te::rst::Exception(
"Interpolator initialization error");
58 const std::vector< std::complex<double> >& noDataValues )
62 throw te::rst::Exception(
"Interpolator initialization error");
75 std::complex<double> v;
88 return newInstancePtr;
129 m_bilDistances[3] = std::sqrt((m_bilRowDifMax * m_bilRowDifMax) + (m_bilColDifMin * m_bilColDifMax));
174 v = std::complex<double>(vr,vi);
253 v = std::complex<double>(vr,vi);
257 const std::vector< std::complex<double> >& noDataValues )
259 if( rasterPointer ==
nullptr )
282 throw te::rst::Exception(
"Invalid interpolation method");
292 if( noDataValues.empty() )
294 std::complex<double> auxC;
296 for(
unsigned int bandIdx = 0 ; bandIdx < rasterPointer->
getNumberOfBands() ; ++bandIdx )
306 throw te::rst::Exception(
"Invalid no-data values");
unsigned int unsigned int std::unique_ptr< te::rst::Raster > & rasterPointer
An exception class for the Raster module.
double m_bilWeights[4]
Bilinear weights;.
void getValues(const double &c, const double &r, std::vector< std::complex< double > > &values)
Get the interpolated value for all bands.
void nearestNeighborGetValue(const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
Nearest neighbor interpolation method.
It gives access to values in one band (dimension) of a raster.
Near neighborhood interpolation method.
It describes one band (or dimension) of a raster.
std::vector< std::complex< double > > m_noDataValues
Raster no-data values (for each band);.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
It interpolates one pixel based on a selected algorithm. Methods currently available are Nearest Neig...
bool initialize(Raster const *const rasterPointer, int method, const std::vector< std::complex< double > > &noDataValues)
Initialize this instance..
double m_bilRowMin
Minimum row for bilinear interpolation.
void getValue(const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
Get the interpolated value at specific band.
void bilinearGetValue(const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
Bilinear interpolation method.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
double m_bilColMin
Minimum column for bilinear interpolation.
double m_bilLastCol
Last column available for bilinear interpolation.
std::vector< std::complex< double > > m_bilValues
Bilinear values;.
double m_bilColDifMin
Minimum difference between columns (min/max).
InterpolationFunction m_function
The current interpolation function pointer.
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
Utility functions for the raster module.
te::rst::Interpolator * clone() const
Create a clone copy of this instance.
#define BICUBIC_KERNEL(x, a)
double m_bicBbufferImag[4][4]
double m_bilRowMax
Maximum row for bilinear interpolation.
An abstract class for raster data strucutures.
double m_bicColBound
Last column available for bicubic interpolation.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
double m_nnLastRow
Last row available for nearest Neighbor interpolation.
BandProperty * getProperty()
Returns the band property.
TERASTEREXPORT int Round(double val)
Round a double value to a integer value.
virtual ~Interpolator()
Destructor.
double m_bicRowBound
Last row available for bicubic interpolation.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
double m_bicReadRealValue
double m_bilLastRow
Last row available for bilinear interpolation.
Interpolator(Raster const *r, int m)
Constructor.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
Bicubic interpolation method.
double m_nnLastCol
Last column available for nearest Neighbor interpolation.
double m_bicBbufferReal[4][4]
double m_bilColMax
Maximum column for bilinear interpolation.
void bicubicGetValue(const double &c, const double &r, std::complex< double > &v, const std::size_t &b)
Bicubic interpolation method.
double m_bicReadImagValue
double m_bicRowsValuesImag[4]
Bilinear interpolation method.
double m_bicRowsValuesReal[4]
virtual void getIValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the imaginary attribute value in a complex band of a cell.
int m_method
The interpolation method.
Raster const * m_raster
My input raster.
double m_bilDistances[4]
Bilinear distances.
double m_bilRowDifMax
Maximum difference between rows (min/max).
double m_bilColDifMax
Maximum difference between columns (min/max).
double m_bilRowDifMin
Minimum difference between rows (min/max).
It interpolates one pixel based on a selected algorithm.