te::mem::CachedBand Class Reference

RAM cached and tiled raster band. More...

#include <CachedBand.h>

Inheritance diagram for te::mem::CachedBand:
te::rst::Band

Public Member Functions

 CachedBand (CachedBandBlocksManager &blocksManager, std::size_t idx)
 Constructor. More...
 
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...
 
virtual 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...
 
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...
 
void read (int x, int y, void *buffer) const
 It reads a data block to the specified buffer. More...
 
void * read (int x, int y)
 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...
 
virtual 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...
 
 ~CachedBand ()
 

Protected Attributes

unsigned int m_blkHeight
 The current band blocks height. More...
 
unsigned int m_blkSizeBytes
 The blocks size (bytes);. More...
 
unsigned int m_blkWidth
 The current band blocks width. More...
 
CachedBandBlocksManagerm_blocksManager
 The external blocks manager reference. 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...
 
std::size_t m_idx
 The band index. More...
 
BandProperty * m_property
 The band information. 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...
 
unsigned int m_setGetBlkX
 
unsigned int m_setGetBlkY
 
void * m_setGetBufPtr
 
unsigned int m_setGetPos
 

Static Protected Attributes

static CachedBandBlocksManager dummyBlocksManager
 A global static dummy blocks manager. More...
 

Private Member Functions

 CachedBand ()
 

Detailed Description

RAM cached and tiled raster band.

A cache adaptor to an external existent raster band that must always be avaliable.

Definition at line 53 of file CachedBand.h.

Constructor & Destructor Documentation

te::mem::CachedBand::CachedBand ( CachedBandBlocksManager blocksManager,
std::size_t  idx 
)

Constructor.

Parameters
blocksManagerThe blocks manager where to read/write data.
idxThe band index.
te::mem::CachedBand::~CachedBand ( )
te::mem::CachedBand::CachedBand ( )
private

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::mem::CachedBand::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::mem::CachedBand::getRaster ( ) const
inlinevirtual

Returns the associated raster.

Implements te::rst::Band.

Definition at line 67 of file CachedBand.h.

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::mem::CachedBand::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.

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

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 in te::gdal::Band.

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.
void te::mem::CachedBand::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::mem::CachedBand::read ( int  x,
int  y 
)
inlinevirtual

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.

Definition at line 82 of file CachedBand.h.

void te::mem::CachedBand::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::mem::CachedBand::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.

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

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 in te::gdal::Band.

void te::mem::CachedBand::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

CachedBandBlocksManager te::mem::CachedBand::dummyBlocksManager
staticprotected

A global static dummy blocks manager.

Definition at line 114 of file CachedBand.h.

unsigned int te::mem::CachedBand::m_blkHeight
protected

The current band blocks height.

Definition at line 98 of file CachedBand.h.

unsigned int te::mem::CachedBand::m_blkSizeBytes
protected

The blocks size (bytes);.

Definition at line 99 of file CachedBand.h.

unsigned int te::mem::CachedBand::m_blkWidth
protected

The current band blocks width.

Definition at line 97 of file CachedBand.h.

CachedBandBlocksManager& te::mem::CachedBand::m_blocksManager
protected

The external blocks manager reference.

Definition at line 112 of file CachedBand.h.

te::rst::GetBufferValueFPtr te::mem::CachedBand::m_getBuff
protected

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 101 of file CachedBand.h.

te::rst::GetBufferValueFPtr te::mem::CachedBand::m_getBuffI
protected

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 102 of file CachedBand.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::SetBufferValueFPtr te::mem::CachedBand::m_setBuff
protected

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 103 of file CachedBand.h.

te::rst::SetBufferValueFPtr te::mem::CachedBand::m_setBuffI
protected

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 104 of file CachedBand.h.

unsigned int te::mem::CachedBand::m_setGetBlkX
mutableprotected

Definition at line 107 of file CachedBand.h.

unsigned int te::mem::CachedBand::m_setGetBlkY
mutableprotected

Definition at line 108 of file CachedBand.h.

void* te::mem::CachedBand::m_setGetBufPtr
mutableprotected

Definition at line 110 of file CachedBand.h.

unsigned int te::mem::CachedBand::m_setGetPos
mutableprotected

Definition at line 109 of file CachedBand.h.


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