Raster Summary

This class was created to provide a summary of the main statistics of a list of Rasters. It includes, for each band, the histogram, maximum and minimum values, mean (average) values, and standard deviation of pixel values. Internally, it computes the histogram of the band, and all the other values are extracted directly from the histogram, therefore it is a faster way to get basic statistics of a Raster.

The class RasterSummaryManager is a singleton that can be used to store the statistics of Rasters, without the need to perform repeated computations.

The following code shows how to use this class:

// suppose 2 rasters are available
te::rst::Raster* myraster1 = ...
te::rst::Raster* myraster2 = ...
 
// now the user needs to retrieve mean values from both rasters (band 0), multiple times
const unsigned int nband = 0;
te::rst::RasterSummary* rsummary1 = te::rst::RasterSummaryManager::getInstance().get(myraster1, te::rst::SUMMARY_MEAN);
te::rst::RasterSummary* rsummary2 = te::rst::RasterSummaryManager::getInstance().get(myraster2, te::rst::SUMMARY_MEAN);
 
double mean;
std::vector<double> means(100);
for (unsigned int i = 0; i < 100; i++)
{
  mean = rsummary1->at(nband).m_meanVal;
  means[i] += mean;
 
  mean = rsummary2->at(nband).m_meanVal;
  means[i] += mean;
}

QR Code
QR Code wiki:designimplementation:raster:raster_summary (generated for current page)