QGIS API Documentation  3.0.2-Girona (307d082)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsContrastEnhancement Class Reference

Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range according to the specified ContrastEnhancementAlgorithm. More...

#include <qgscontrastenhancement.h>

Public Types

enum  ContrastEnhancementAlgorithm {
  NoEnhancement, StretchToMinimumMaximum, StretchAndClipToMinimumMaximum, ClipToMinimumMaximum,
  UserDefinedEnhancement
}
 This enumerator describes the types of contrast enhancement algorithms that can be used. More...
 

Public Member Functions

 QgsContrastEnhancement (Qgis::DataType datatype=Qgis::Byte)
 
 QgsContrastEnhancement (const QgsContrastEnhancement &ce)
 
 ~QgsContrastEnhancement ()
 
ContrastEnhancementAlgorithm contrastEnhancementAlgorithm () const
 
int enhanceContrast (double)
 Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed. More...
 
bool isValueInDisplayableRange (double)
 Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped) More...
 
double maximumValue () const
 Return the maximum value for the contrast enhancement range. More...
 
double minimumValue () const
 Return the minimum value for the contrast enhancement range. More...
 
const QgsContrastEnhancementoperator= (const QgsContrastEnhancement &)=delete
 
void readXml (const QDomElement &elem)
 
void setContrastEnhancementAlgorithm (ContrastEnhancementAlgorithm, bool generateTable=true)
 Set the contrast enhancement algorithm. More...
 
void setContrastEnhancementFunction (QgsContrastEnhancementFunction *)
 A public method that allows the user to set their own custom contrast enhancement function. More...
 
void setMaximumValue (double, bool generateTable=true)
 Set the maximum value for the contrast enhancement range. More...
 
void setMinimumValue (double, bool generateTable=true)
 Return the minimum value for the contrast enhancement range. More...
 
void writeXml (QDomDocument &doc, QDomElement &parentElem) const
 

Static Public Member Functions

static ContrastEnhancementAlgorithm contrastEnhancementAlgorithmFromString (const QString &contrastEnhancementString)
 Deserialize ContrastEnhancementAlgorithm. More...
 
static QString contrastEnhancementAlgorithmString (ContrastEnhancementAlgorithm algorithm)
 Return a string to serialize ContrastEnhancementAlgorithm. More...
 
static double maximumValuePossible (Qgis::DataType)
 Helper function that returns the maximum possible value for a GDAL data type. More...
 
static double minimumValuePossible (Qgis::DataType)
 Helper function that returns the minimum possible value for a GDAL data type. More...
 

Detailed Description

Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range according to the specified ContrastEnhancementAlgorithm.

Definition at line 42 of file qgscontrastenhancement.h.

Member Enumeration Documentation

◆ ContrastEnhancementAlgorithm

This enumerator describes the types of contrast enhancement algorithms that can be used.

Enumerator
NoEnhancement 
StretchToMinimumMaximum 
StretchAndClipToMinimumMaximum 
ClipToMinimumMaximum 
UserDefinedEnhancement 

Definition at line 48 of file qgscontrastenhancement.h.

Constructor & Destructor Documentation

◆ QgsContrastEnhancement() [1/2]

QgsContrastEnhancement::QgsContrastEnhancement ( Qgis::DataType  datatype = Qgis::Byte)

Definition at line 32 of file qgscontrastenhancement.cpp.

◆ QgsContrastEnhancement() [2/2]

QgsContrastEnhancement::QgsContrastEnhancement ( const QgsContrastEnhancement ce)

Definition at line 51 of file qgscontrastenhancement.cpp.

◆ ~QgsContrastEnhancement()

QgsContrastEnhancement::~QgsContrastEnhancement ( )

Definition at line 70 of file qgscontrastenhancement.cpp.

Member Function Documentation

◆ contrastEnhancementAlgorithm()

ContrastEnhancementAlgorithm QgsContrastEnhancement::contrastEnhancementAlgorithm ( ) const
inline

Definition at line 91 of file qgscontrastenhancement.h.

◆ contrastEnhancementAlgorithmFromString()

QgsContrastEnhancement::ContrastEnhancementAlgorithm QgsContrastEnhancement::contrastEnhancementAlgorithmFromString ( const QString &  contrastEnhancementString)
static

Deserialize ContrastEnhancementAlgorithm.

Definition at line 440 of file qgscontrastenhancement.cpp.

◆ contrastEnhancementAlgorithmString()

