BuildBandStack Task
This task builds a band-stacked raster (also called a metaspectral raster), which is a stack of ENVIRasters with the same dimensions. A common use is to include bands from different rasters.
- The input rasters must have the same number of rows and columns.
- The input rasters do not need to be georeferenced, but you can georeference the resulting metaspectral raster using the SPATIALREF keyword.
- The input rasters can be of different interleave types, but the resulting metaspectral raster will be BSQ.
- The input rasters can be of different data types, but the resulting metaspectral raster will be cast to the highest data type out of all the rasters.
- See Working with Metaspectral Datasets in the ENVI API for guidelines on using Landsat and ASTER imagery.
This task is different than the LayerStack task, where the input rasters can have different numbers of rows and columns.
The virtual raster associated with this task is ENVIMetaspectralRaster.
Example
This example creates one raster that consists of Band 2 from a 1985 Landsat TM image and Band 2 from a 2005 TM image. Both images have the same number of rows and columns; they are also in the same coordinate system and have the same pixel size (30 m).
The example uses sample images that are available from our ENVI Tutorials web page. Click the Landsat Case Studies link to download the .zip file to your machine, then unzip the files. Update the file location with your own directory.
; Start the application
e = ENVI()
; Select a Landsat TM scene from 1985
File1 = 'LasVegasMay1985.dat'
Raster1 = e.OpenRaster(File1)
; Select a Landsat TM scene from 2005
File2 = 'LasVegasMay2005.dat'
Raster2 = e.OpenRaster(File2)
; Get the red band (3) from the 1985 scene.
; Bands are zero-based.
RedRaster1 = ENVISubsetRaster(Raster1, BANDS=2)
; Get the red band (3) from the 2005 scene.
RedRaster2 = ENVISubsetRaster(Raster2, BANDS=2)
; Get the task from the catalog of ENVITasks
Task = ENVITask('BuildBandStack')
; Define inputs
Task.INPUT_RASTERS = [RedRaster1, RedRaster2]
; Run the task
Task.Execute
; Add the output to the Data Manager
e.Data.Add, Task.OUTPUT_RASTER
; Display the result
View = e.GetView()
Layer1 = View.CreateLayer(Task.OUTPUT_RASTER)
Layer2 = View.CreateLayer(Task.OUTPUT_RASTER, BANDS=[1])
View.Zoom, /FULL_EXTENT
View.Animate, 2.0, /FLICKER
Syntax
Result = ENVITask('BuildBandStack')
Input properties (Set, Get): INPUT_RASTERS, OUTPUT_RASTER_URI, SPATIAL_REFERENCE
Output properties (Get only): OUTPUT_RASTER
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
Methods
This task inherits the following methods from ENVITask:
Properties
This task inherits the following properties from ENVITask:
This task also contains the following properties:
INPUT_RASTERS (required)
Specify an array of ENVIRasters from which to build a band-stacked raster.
OUTPUT_RASTER
This is a reference to the output raster of filetype ENVI.
OUTPUT_RASTER_URI (optional)
Specify a string with the fully qualified filename and path to export the associated OUTPUT_RASTER.
- If you set this property to an asterisk symbol (*), the output raster will be virtual and not written to disk.
- If you do not specify this property, or set it to an exclamation symbol (!), a temporary file will be created.
SPATIAL_REFERENCE (optional)
Set this parameter to an ENVIStandardRasterSpatialRef, ENVIPseudoRasterSpatialRef, or ENVIRPCRasterSpatialRef object to be used by OUTPUT_RASTER. If this is not specified, then the first valid SPATIALREF property found in the INPUT_RASTERS array will be used.
Version History
ENVI 5.2 |
Introduced |
ENVI 5.5 |
OUTPUT_RASTER_URI now supports '*', which allows OUTPUT_RASTER to be virtual output. |
API Version
4.2
See Also
ENVITask, ENVIMetaspectralRaster, RegridRaster Task, ENVISubsetRaster