te::rp::RasterAttributes Class Reference

Extraction of attributes from Raster, Bands, and Polygons. More...

#include <RasterAttributes.h>

Inheritance diagram for te::rp::RasterAttributes:
te::rp::Algorithm

Public Member Functions

bool execute (AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
 Executes the algorithm using the supplied parameters. More...
 
boost::numeric::ublas::matrix< std::complex< double > > getComplexCovarianceMatrix (const std::vector< std::vector< std::complex< double > > > &vpixels, const std::vector< std::complex< double > > &vmeans)
 Returns the covariance matrix between vectors of pixel values. More...
 
te::stat::NumericStatisticalComplexSummary getComplexStatistics (std::vector< std::complex< double > > &pixels)
 Returns several statistics from a set of pixels (real and imag). More...
 
std::vector< std::complex< double > > getComplexValuesFromBand (const te::rst::Raster &raster, unsigned int band, const te::gm::Polygon &polygon)
 Returns the pixel values (real and imag) for the band, inside the polygon. More...
 
std::vector< std::vector< std::complex< double > > > getComplexValuesFromRaster (const te::rst::Raster &raster, const te::gm::Polygon &polygon, std::vector< unsigned int > bands, unsigned int rowstep=1, unsigned int colstep=1)
 Returns the pixel values (real and imag) for all the bands in raster, inside the polygon. More...
 
boost::numeric::ublas::matrix< double > getCovarianceMatrix (const std::vector< std::vector< double > > &vpixels, const std::vector< double > &vmeans)
 Returns the covariance matrix between vectors of pixel values. More...
 
const std::string & getErrorMessage () const
 Return the current error message if there is any. More...
 
boost::numeric::ublas::matrix< double > getGLCM (const te::rst::Raster &rin, unsigned int band, int dx, int dy, double minPixel, double maxPixel, double gLevels=256)
 Computes the Gray-Level Co-occurrence Matrix (GLCM) from a raster band. More...
 
boost::numeric::ublas::matrix< double > getGLCM (const te::rst::Raster &rin, unsigned int band, int dx, int dy, const te::gm::Polygon &polygon, double minPixel, double maxPixel, double gLevels=256)
 Computes the Gray-Level Co-occurrence Matrix (GLCM) from a raster band, inside the polygon. More...
 
te::rp::Texture getGLCMMetrics (boost::numeric::ublas::matrix< double > glcm, double noDataValue=0.0)
 Compute texture metrics from GLCM matrix. More...
 
te::stat::NumericStatisticalSummary getStatistics (std::vector< double > &pixels)
 Returns several statistics from a set of pixels. More...
 
void getStatisticsFromPolygon (const te::rst::Raster &raster, unsigned int band, const te::gm::Polygon &polygon, te::stat::NumericStatisticalSummary &summary, double noDataValue=0.0)
 Computes several statistics from a set of pixels inside a polygon. More...
 
std::vector< double > getValuesFromBand (const te::rst::Raster &raster, unsigned int band, const te::gm::Polygon &polygon)
 Returns the pixel values for the band, inside the polygon. More...
 
void getValuesFromBand (const te::rst::Raster &raster, unsigned int band, const te::gm::Polygon &polygon, std::map< double, int > &values)
 Returns the pixel values for the band, inside the polygon. More...
 
std::vector< std::vector< double > > getValuesFromRaster (const te::rst::Raster &raster, const te::gm::Polygon &polygon, std::vector< unsigned int > bands, unsigned int rowstep=1, unsigned int colstep=1)
 Returns the pixel values for all the bands in raster, inside the polygon. More...
 
bool initialize (const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
 Initialize the algorithm instance making it ready for execution. More...
 
bool isInitialized () const
 Returns true if the algorithm instance is initialized and ready for execution. More...
 
 RasterAttributes (bool enableTaskProgress=true)
 Public constructor. More...
 
void reset () _NOEXCEPT_OP(false)
 Clear all internal allocated objects and reset the algorithm to its initial state. More...
 
 ~RasterAttributes ()
 

Protected Member Functions

void setErrorMessage (const std::string &newErrorMessage)
 Set the current error message. More...
 

Private Attributes

bool m_enableTaskProgress
 

Detailed Description

Extraction of attributes from Raster, Bands, and Polygons.

Definition at line 64 of file RasterAttributes.h.

Constructor & Destructor Documentation

te::rp::RasterAttributes::RasterAttributes ( bool  enableTaskProgress = true)

Public constructor.

Definition at line 38 of file RasterAttributes.cpp.

References m_enableTaskProgress, and ~RasterAttributes().

te::rp::RasterAttributes::~RasterAttributes ( )
default

Referenced by RasterAttributes().

Member Function Documentation

bool te::rp::RasterAttributes::execute ( AlgorithmOutputParameters outputParams)
virtual

Executes the algorithm using the supplied parameters.

Parameters
outputParamsOutput parameters.
Returns
true if OK, false on errors.
Note
A return error string can be obtained via Algorithm::getErrorMessage()

Implements te::rp::Algorithm.

Definition at line 56 of file RasterAttributes.cpp.

boost::numeric::ublas::matrix< std::complex< double > > te::rp::RasterAttributes::getComplexCovarianceMatrix ( const std::vector< std::vector< std::complex< double > > > &  vpixels,
const std::vector< std::complex< double > > &  vmeans 
)

Returns the covariance matrix between vectors of pixel values.

Parameters
vpixelsThe vector of pixel vectors, with vpixels[band][pixel].
vmeansThe vector of pixels means, one mean per vector of pixels.
Returns
The covariance matrix between the vectors of pixel values.
Warning
All vectors sizes must fit.

Definition at line 363 of file RasterAttributes.cpp.

References m_enableTaskProgress, and te::common::TaskProgress::UNDEFINED.

te::stat::NumericStatisticalComplexSummary te::rp::RasterAttributes::getComplexStatistics ( std::vector< std::complex< double > > &  pixels)

Returns several statistics from a set of pixels (real and imag).

Parameters
pixelsA vector of pixel values.
Returns
A series of statistics (
See also
te::stat::NumericStatisticalSummary).

Definition at line 353 of file RasterAttributes.cpp.

References te::stat::GetNumericComplexStatisticalSummary().

std::vector< std::complex< double > > te::rp::RasterAttributes::getComplexValuesFromBand ( const te::rst::Raster raster,
unsigned int  band,
const te::gm::Polygon polygon 
)

Returns the pixel values (real and imag) for the band, inside the polygon.

Parameters
rasterThe input raster.
bandThe position of the input band.
polygonThe input polygon.
Returns
The pixel values for the band, inside the polygon.
Warning
Band and polygon must fit.

Definition at line 67 of file RasterAttributes.cpp.

References getValuesFromBand().

std::vector< std::vector< std::complex< double > > > te::rp::RasterAttributes::getComplexValuesFromRaster ( const te::rst::Raster raster,
const te::gm::Polygon polygon,
std::vector< unsigned int bands,
unsigned int  rowstep = 1,
unsigned int  colstep = 1 
)

Returns the pixel values (real and imag) for all the bands in raster, inside the polygon.

Parameters
rasterThe input band.
polygonThe input polygon.
bandsBands to be processed from the input raster.
Returns
A vector with the pixel values for all the bands in raster, inside the polygon, with values[band][pixel].
Warning
Bands and polygon must fit.

Definition at line 121 of file RasterAttributes.cpp.

References te::rst::PolygonIterator< T >::begin(), te::rst::PolygonIterator< T >::end(), te::rst::PolygonIterator< T >::getColumn(), te::rst::Raster::getNumberOfBands(), te::rst::PolygonIterator< T >::getRow(), and te::rst::Raster::getValue().

boost::numeric::ublas::matrix< double > te::rp::RasterAttributes::getCovarianceMatrix ( const std::vector< std::vector< double > > &  vpixels,
const std::vector< double > &  vmeans 
)

Returns the covariance matrix between vectors of pixel values.

Parameters
vpixelsThe vector of pixel vectors, with vpixels[band][pixel].
vmeansThe vector of pixels means, one mean per vector of pixels.
Returns
The covariance matrix between the vectors of pixel values.
Warning
All vectors sizes must fit.

Definition at line 416 of file RasterAttributes.cpp.

References m_enableTaskProgress, TE_TR, and te::common::TaskProgress::UNDEFINED.

boost::numeric::ublas::matrix< double > te::rp::RasterAttributes::getGLCM ( const te::rst::Raster rin,
unsigned int  band,
int  dx,
int  dy,
double  minPixel,
double  maxPixel,
double  gLevels = 256 
)

Computes the Gray-Level Co-occurrence Matrix (GLCM) from a raster band.

Parameters
rinThe input raster.
bandThe input band position.
dxThe displacement in x direction, to be considered as neighborhood, can be either + or -.
dyThe displacement in y direction, to be considered as neighborhood, can be either + or -.
minPixelThe minimum GL pixel value that occurs in the band.
maxPixelThe maximum GL pixel value that occurs in the band.
gLevelsThe number of Gray Levels (GL) to normalize the GLCM. The GLs will be normalized to the interval [0,(gLevels - 1)]. It is important to emphasize that the matrix will have 'gLevels' lines and 'gLevels' columns. Default value is 256, normalizing the GLs to the interval [0, 255].
Returns
The GLCM from the raster band.
Exceptions
te::common::ExceptionIt will throw an exception if the parameters minPixel and maxPixel were not passed as parameters.
Warning
The pixels from the input band will be considered of type unsigned int.

Definition at line 464 of file RasterAttributes.cpp.

References dx, te::rst::Raster::getBand(), te::rst::Raster::getNumberOfBands(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rst::Band::getProperty(), te::rst::Raster::getValue(), m_enableTaskProgress, te::rst::BandProperty::m_noDataValue, TE_TR, and te::common::TaskProgress::UNDEFINED.

Referenced by BOOST_AUTO_TEST_SUITE(), getGLCM(), te::attributefill::RasterToVector::getTexture(), and Texture().

boost::numeric::ublas::matrix< double > te::rp::RasterAttributes::getGLCM ( const te::rst::Raster rin,
unsigned int  band,
int  dx,
int  dy,
const te::gm::Polygon polygon,
double  minPixel,
double  maxPixel,
double  gLevels = 256 
)

Computes the Gray-Level Co-occurrence Matrix (GLCM) from a raster band, inside the polygon.

Parameters
rinThe input raster.
bandThe input band position.
dxThe displacement in x direction, to be considered as neighborhood, can be either + or -.
dyThe displacement in y direction, to be considered as neighborhood, can be either + or -.
polygonThe input polygon.
minPixelThe minimum GL pixel value that occurs in the band.
maxPixelThe maximum GL pixel value that occurs in the band.
gLevelsThe number of Gray Levels (GL) to normalize the GLCM. The GLs will be normalized to the interval [0,(gLevels - 1)]. It is important to emphasize that the matrix will have 'gLevels' lines and 'gLevels' columns. Default value is 256, normalizing the GLs to the interval [0, 255].
Returns
The GLCM from the raster band, inside the polygon.
Exceptions
te::common::ExceptionIt will throw an exception if the parameters minPixel and maxPixel were not passed as parameters.
Warning
The pixels from the input band will be considered of type unsigned int.

Definition at line 567 of file RasterAttributes.cpp.

References band, te::rst::CropRaster(), dx, getGLCM(), and TE_TR.

te::rp::Texture te::rp::RasterAttributes::getGLCMMetrics ( boost::numeric::ublas::matrix< double >  glcm,
double  noDataValue = 0.0 
)

Compute texture metrics from GLCM matrix.

Parameters
glcmThe input GLCM matrix.
noDataValueThe value that will be used when the matrix received is empty, i. e., when the polygon does not intersects the raster. Default value is 0.0.
Returns
The Texture structure will all available metrics computed

Definition at line 586 of file RasterAttributes.cpp.

References di, te::rp::Texture::m_contrast, te::rp::Texture::m_dissimilarity, m_enableTaskProgress, te::rp::Texture::m_energy, te::rp::Texture::m_entropy, te::rp::Texture::m_homogeneity, and te::common::TaskProgress::UNDEFINED.

Referenced by BOOST_AUTO_TEST_SUITE(), te::attributefill::RasterToVector::getTexture(), and Texture().

te::stat::NumericStatisticalSummary te::rp::RasterAttributes::getStatistics ( std::vector< double > &  pixels)

Returns several statistics from a set of pixels.

Parameters
pixelsA vector of pixel values.
Returns
A series of statistics (
See also
te::stat::NumericStatisticalSummary).

Definition at line 217 of file RasterAttributes.cpp.

References te::stat::GetNumericStatisticalSummary(), and te::stat::Mode().

void te::rp::RasterAttributes::getStatisticsFromPolygon ( const te::rst::Raster raster,
unsigned int  band,
const te::gm::Polygon polygon,
te::stat::NumericStatisticalSummary summary,
double  noDataValue = 0.0 
)
std::vector< double > te::rp::RasterAttributes::getValuesFromBand ( const te::rst::Raster raster,
unsigned int  band,
const te::gm::Polygon polygon 
)

Returns the pixel values for the band, inside the polygon.

Parameters
rasterThe input raster.
bandThe position of the input band.
polygonThe input polygon.
Returns
The pixel values for the band, inside the polygon.
Warning
Band and polygon must fit.

Definition at line 78 of file RasterAttributes.cpp.

References te::rst::PolygonIterator< T >::begin(), te::rst::PolygonIterator< T >::end(), te::rst::Raster::getBand(), te::rst::Raster::getNumberOfBands(), te::rst::Band::getProperty(), and te::rst::BandProperty::m_noDataValue.

Referenced by getComplexValuesFromBand(), and te::attributefill::RasterToVector::run().

void te::rp::RasterAttributes::getValuesFromBand ( const te::rst::Raster raster,
unsigned int  band,
const te::gm::Polygon polygon,
std::map< double, int > &  values 
)

Returns the pixel values for the band, inside the polygon.

Parameters
rasterThe input raster.
bandThe position of the input band.
polygonThe input polygon.
valuesA map with pixel values as key and the number of occurrence as value for the current band, inside the polygon.
Warning
Band and polygon must fit.

Definition at line 102 of file RasterAttributes.cpp.

References band, te::rst::PolygonIterator< T >::begin(), te::rst::PolygonIterator< T >::end(), te::rst::Raster::getBand(), te::rst::Raster::getNumberOfBands(), te::rst::Band::getProperty(), and te::rst::BandProperty::m_noDataValue.

std::vector< std::vector< double > > te::rp::RasterAttributes::getValuesFromRaster ( const te::rst::Raster raster,
const te::gm::Polygon polygon,
std::vector< unsigned int bands,
unsigned int  rowstep = 1,
unsigned int  colstep = 1 
)

Returns the pixel values for all the bands in raster, inside the polygon.

Parameters
rasterThe input band.
polygonThe input polygon.
bandsBands to be processed from the input raster.
Returns
A vector with the pixel values for all the bands in raster, inside the polygon, with values[band][pixel].
Warning
Bands and polygon must fit.

Definition at line 171 of file RasterAttributes.cpp.

References te::rst::PolygonIterator< T >::begin(), te::rst::PolygonIterator< T >::end(), te::rst::Raster::getBand(), te::rst::PolygonIterator< T >::getColumn(), te::rst::Raster::getNumberOfBands(), te::rst::Band::getProperty(), te::rst::PolygonIterator< T >::getRow(), te::rst::Raster::getValue(), and te::rst::BandProperty::m_noDataValue.

bool te::rp::RasterAttributes::initialize ( const AlgorithmInputParameters inputParams)
virtual

Initialize the algorithm instance making it ready for execution.

Parameters
inputParamsInput parameters.
Returns
true if OK, false on errors.
Note
A return error string can be obtained via Algorithm::getErrorMessage()

Implements te::rp::Algorithm.

Definition at line 45 of file RasterAttributes.cpp.

bool te::rp::RasterAttributes::isInitialized ( ) const
virtual

Returns true if the algorithm instance is initialized and ready for execution.

Returns
true if the algorithm instance is initialized and ready for execution.

Implements te::rp::Algorithm.

Definition at line 51 of file RasterAttributes.cpp.

void te::rp::RasterAttributes::reset ( )
virtual

Clear all internal allocated objects and reset the algorithm to its initial state.

Reimplemented from te::rp::Algorithm.

Definition at line 62 of file RasterAttributes.cpp.

References te::rp::Algorithm::reset().

void te::rp::Algorithm::setErrorMessage ( const std::string &  newErrorMessage)
protectedinherited

Set the current error message.

Parameters
newErrorMessageNew error message;

Definition at line 49 of file rp/Algorithm.cpp.

References te::rp::Algorithm::m_errorMessage.

Member Data Documentation

bool te::rp::RasterAttributes::m_enableTaskProgress
private

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