QString QgsContrastEnhancement::contrastEnhancementAlgorithmString ( ContrastEnhancementAlgorithm  algorithm)
static

Return a string to serialize ContrastEnhancementAlgorithm.

Definition at line 422 of file qgscontrastenhancement.cpp.

◆ enhanceContrast()

int QgsContrastEnhancement::enhanceContrast ( double  value)

Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed.

Public function to generate the enhanced for enhanceContrasted value for a given input.

Parameters
valueThe pixel value to enhance

Definition at line 169 of file qgscontrastenhancement.cpp.

◆ isValueInDisplayableRange()

bool QgsContrastEnhancement::isValueInDisplayableRange ( double  value)

Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped)

Determine if a pixel is within in the displayable range.

Parameters
valueThe pixel value to examine

Definition at line 227 of file qgscontrastenhancement.cpp.

◆ maximumValue()

double QgsContrastEnhancement::maximumValue ( ) const
inline

Return the maximum value for the contrast enhancement range.

Definition at line 86 of file qgscontrastenhancement.h.

◆ maximumValuePossible()

double QgsContrastEnhancement::maximumValuePossible ( Qgis::DataType  dataType)
static

Helper function that returns the maximum possible value for a GDAL data type.

Simple function to compute the maximum possible value for a data types.

Definition at line 83 of file qgscontrastenhancement.cpp.

◆ minimumValue()

double QgsContrastEnhancement::minimumValue ( ) const
inline

Return the minimum value for the contrast enhancement range.

Definition at line 89 of file qgscontrastenhancement.h.

◆ minimumValuePossible()

double QgsContrastEnhancement::minimumValuePossible ( Qgis::DataType  dataType)
static

Helper function that returns the minimum possible value for a GDAL data type.

Simple function to compute the minimum possible value for a data type.

Definition at line 122 of file qgscontrastenhancement.cpp.

◆ operator=()

const QgsContrastEnhancement& QgsContrastEnhancement::operator= ( const QgsContrastEnhancement )
delete

◆ readXml()

void QgsContrastEnhancement::readXml ( const QDomElement &  elem)

Definition at line 375 of file qgscontrastenhancement.cpp.

◆ setContrastEnhancementAlgorithm()

void QgsContrastEnhancement::setContrastEnhancementAlgorithm ( ContrastEnhancementAlgorithm  algorithm,
bool  generateTable = true 
)

Set the contrast enhancement algorithm.

The second parameter is optional and is for performance improvements. If you know you are immediately going to set the Minimum or Maximum value, you can elect to not generate the lookup tale. By default it will be generated.

Parameters
algorithmThe new contrast enhancement algorithm
generateTableFlag to override automatic look up table generation

Definition at line 243 of file qgscontrastenhancement.cpp.

◆ setContrastEnhancementFunction()

void QgsContrastEnhancement::setContrastEnhancementFunction ( QgsContrastEnhancementFunction function)

A public method that allows the user to set their own custom contrast enhancement function.

A public function that allows the user to set their own custom contrast enhancement function.

Parameters
functionThe new contrast enhancement function

Definition at line 278 of file qgscontrastenhancement.cpp.

◆ setMaximumValue()

void QgsContrastEnhancement::setMaximumValue ( double  value,
bool  generateTable = true 
)

Set the maximum value for the contrast enhancement range.

Set the maximum value for the contrast enhancement.

The second parameter is option an is for performance improvements. If you know you are immediately going to set the Minimum value or the contrast enhancement algorithm, you can elect to not generate the lookup tale. By default it will be generated.

Parameters
valueThe new maximum value for the band
generateTableFlag to override automatic look up table generation

Definition at line 296 of file qgscontrastenhancement.cpp.

◆ setMinimumValue()

void QgsContrastEnhancement::setMinimumValue ( double  value,
bool  generateTable = true 
)

Return the minimum value for the contrast enhancement range.

Set the maximum value for the contrast enhancement.

The second parameter is option an is for performance improvements. If you know you are immediately going to set the Maximum value or the contrast enhancement algorithm, you can elect to not generate the lookup tale. By default it will be generated.

Parameters
valueThe new minimum value for the band
generateTableFlag to override automatic look up table generation

Definition at line 328 of file qgscontrastenhancement.cpp.

◆ writeXml()

void QgsContrastEnhancement::writeXml ( QDomDocument &  doc,
QDomElement &  parentElem 
) const

Definition at line 354 of file qgscontrastenhancement.cpp.


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