The CreateTileIterator function method returns a reference to the ENVIRasterIterator.
Example
For the following example:
- Copy and paste the procedure into an IDL editor window.
- Save the file as enviraster_tiles_example.
- Compile and run the procedure.
PRO enviraster_tiles_example
e = ENVI()
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
tiles = raster.CreateTileIterator(BANDS=0, $
TILE_SIZE=[1024,1024])
count = 0
FOREACH tile, tiles DO BEGIN
count++
PRINT,''
PRINT, 'Tile Number:'
PRINT, count
PRINT, 'Min:'
PRINT, MIN(tile)
PRINT, 'Max:'
PRINT, MAX(tile)
PRINT, 'BAND:'
PRINT, tiles.CURRENT_BAND
PRINT, 'SUB_RECT:'
PRINT, tiles.CURRENT_SUBRECT
ENDFOREACH
END
Syntax
Result = ENVIRaster.CreateTileIterator ([, Keywords=value])
Return Value
This method returns a reference to an ENVIRasterIterator for the ENVIRaster.
Keywords
Keywords are applied only during the initial creation of the object.
BANDS
Set this keyword to an n-element array expressing the integer indices (0-based) of the bands to be included in the spectral range the iterator will traverse. By default, all bands will be included.
COMPLEX_FUNCTION
If the ENVIRaster contains complex data:
When ENVIRaster::CreateTileIterator is called with the COMPLEX_FUNCTION keyword, the resulting ENVIRasterIterator contains data evaluated by the raster's complex function. This data will be of type FLOAT or DOUBLE, depending on whether the ENVIRaster contained single- or double-precision complex data. When iterating through the ENVIRasterIterator, each tile's data will be of this type.
When ENVIRaster::CreateTileIterator is called without the COMPLEX_FUNCTION keyword, the resulting ENVIRasterIterator contains COMPLEX or DCOMPLEX data, corresponding to the raster's DATA_TYPE property. When iterating through the ENVIRasterIterator, each tile's data will be of this type.
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.
MODE
Set this keyword to one of the following case-insensitive strings: 'spatial', 'bsq' (for spatial tiling), 'spectral', 'bil', 'bip' (for spectral tiling). The default value is 'spatial'.
If set to 'spatial' or 'bsq', the iterator returns two-dimensional tiles of the form:
[range(columns dimension), range(rows dimension)]
The same spatial range is returned N times for N bands specified by the BANDS keyword.
If set to 'spectral' or 'bil', the iterator returns two-dimensional tiles of the form:
[range(columns dimension), range(bands dimension)]
In this case, a tile is returned for each row in the iterator span.
If set to 'bip', the iterator returns a transpose of the two-dimensional tiles of the form:
range(bands dimension)], [range(columns dimension)
As with 'spectral' and 'bil', a tile is returned for each row in the iterator span.
SUB_RECT
Set this keyword to a four-element array expressing the spatial range (in pixels) of the subset to be included in the spatial range the iterator will traverse. By default, the full extent of the image will be included. The array is of the form [x1, y1, x2, y2], where:
x1 = First pixel of the columns dimension
y1 = First pixel of the rows dimension
x2 = Last pixel of the columns dimension
y2 = Last pixel of the rows dimension
Pixel coordinates are zero-based.
TILE_SIZE
A two-element array expressing the size (in pixels) of the tiles to be returned by the iterator. The first element defines size in the columns dimension; the second in the rows dimension. TILE_SIZE specifies the preferred dimensions; many tiles (such as edge cases) will be smaller than the specified size. TILE_SIZE is ignored when MODE='spectral'. The default value will be calculated based on the Processing Tile Size (MB) preference in ENVI.
Version History
ENVI 5 |
Introduced |
ENVI 5.6.2 |
Added BSQ, BIL, and BIP values for the MODE keyword. |
API Version
4.3
See Also
ENVIRaster::SetTile, ENVIRasterIterator, ENVIRasterIterator::Next, ENVIRasterIterator::Previous, ENVIRasterIterator::Reset