ENVIRasterIterator::GetData
The GetData method returns the data for the current tile.
Example
In this example, we print the minimum and maximum tile values for the first, second, last, and second-to-last tiles in the raster.
; Launch the application
e = ENVI()
; Create an ENVIRaster
file = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
; Get an iterator for the first band
tileIterator = raster.CreateTileIterator(BANDS=0)
; Print the min and max values for the first tile
tileIterator.Reset
PRINT, 'First Tile:'
PRINT, 'Min = ', MIN(tileIterator.Next())
PRINT, 'Max = ', MAX(tileIterator.GetData())
; Print the min and max values for the second tile
PRINT, 'Second Tile:'
PRINT, 'Min = ', MIN(tileIterator.Next())
PRINT, 'Max = ', MAX(tileIterator.GetData())
; Print the min and max values for the last tile
tileIterator.Reset, /LAST
PRINT, 'Last Tile:'
PRINT, 'Min = ', MIN(tileIterator.Previous())
PRINT, 'Max = ', MAX(tileIterator.GetData())
; Print the min and max values for the
; second-to-last tile
PRINT, 'Second-to-last Tile:'
PRINT, 'Min = ', MIN(tileIterator.Previous())
PRINT, 'Max = ', MAX(tileIterator.GetData())
Syntax
Result = ENVIRasterIterator.GetData([, Keywords=value])
Return Value
A two-dimensional array containing the data for the current tile.
Keywords
Keywords are applied only during the initial creation of the object.
ERROR
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.
PIXEL_STATE
Set this keyword to a named variable that contains a byte array indicating the state of every pixel returned. The returned values are the sum of the bit values of the accumulated pixel states for every pixel returned.
PIXEL_STATE has three bits of information to determine if you want to use the corresponding pixel value in calculation:
- 1: No Data (Data Ignore Value, NaN, Inf for floating point rasters)
- 2: Mask
- 4: Outside of ROI
The PIXEL_STATE value for a pixel could be any combination of the above bits:
- 0 = Good Pixel
- 1 = No Data
- 2 = Mask
- 3 = No Data + Mask
- 4 = Outside of ROI
- 5 = No Data + Outside of ROI
- 6 = Mask + Outside of ROI
- 7 = No Data + Mask + Outside of ROI
See Raster Pixel State for more details.
Version History
ENVI 5 |
Introduced |
ENVI 5.1 |
Added PIXEL_STATE keyword |
API Version
4.2