27 #include "../core/translator/Translator.h" 28 #include "../raster/RasterProperty.h" 29 #include "../raster/Utils.h" 40 #include <gdal_priv.h> 45 m_rasterBand(gdalRasterBandPtr)
55 m_x = std::numeric_limits<int>::max();
57 m_y = std::numeric_limits<int>::max();
71 m_x = std::numeric_limits<int>::max();
73 m_y = std::numeric_limits<int>::max();
84 if(error == CE_Failure || error == CE_Fatal)
92 unsigned char* buff =
reinterpret_cast<unsigned char*
>(
m_buffer);
112 unsigned char* buffer =
new unsigned char[rhs.
getBlockSize()];
117 rhs.
read(x, y, buffer);
166 if(error == CE_Failure || error == CE_Fatal)
178 if(error == CE_Failure || error == CE_Fatal)
186 if( ( x !=
m_x ) || ( y !=
m_y ) )
202 if(error == CE_Failure || error == CE_Fatal)
214 if(error == CE_Failure || error == CE_Fatal)
222 if (rs == 0, cs == 0, rf == 0, cf == 0)
229 if (
m_rasterBand->GetStatistics(!readall,
true, &min, &max, &mean, &stdDev) == CE_None)
231 return std::complex<double>(min, 0.0);
240 if (rs == 0, cs == 0, rf == 0, cf == 0)
247 if (
m_rasterBand->GetStatistics(!readall,
true, &min, &max, &mean, &stdDev) == CE_None)
249 return std::complex<double>(max, 0.0);
258 if (rs == 0, cs == 0, rf == 0, cf == 0)
265 if (
m_rasterBand->GetStatistics(
false,
true, &min, &max, &mean, &stdDev) == CE_None)
267 return std::complex<double>(stdDev, 0.0);
276 if (rs == 0, cs == 0, rf == 0, cf == 0)
283 if (
m_rasterBand->GetStatistics(
false,
true, &min, &max, &mean, &stdDev) == CE_None)
285 return std::complex<double>(mean, 0.0);
294 assert(c >= 0 && c < m_raster->getNumberOfColumns());
295 assert(r >= 0 && r < m_raster->getNumberOfRows());
311 if(error == CE_Failure || error == CE_Fatal)
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer.
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
int m_x
Actual x buffer position.
int m_currC
Block column position.
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
void getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
void * m_buffer
An internal buffer.
This class represents Raster data.
int m_nblocksx
The number of blocks in x.
virtual Band & operator=(const Band &rhs)
Assignment operator.
int m_nblocksy
The number of blocks in y.
Band & operator=(const Band &rhs)
virtual std::complex< double > getStdValue(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the standard deviation of the occurring values in a window of the band...
te::rst::BandProperty * GetBandProperty(GDALRasterBand *gband, const unsigned int bandIndex)
Gets the properties of a single band from a GDAL dataset.
This is a class that represents a GDAL Raster.
int m_currR
Block row position.
int m_currY
Block y position.
te::rst::GetBufferValueFPtr m_getBuff
A pointer to a function that helps to extract a double or complex value from a specific buffer data t...
This class represents raster band description.
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
Band(Raster *rstPtr, std::size_t idx, GDALRasterBand *gdalRasterBandPtr)
Constructor.
virtual std::complex< double > getMaxValue(bool readall=false, unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the maximum occurring value in a window of the band.
virtual std::complex< double > getStdValue(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the standard deviation of the occurring values in a window of the band...
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
An abstract class for raster data strucutures.
int m_blkw
Block width (pixels).
GDALRasterBand * m_rasterBand
GDAL Raster band.
int m_y
Actual y buffer position.
virtual std::complex< double > getMeanValue(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the mean of the occurring values in a window of the band. ...
te::rst::Raster * m_raster
The type of function used to insert/extract data from buffers.
te::rst::SetBufferValueFPtr m_setBuff
A pointer to a function that helps to insert a double or complex value into a specific buffer data ty...
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
~Band()
Virtual destructor.
virtual std::complex< double > getMaxValue(bool readall=false, unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the maximum occurring value in a window of the band.
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
virtual std::complex< double > getMinValue(bool readall=false, unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the minimum occurring value in a window of the band.
virtual std::complex< double > getMeanValue(unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the mean of the occurring values in a window of the band. ...
GDALDataType m_gdaltype
The GDAL Data type.
int getType() const
It returns the data type of the elements in the band.
int m_currX
Block x position.
bool m_update_buffer
Flag to update buffer.
int m_blkh
Block height (pixels).
It gives access to values in one band (dimension) of a raster.
An exception class for the GDAL module.
virtual std::complex< double > getMinValue(bool readall=false, unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0) const
It computes and returns the minimum occurring value in a window of the band.
virtual int getBlockSize() const
It returns the number of bytes ocuppied by a data block.
te::rst::Raster * getRaster() const
Returns the associated raster.
TERASTEREXPORT void SetBlockFunctions(GetBufferValueFPtr *gb, GetBufferValueFPtr *gbi, SetBufferValueFPtr *sb, SetBufferValueFPtr *sbi, int type)
Sets the pointers to functions that helps to extract a double or complex value from a specific buffer...
int placeBuffer(unsigned c, unsigned r) const
Places the buffer in position adequate to obtain row/column values.
BandProperty * m_property
The band information.
Utilitary functions to access GDAL and match some of its concepts to TerraLib concepts.