te::gdal::Band Class Reference

This class represents raster band description. More...

#include <Band.h>

Inheritance diagram for te::gdal::Band:
te::rst::Band

Public Member Functions

 Band (Raster *rstPtr, std::size_t idx, GDALRasterBand *gdalRasterBandPtr)
 Constructor. More...
 
 Band (const Band &rhs)
 
BandcallOperator (std::complex< double >(*f)(std::complex< double >, std::complex< double >), Band &rhs)
 It calls a parameter function f to apply in all pixels from two bands, e.g. pixel = f(lhs, rhs);. More...
 
BandcallOperator (std::complex< double >(*f)(std::complex< double >, std::complex< double >), std::complex< double > &cvalue)
 It calls a parameter function f to apply in all pixels from the band, e.g. pixel = f(lhs, rhs);. More...
 
virtual int getBlockSize () const
 It returns the number of bytes ocuppied by a data block. More...
 
virtual std::map< double, unsigned > getHistogramI (unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0, unsigned int b=0) const
 It computes and returns the histogram occurring values (imaginary part) in a window of the band. More...
 
virtual std::map< double, unsigned > getHistogramR (unsigned int rs=0, unsigned int cs=0, unsigned int rf=0, unsigned int cf=0, unsigned int b=0) const
 It computes and returns the histogram occurring values (real part) in a window of the band. More...
 
void getIValue (unsigned int c, unsigned int r, double &value) const
 Returns the imaginary attribute value in a complex band of a cell. More...
 
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. More...
 
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. More...
 
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. More...
 
std::complex< double > getOffsetValue () const
 It returns the offset values (real and imaginary) to be applied to the band. More...
 
BandProperty * getProperty ()
 Returns the band property. More...
 
const BandProperty * getProperty () const
 Returns the band property. More...
 
te::rst::RastergetRaster () const
 Returns the associated raster. More...
 
std::complex< double > getScaleValue () const
 It returns the scale values (real and imaginary) to be applied to the band. More...
 
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. More...
 
void getValue (unsigned int c, unsigned int r, double &value) const
 Returns the cell attribute value. More...
 
void getValue (unsigned int c, unsigned int r, std::complex< double > &value) const
 Returns the imaginary attribute value in a complex band of a cell. More...
 
void getValueFromBlock (void *block, unsigned int pos, std::complex< double > &value) const
 
void getValueFromBlock (void *block, unsigned int pos, double &value) const
 
virtual Bandoperator*= (Band &rhs)
 It returns the band product (pixel by pixel). More...
 
virtual Bandoperator*= (std::complex< double > &cvalue)
 It returns the product of a constant value to all pixels in the band. More...
 
virtual Bandoperator+= (Band &rhs)
 It returns the band sum (pixel by pixel). More...
 
virtual Bandoperator+= (std::complex< double > &cvalue)
 It returns the sum of a constant value to all pixels in the band. More...
 
virtual Bandoperator-= (Band &rhs)
 It returns the band subtraction (pixel by pixel). More...
 
virtual Bandoperator-= (std::complex< double > &cvalue)
 It returns the difference from all pixels in the band to a constant value (pixel - constant). More...
 
virtual Bandoperator/= (Band &rhs)
 It returns the band division (pixel by pixel). More...
 
virtual Bandoperator/= (std::complex< double > &cvalue)
 It returns the division of all pixels in the band by a constant value (pixel / constant). More...
 
Bandoperator= (const Band &rhs)
 
void read (int x, int y, void *buffer) const
 It reads a data block to the specified buffer. More...
 
void * read (int, int)
 It reads and returns a data block. More...
 
void setIValue (unsigned int c, unsigned int r, const double value)
 Sets the imaginary attribute value in a complex band of a cell. More...
 
void setOffsetValue (const std::complex< double > o)
 Sets the offset values (real and imaginary) to be applied to the band. More...
 
void setScaleValue (const std::complex< double > s)
 Sets the scale values (real and imaginary) to be applied to the band. More...
 
void setValue (unsigned int c, unsigned int r, const double value)
 Sets the cell attribute value. More...
 
void setValue (unsigned int c, unsigned int r, const std::complex< double > &value)
 Sets the imaginary attribute value in a complex band of a cell. More...
 
void write (int x, int y, void *buffer)
 It writes a data block from the specified buffer. More...
 
 ~Band ()
 Virtual destructor. More...
 

Protected Attributes

std::size_t m_idx
 The band index. More...
 
BandProperty * m_property
 The band information. More...
 

Private Member Functions

int placeBuffer (unsigned c, unsigned r) const
 Places the buffer in position adequate to obtain row/column values. More...
 

Private Attributes

void * m_buffer
 An internal buffer. More...
 
int m_currC
 Block column position. More...
 
int m_currR
 Block row position. More...
 
int m_currX
 Block x position. More...
 
int m_currY
 Block y position. More...
 
GDALDataType m_gdaltype
 The GDAL Data type. More...
 
te::rst::GetBufferValueFPtr m_getBuff
 A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...). More...
 
te::rst::GetBufferValueFPtr m_getBuffI
 A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble). More...
 
int m_i
 Block index. More...
 
te::rst::Rasterm_raster
 The type of function used to insert/extract data from buffers. More...
 
GDALRasterBand * m_rasterBand
 GDAL Raster band. More...
 
te::rst::SetBufferValueFPtr m_setBuff
 A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...). More...
 
te::rst::SetBufferValueFPtr m_setBuffI
 A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble). More...
 
bool m_update_buffer
 Flag to update buffer. More...
 
int m_x
 Actual x buffer position. More...
 
int m_y
 Actual y buffer position. More...
 

Detailed Description

This class represents raster band description.

This class is a concrete implementation of a Raster Band using the GDAL library to access the data.

See also
te::rst::Band, te::rst::BandProperty

Definition at line 64 of file Band.h.

Constructor & Destructor Documentation

te::gdal::Band::Band ( Raster rstPtr,
std::size_t  idx,
GDALRasterBand *  gdalRasterBandPtr 
)

Constructor.

Parameters
rstPtrA pointer to the parent raster.
idxThis band index.
gdalRasterBandPtrThe GDAL band related to this terralib band.
Warning
The caller is responsible for providing correct values for the range [c x r].
te::gdal::Band::Band ( const Band rhs)
te::gdal::Band::~Band ( )
virtual

Virtual destructor.

Reimplemented from te::rst::Band.

Member Function Documentation

Band& te::rst::Band::callOperator ( std::complex< double >(*)(std::complex< double >, std::complex< double >)  f,
Band rhs 
)
inherited

It calls a parameter function f to apply in all pixels from two bands, e.g. pixel = f(lhs, rhs);.

Parameters
(*f)a function with the signature complex<double>(*f)(complex<double>, complex<double>)
rhsThe rhs band to apply the function.
Returns
The resultant band.
Band& te::rst::Band::callOperator ( std::complex< double >(*)(std::complex< double >, std::complex< double >)  f,
std::complex< double > &  cvalue 
)
inherited

It calls a parameter function f to apply in all pixels from the band, e.g. pixel = f(lhs, rhs);.

Parameters
(*f)a function with the signature complex<double>(*f)(complex<double>, complex<double>)
cvalueThe constant value that will work with the generic function.
Returns
The resultant band.
virtual int te::rst::Band::getBlockSize ( ) const
virtualinherited

It returns the number of bytes ocuppied by a data block.

Reimplemented in te::mem::Band.

Referenced by te::rst::BandIteratorWindow< T >::BandIteratorWindow().

virtual std::map<double, unsigned> te::rst::Band::getHistogramI ( unsigned int  rs = 0,
unsigned int  cs = 0,
unsigned int  rf = 0,
unsigned int  cf = 0,
unsigned int  b = 0 
) const
virtualinherited

It computes and returns the histogram occurring values (imaginary part) in a window of the band.

Parameters
rsThe starting row.
csThe starting column.
rfThe final row.
cfThe final column.
bThe number of bins (intervals from minimum pixel to maximum). When b = 0, the histogram will be divided according to all pixel values.
Note
This method without parameters will compute for the entire raster band.
Warning
The caller is responsible for providing correct values for the range [rs, cs x rf, cf].
Returns
The histogram of the occurring values (imaginary part) in the window.
virtual std::map<double, unsigned> te::rst::Band::getHistogramR ( unsigned int  rs = 0,
unsigned int  cs = 0,
unsigned int  rf = 0,
unsigned int  cf = 0,
unsigned int  b = 0 
) const
virtualinherited

It computes and returns the histogram occurring values (real part) in a window of the band.

Parameters
rsThe starting row.
csThe starting column.
rfThe final row.
cfThe final column.
bThe number of bins (intervals from minimum pixel to maximum). When b = 0, the histogram will be divided according to all pixel values.
Note
This method without parameters will compute for the entire raster band.
Warning
The caller is responsible for providing correct values for the range [rs, cs x rf, cf].
Returns
The histogram of the occurring values (real part) in the window.
void te::gdal::Band::getIValue ( unsigned int  c,
unsigned int  r,
double &  value 
) const
virtual

Returns the imaginary attribute value in a complex band of a cell.

Parameters
cThe column location of the cell.
rThe row location of the cell.
valueThe attribute value to be assigned.
Warning
The caller is responsible for providing correct values for the range [c x r].
Exceptions
ExceptionSubclasses may throw an exception if the data value can not be read.

Implements te::rst::Band.

virtual std::complex<double> te::rst::Band::getMaxValue ( bool  readall = false,
unsigned int  rs = 0,
unsigned int  cs = 0,
unsigned int  rf = 0,
unsigned int  cf = 0 
) const
virtualinherited

It computes and returns the maximum occurring value in a window of the band.

Parameters
readallForce the reading the entire image (can be slow). If false, will read up to 1000 pixels of the image, equally spaced.
rsThe starting row.
csThe starting column.
rfThe final row.
cfThe final column.
Note
This method without parameters will compute for the entire raster band.
Warning
The caller is responsible for providing correct values for the range [rs, cs x rf, cf].
Returns
The maximum occurring value in the window, real and imaginary (if present).
virtual std::complex<double> te::rst::Band::getMeanValue ( unsigned int  rs = 0,
unsigned int  cs = 0,
unsigned int  rf = 0,
unsigned int  cf = 0 
) const
virtualinherited

It computes and returns the mean of the occurring values in a window of the band.

Parameters
rsThe starting row.
csThe starting column.
rfThe final row.
cfThe final column.
Note
This method without parameters will compute for the entire raster band.
Warning
The caller is responsible for providing correct values for the range [rs, cs x rf, cf].
Returns
The mean of the occurring values in the window, real and imaginary (if present).
virtual std::complex<double> te::rst::Band::getMinValue ( bool  readall = false,
unsigned int  rs = 0,
unsigned int  cs = 0,
unsigned int  rf = 0,
unsigned int  cf = 0 
) const
virtualinherited

It computes and returns the minimum occurring value in a window of the band.

Parameters
readallForce the reading the entire image (can be slow). If false, will read up to 1000 pixels of the image, equally spaced.
rsThe starting row.
csThe starting column.
rfThe final row.
cfThe final column.
Note
This method without parameters will compute for the entire image.
Warning
The caller is responsible for providing correct values for the range [rs, cs x rf, cf x b].
Returns
The minimum occurring value in the window, real and imaginary (if present).
std::complex<double> te::rst::Band::getOffsetValue ( ) const
inherited

It returns the offset values (real and imaginary) to be applied to the band.

const BandProperty* te::rst::Band::getProperty ( ) const
inherited

Returns the band property.

te::rst::Raster* te::gdal::Band::getRaster ( ) const
virtual

Returns the associated raster.

Implements te::rst::Band.

std::complex<double> te::rst::Band::getScaleValue ( ) const
inherited

It returns the scale values (real and imaginary) to be applied to the band.

virtual std::complex<double> te::rst::Band::getStdValue ( unsigned int  rs = 0,
unsigned int  cs = 0,
unsigned int  rf = 0,
unsigned int  cf = 0 
) const
virtualinherited

It computes and returns the standard deviation of the occurring values in a window of the band.

Parameters
rsThe starting row.
csThe starting column.
rfThe final row.
cfThe final column.
Note
This method without parameters will compute for the entire raster band.
Warning
The caller is responsible for providing correct values for the range [rs, cs x rf, cf].
Returns
The standard deviation of the occurring values in the window, real and imaginary (if present).
void te::gdal::Band::getValue ( unsigned int  c,
unsigned int  r,
double &  value 
) const
virtual

Returns the cell attribute value.

Parameters
cThe column location of the cell.
rThe row location of the cell.
valueTo return the attribute value.
Warning
The caller is responsible for providing correct values for the range [c x r].
Exceptions
ExceptionSubclasses may throw an exception if the data value can not be read.

