Harris Geospatial / Docs Center / ENVI API / Processing / ENVIBuildBandStackTask

ENVI

ENVIBuildBandStackTask

ENVIBuildBandStackTask

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 can have different pixel sizes.
  • 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.

Example


This example creates one raster that consists of Band 2 from a 1984 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 from the ENVI Resource DVD (in the LandsatCaseStudies\TimeSeries folder). The images are also available from the ENVI Tutorials web page. Click the "ENVI Tutorial Data" hyperlink. Copy the images to your local drive, and update the file location with your own directory.

; Start the application
e = ENVI()
 
; Select a Landsat TM scene from 1985
File1 = 'LasVegasTM5May1985.dat'
Raster1 = e.OpenRaster(File1)
 
; Select a Landsat TM scene from 2005
File2 = 'LasVegasTM5May2005.dat'
Raster2 = e.OpenRaster(File2)
 
; Get the red band (2) from the 1985 scene.
; Bands are zero-based.
RedRaster1 = ENVISubsetRaster(Raster1, BANDS=1)
 
; Get the red band (2) from the 2005 scene.
RedRaster2 = ENVISubsetRaster(Raster2, BANDS=1)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('BuildBandStack')
 
; Define inputs
Task.INPUT_RASTERS = [RedRaster1, RedRaster2]
 
; Define outputs
Task.OUTPUT_RASTER_URI = e.GetTemporaryFilename()
 
; Run the task
Task.Execute
 
; Get the collection of data objects currently available in the Data Manager
DataColl = e.Data
 
; Add the output to the Data Manager
DataColl.Add, Task.OUTPUT_RASTER
 
; Display the result
View1 = e.GetView()
Layer1 = View1.CreateLayer(Task.OUTPUT_RASTER)
Layer2 = View1.CreateLayer(Task.OUTPUT_RASTER, BANDS=[1])
View1.Zoom, /FULL_EXTENT
View1.Animate, 2.0, /FLICKER

Syntax


Result = ENVITask('BuildBandStack')

Input properties (Set, Get): IGNORE_VALIDATE, INPUT_RASTERS, OUTPUT_RASTER_URI

Output properties (Get only): DESCRIPTION, NAME, 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:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


DESCRIPTION

This property describes the task.

IGNORE_VALIDATE (optional)

This property is now deprecated and has no effect on task behavior. All task property values are validated when they are set, and they throw an error with bad input.

INPUT_RASTERS (required)

Specify an array of ENVIRasters from which to build a band-stacked raster.

NAME

This property contains the name of the task.

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 of the output raster. If you do not specify this property, the output raster is only temporary. Once the raster has no remaining references, ENVI deletes the temporary file.

SPATIAL_REFERENCE (optional)

Set this keyword to an ENVIStandardRasterSpatialRef, ENVIPseudoRasterSpatialRef, or ENVIRPCRasterSpatialRef object if you want to reproject the source rasters to a common spatial reference.

Version History


ENVI 5.2

Introduced

ENVI 5.3, Service Pack 2

Removed the layer stacking code example. Use ENVILayerStackRaster instead.

See Also


ENVITask, ENVITaskParameter, ENVIMetaspectralRaster, ENVIRegridRasterTask, ENVISubsetRaster


This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR). However, it may be restricted from transfer to various embargoed countries under U.S. laws and regulations.
© 2017 Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation