16#ifndef QGSRASTERANALYSISUTILS_H 
   17#define QGSRASTERANALYSISUTILS_H 
   19#include "qgis_analysis.h" 
   39namespace QgsRasterAnalysisUtils
 
   45  void cellInfoForBBox( 
const QgsRectangle &rasterBBox, 
const QgsRectangle &featureBBox, 
double cellSizeX, 
double cellSizeY, 
int &nCellsX, 
int &nCellsY,
 
   46                        int rasterWidth, 
int rasterHeight,
 
   51                                      double cellSizeX, 
double cellSizeY, 
const QgsRectangle &rasterBBox, 
const std::function<
void( 
double )> &addValue, 
bool skipNodata = 
true );
 
   54  void statisticsFromPreciseIntersection( 
QgsRasterInterface *rasterInterface, 
int rasterBand, 
const QgsGeometry &poly, 
int nCellsX, 
int nCellsY,
 
   55                                          double cellSizeX, 
double cellSizeY, 
const QgsRectangle &rasterBBox, 
const std::function<
void( 
double, 
double )> &addValue, 
bool skipNodata = 
true );
 
   58  bool validPixel( 
double value );
 
   61  void mapToPixel( 
const double x, 
const double y, 
const QgsRectangle bounds, 
const double unitsPerPixelX, 
const double unitsPerPixelY, 
int &px, 
int &py );
 
   64  void pixelToMap( 
const int px, 
const int py, 
const QgsRectangle bounds, 
const double unitsPerPixelX, 
const double unitsPerPixelY, 
double &x, 
double &y );
 
   70  std::unique_ptr< QgsProcessingParameterDefinition > createRasterTypeParameter( 
const QString &name,
 
   71      const QString &description,
 
   80  struct RasterLogicInput
 
   82    std::unique_ptr< QgsRasterInterface > sourceDataProvider;
 
   83    std::unique_ptr< QgsRasterProjector> projector;
 
   85    bool hasNoDataValue = 
false;
 
   86    std::vector< int > bands { 1 };
 
   89  ANALYSIS_EXPORT 
void applyRasterLogicOperator( 
const std::vector< QgsRasterAnalysisUtils::RasterLogicInput > &inputs, 
QgsRasterDataProvider *destinationRaster, 
double outputNoDataValue, 
const bool treatNoDataAsFalse,
 
   91      std::function<
void( 
const std::vector< std::unique_ptr< QgsRasterBlock > > &, 
bool &, 
bool &, 
int, 
int, 
bool )> &applyLogicFunc,
 
   97  std::vector<double> getCellValuesFromBlockStack( 
const std::vector< std::unique_ptr< QgsRasterBlock > > &inputBlocks, 
int &row, 
int &col, 
bool &noDataInStack );
 
  102  enum CellValueStatisticMethods
 
  121  double meanFromCellValues( std::vector<double> &cellValues, 
int stackSize );
 
  126  double medianFromCellValues( std::vector<double> &cellValues, 
int stackSize );
 
  131  double stddevFromCellValues( std::vector<double> &cellValues, 
int stackSize );
 
  136  double varianceFromCellValues( std::vector<double> &cellValues, 
int stackSize );
 
  141  double maximumFromCellValues( std::vector<double> &cellValues );
 
  146  double minimumFromCellValues( std::vector<double> &cellValues );
 
  151  double majorityFromCellValues( std::vector<double> &cellValues, 
const double noDataValue, 
int stackSize );
 
  156  double minorityFromCellValues( std::vector<double> &cellValues, 
const double noDataValue, 
int stackSize );
 
  161  double rangeFromCellValues( std::vector<double> &cellValues );
 
  166  double varietyFromCellValues( std::vector<double> &cellValues );
 
  168  enum CellValuePercentileMethods
 
  170    NearestRankPercentile,
 
  171    InterpolatedPercentileInc,
 
  172    InterpolatedPercentileExc
 
  179  double nearestRankPercentile( std::vector<double> &cellValues, 
int stackSize, 
double percentile );
 
  186  double interpolatedPercentileInc( std::vector<double> &cellValues, 
int stackSize, 
double percentile );
 
  193  double interpolatedPercentileExc( std::vector<double> &cellValues, 
int stackSize, 
double percentile, 
double noDataValue );
 
  195  enum CellValuePercentRankMethods
 
  197    InterpolatedPercentRankInc,
 
  198    InterpolatedPercentRankExc
 
  206  double interpolatedPercentRankInc( std::vector<double> &cellValues, 
int stackSize, 
double value, 
double noDataValue );
 
  213  double interpolatedPercentRankExc( std::vector<double> &cellValues, 
int stackSize, 
double value, 
double noDataValue );
 
DataType
Raster data types.
 
@ Float32
Thirty two bit floating point (float)
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
A geometry is the spatial representation of a feature.
 
Base class for the definition of processing parameters.
 
Base class for raster data providers.
 
Base class for processing filters like renderers, reprojector, resampler etc.
 
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
 
A rectangle specified with double values.
 
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...