Implements te::rst::Band.

void te::gdal::Band::getValue ( unsigned int  c,
unsigned int  r,
std::complex< double > &  value 
) const
inlinevirtual

Returns the imaginary attribute value in a complex band of a cell.

Parameters
cThe column location of the cell.
rThe row location of the cell.
valueThe complex attribute value to be assigned (real, imaginary).
Warning
The caller is responsible for providing correct values for the range [c x r].
Exceptions
ExceptionSubclasses may throw an exception if the data value can not be read.

Reimplemented from te::rst::Band.

Definition at line 95 of file Band.h.

References te::rst::Band::getValue().

void te::gdal::Band::getValueFromBlock ( void *  block,
unsigned int  pos,
std::complex< double > &  value 
) const
void te::gdal::Band::getValueFromBlock ( void *  block,
unsigned int  pos,
double &  value 
) const
virtual Band& te::rst::Band::operator*= ( Band rhs)
virtualinherited

It returns the band product (pixel by pixel).

Parameters
rhsThe band to be multiplied, right-hand side.
Note
Both bands must have the same properties, #columns, #rows, and data type.
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band product.
virtual Band& te::rst::Band::operator*= ( std::complex< double > &  cvalue)
virtualinherited

It returns the product of a constant value to all pixels in the band.

Parameters
cvalueThe constant value to be multiplied.
Note
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band product.
virtual Band& te::rst::Band::operator+= ( Band rhs)
virtualinherited

It returns the band sum (pixel by pixel).

Parameters
rhsThe band to be added, right-hand side.
Note
Both bands must have the same properties, #columns, #rows, and data type.
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band sum.
virtual Band& te::rst::Band::operator+= ( std::complex< double > &  cvalue)
virtualinherited

It returns the sum of a constant value to all pixels in the band.

Parameters
cvalueThe constant value to be added.
Note
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band sum.
virtual Band& te::rst::Band::operator-= ( Band rhs)
virtualinherited

It returns the band subtraction (pixel by pixel).

Parameters
rhsThe band to be subtracted, right-hand side.
Note
Both bands must have the same properties, #columns, #rows, and data type.
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band subtraction.
virtual Band& te::rst::Band::operator-= ( std::complex< double > &  cvalue)
virtualinherited

It returns the difference from all pixels in the band to a constant value (pixel - constant).

Parameters
cvalueThe constant value to be subtracted.
Note
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band difference.
virtual Band& te::rst::Band::operator/= ( Band rhs)
virtualinherited

It returns the band division (pixel by pixel).

Parameters
rhsThe band to be divided, right-hand side.
Note
Both bands must have the same properties, #columns, #rows, and data type.
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band division.
virtual Band& te::rst::Band::operator/= ( std::complex< double > &  cvalue)
virtualinherited

It returns the division of all pixels in the band by a constant value (pixel / constant).

Parameters
cvalueThe constant value to be divided.
Note
The caller is responsible to guarantee that resultant values will not exceed the range of the data type.
Returns
The band division.
Band& te::gdal::Band::operator= ( const Band rhs)
int te::gdal::Band::placeBuffer ( unsigned  c,
unsigned  r 
) const
private

Places the buffer in position adequate to obtain row/column values.

Parameters
cThe column in band to manipulate value.
rThe row in band to manipulate value.
Warning
The caller is responsible for providing correct values for the range [c x r].
void te::gdal::Band::read ( int  x,
int  y,
void *  buffer 
) const
virtual

It reads a data block to the specified buffer.

Parameters
xThe block-id in x (or x-offset).
yThe block-id in y (or y-offset).
bufferThe buffer to be used to read from the band.
Note
The upper-left corner is (0, 0).
Warning
The buffer must have been previously allocated and must have enough capacity.

Implements te::rst::Band.

void* te::gdal::Band::read ( int  x,
int  y 
)
virtual

It reads and returns a data block.

Parameters
xThe block-id in x (or x-offset).
yThe block-id in y (or y-offset).
Note
The upper-left corner is (0, 0).
Returns
The specified data block.

Implements te::rst::Band.

void te::gdal::Band::setIValue ( unsigned int  c,
unsigned int  r,
const double  value 
)
virtual

Sets the imaginary attribute value in a complex band of a cell.

