ENVIGainOffsetWithThresholdRaster
This function constructs an ENVIRaster from a source raster with gains and offsets applied. The resulting pixel values are further constrained to a specified range.
The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.
Example
; Start the application
e = ENVI()
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
; Apply gains and offsets with thresholding
Gains = [2.00, 1.33, 1.20, 1.11]
Offsets = [12.33, 1.10, 6.00, 1.55]
Threshold_Min = [0, 0, 0, 0]
Threshold_Max = [65535, 65535, 65535, 65535]
GainOffsetImage = ENVIGainOffsetWithThresholdRaster(Raster, $
Gains, Offsets, $
THRESHOLD_MINIMUM=Threshold_Min, $
THRESHOLD_MAXIMUM=Threshold_Max)
; save it in ENVI raster format
newFile = e.GetTemporaryFilename()
GainOffsetImage.Export, newFile, 'ENVI'
; Open the QUAC image
GainOffsetImage = e.OpenRaster(newFile)
; Display the result
View = e.GetView()
Layer = View.CreateLayer(GainOffsetImage)
Syntax
Result = ENVIGainOffsetWithThresholdRaster(Input_Raster, Gain, Offset [, Keywords=value])
Return Value
This routine returns a reference to an ENVIRaster.
Arguments
Input_Raster
Specify the input ENVIRaster.
Gain
Specify a double-precision array of data gain values, one per band.
Offset
Specify a double-precision array of data offset values, one per band.
Methods
This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:
Keywords
DATA_TYPE (optional)
Specify one of the following strings, indicating the output data type:
String | Data Type |
---|---|
byte | Byte (8 bits) |
double | Double-precision floating point (64 bits) |
float | Floating point (32 bits) |
int | Integer (16 bits) |
long | Long integer (32 bits) |
uint | Unsigned integer (16 bits) |
ulong | Unsigned long integer (32 bits) |
ERROR (optional)
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''
). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
NAME
Specify a string that identifies the raster.
THRESHOLD_MAXIMUM (optional)
Specify an array of maximum pixel values (one per band) for the output raster, after gains and offsets have been applied. Use this keyword to reduce the effects of highly saturated pixels such as clouds or playas. Another example is constraining the output pixel values to the data range of the specified data type. You must set either the THRESHOLD_MAXIMUM or the THRESHOLD_MINIMUM keyword.
THRESHOLD_MINIMUM (optional)
Specify an array of minimum pixel values (one per band) for the output raster, after gains and offsets have been applied. Use this keyword to reduce the effects of dark pixels such as water or cloud shadows. Another example is constraining the output pixel values to the data range of the specified data type. You must set either the THRESHOLD_MAXIMUM or the THRESHOLD_MINIMUM keyword.
Version History
ENVI 5.3 |
Introduced |
ENVI 5.3.1 |
Documented the dehydrated form of this virtual raster |
ENVI 5.4 |
Added Dehydrate and Hydrate methods; added NAME keyword |
API Version
4.2
See Also
ENVIRaster, CalculateQUACGainOffset Task, ENVIQUACRaster, QUAC Task