Subgroup: Contrast
Class: QgsContrastEnhancement¶
-
class
qgis.core.
QgsContrastEnhancement
¶ Bases:
sip.wrapper
Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range according to the specified ContrastEnhancementAlgorithm.
Methods
contrastEnhancementAlgorithm
contrastEnhancementAlgorithmFromString
Deserialize ContrastEnhancementAlgorithm. contrastEnhancementAlgorithmString
Returns a string to serialize ContrastEnhancementAlgorithm. enhanceContrast
Applies the contrast enhancement to a value
.isValueInDisplayableRange
Returns true if a pixel value
is in displayable range, false if pixel is outside of range (i.e.maximumValue
Returns the maximum value for the contrast enhancement range. maximumValuePossible
Helper function that returns the maximum possible value for a GDAL data type. minimumValue
Returns the minimum value for the contrast enhancement range. minimumValuePossible
Helper function that returns the minimum possible value for a GDAL data type. readXml
setContrastEnhancementAlgorithm
Sets the contrast enhancement algorithm
.setContrastEnhancementFunction
Allows the user to set their own custom contrast enhancement function
.setMaximumValue
Sets the maximum value
for the contrast enhancement range.setMinimumValue
Sets the minimum value
for the contrast enhancement range.writeXml
Signals
Attributes
ClipToMinimumMaximum
NoEnhancement
StretchAndClipToMinimumMaximum
StretchToMinimumMaximum
UserDefinedEnhancement
-
ClipToMinimumMaximum
= 3¶
-
class
ContrastEnhancementAlgorithm
¶ Bases:
int
-
NoEnhancement
= 0¶
-
StretchAndClipToMinimumMaximum
= 2¶
-
StretchToMinimumMaximum
= 1¶
-
UserDefinedEnhancement
= 4¶
-
contrastEnhancementAlgorithm
(self) → QgsContrastEnhancement.ContrastEnhancementAlgorithm¶
-
contrastEnhancementAlgorithmFromString
(contrastEnhancementString: str) → QgsContrastEnhancement.ContrastEnhancementAlgorithm¶ Deserialize ContrastEnhancementAlgorithm.
-
contrastEnhancementAlgorithmString
(algorithm: QgsContrastEnhancement.ContrastEnhancementAlgorithm) → str¶ Returns a string to serialize ContrastEnhancementAlgorithm.
-
enhanceContrast
(self, value: float) → int¶ Applies the contrast enhancement to a
value
. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed.
-
isValueInDisplayableRange
(self, value: float) → bool¶ Returns true if a pixel
value
is in displayable range, false if pixel is outside of range (i.e. clipped).
-
maximumValue
(self) → float¶ Returns the maximum value for the contrast enhancement range.
-
maximumValuePossible
(Qgis.DataType) → float¶ Helper function that returns the maximum possible value for a GDAL data type.
-
minimumValue
(self) → float¶ Returns the minimum value for the contrast enhancement range.
-
minimumValuePossible
(Qgis.DataType) → float¶ Helper function that returns the minimum possible value for a GDAL data type.
-
readXml
(self, elem: QDomElement)¶
-
setContrastEnhancementAlgorithm
(self, algorithm: QgsContrastEnhancement.ContrastEnhancementAlgorithm, generateTable: bool = True)¶ Sets the contrast enhancement
algorithm
.The
generateTable
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.
-
setContrastEnhancementFunction
(self, function: QgsContrastEnhancementFunction)¶ Allows the user to set their own custom contrast enhancement
function
. Ownership offunction
is transferred.
-
setMaximumValue
(self, value: float, generateTable: bool = True)¶ Sets the maximum
value
for the contrast enhancement range.The
generateTable
parameter is optional and 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 table. By default it will be generated.See also
-
setMinimumValue
(self, value: float, generateTable: bool = True)¶ Sets the minimum
value
for the contrast enhancement range.The
generateTable
parameter is optional and 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 table. By default it will be generated.See also
-
writeXml
(self, doc: QDomDocument, parentElem: QDomElement)¶
-