Parameters
cThe column location of the cell.
rThe row location of the cell.
valueThe attribute value to be assigned.
Warning
The caller is responsible for providing correct values for the range [c x r].
Exceptions
ExceptionSubclasses may throw an exception if the data value can not be write.

Implements te::rst::Band.

void te::rst::Band::setOffsetValue ( const std::complex< double >  o)
inherited

Sets the offset values (real and imaginary) to be applied to the band.

Parameters
oThe new offset.
void te::rst::Band::setScaleValue ( const std::complex< double >  s)
inherited

Sets the scale values (real and imaginary) to be applied to the band.

Parameters
sThe new scale.
void te::gdal::Band::setValue ( unsigned int  c,
unsigned int  r,
const double  value 
)
virtual

Sets the cell attribute value.

Parameters
cThe column location of the cell.
rThe row location of the cell.
valueThe attribute value to be assigned.
Warning
The caller is responsible for providing correct values for the range [c x r].
Exceptions
ExceptionSubclasses may throw an exception if the data value can not be write.

Implements te::rst::Band.

void te::gdal::Band::setValue ( unsigned int  c,
unsigned int  r,
const std::complex< double > &  value 
)
inlinevirtual

Sets the imaginary attribute value in a complex band of a cell.

Parameters
cThe column location of the cell.
rThe row location of the cell.
valueThe complex attribute value to be assigned (real, imaginary).
Warning
The caller is responsible for providing correct values for the range [c x r].
Exceptions
ExceptionSubclasses may throw an exception if the data value can not be write.

Reimplemented from te::rst::Band.

Definition at line 97 of file Band.h.

References te::rst::Band::setValue().

void te::gdal::Band::write ( int  x,
int  y,
void *  buffer 
)
virtual

It writes a data block from the specified buffer.

Parameters
xThe block-id in x (or x-offset).
yThe block-id in y (or y-offset).
bufferThe buffer to be used to write to the band.
Note
The upper-left corner is (0, 0).
Warning
The method will copy the same amount of bytes used by the internal band block representation.

Implements te::rst::Band.

Member Data Documentation

void* te::gdal::Band::m_buffer
private

An internal buffer.

Definition at line 133 of file Band.h.

int te::gdal::Band::m_currC
mutableprivate

Block column position.

Definition at line 141 of file Band.h.

int te::gdal::Band::m_currR
mutableprivate

Block row position.

Definition at line 142 of file Band.h.

int te::gdal::Band::m_currX
mutableprivate

Block x position.

Definition at line 139 of file Band.h.

int te::gdal::Band::m_currY
mutableprivate

Block y position.

Definition at line 140 of file Band.h.

GDALDataType te::gdal::Band::m_gdaltype
private

The GDAL Data type.

Definition at line 132 of file Band.h.

te::rst::GetBufferValueFPtr te::gdal::Band::m_getBuff
private

A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...).

Definition at line 128 of file Band.h.

te::rst::GetBufferValueFPtr te::gdal::Band::m_getBuffI
private

A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble).

Definition at line 129 of file Band.h.

int te::gdal::Band::m_i
mutableprivate

Block index.

Definition at line 143 of file Band.h.

std::size_t te::rst::Band::m_idx
protectedinherited

The band index.

Definition at line 475 of file Band.h.

BandProperty* te::rst::Band::m_property
protectedinherited

The band information.

Definition at line 474 of file Band.h.

te::rst::Raster* te::gdal::Band::m_raster
private

The type of function used to insert/extract data from buffers.

The Raster associated to this band.

Definition at line 126 of file Band.h.

GDALRasterBand* te::gdal::Band::m_rasterBand
private

GDAL Raster band.

Definition at line 127 of file Band.h.

te::rst::SetBufferValueFPtr te::gdal::Band::m_setBuff
private

A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...).

Definition at line 130 of file Band.h.

te::rst::SetBufferValueFPtr te::gdal::Band::m_setBuffI
private

A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble).

Definition at line 131 of file Band.h.

bool te::gdal::Band::m_update_buffer
mutableprivate

Flag to update buffer.

Definition at line 136 of file Band.h.

int te::gdal::Band::m_x
mutableprivate

Actual x buffer position.

Definition at line 134 of file Band.h.

int te::gdal::Band::m_y
mutableprivate

Actual y buffer position.

Definition at line 135 of file Band.h.


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