跳转至

Build Band and Layer Stacks

来源: https://vis-webcontent.s3.amazonaws.com/quickguides/Image+Preprocessing/Build+Band+Layer+Stacks/index.html#/

Lesson 1 of 1

Creating Band and Layer Stacks

In this quick guide, you will:

Build a band stack consisting of two bands from different Landsat images. * •

Build a layer stack consisting of 10-meter, 20-meter, and 60-meter bands from a Sentinel-2 image.

Sample Data

Download sample data below. Extract the contents of the .zip file to a local directory.

[BandLayerStacksSampleData.zip

314.9 MB

DownloadArrow down with horizontal line beneath it](assets/BandLayerStacksSampleData.zip)

Open Landsat Imagery

  1. 1

Select File > Openfrom the Menu bar. An Open dialog appears. 2. 2

Go to the location where you saved the sample data, then go to the Landsat directory. 3. 3

Use Ctrl+click to multi-select the files LasVegasMay1985.dat and LasVegasMay2020.dat. 4. 4

Click Open. The images are added to the Layer Manager and displayed in the Image window.

Build Band Stacks

For this exercise, you will create a band stack that consists of Band 4 (near-infrared) from the 1985 Landsat image and Band 5 (near-infrared) from the 2020 Landsat image. You can use the Build Band Stack tool to create a new file consisting of bands from different rasters with the same dimensions. The following rules apply to the input rasters:

They must have the same number of rows and columns. * •

They do not need to be georeferenced. * •

They can have different interleave types, but the resulting band-stacked raster will be band sequential (BSQ). * •

They can have different data types (such as floating-point and integer), but the resulting band-stacked raster will be cast to the highest data type out of all the rasters.

For additional information, see the Build Band Stacks(opens in a new tab) topic in the Documentation Center.

Follow these steps:

  1. 1

From theToolbox, expand the Raster Management folder and double-click Build Band Stack. The Build Band Stack dialog appears. 2. 2

Click the Browsebutton (three ellipses) next to the Input Rasters field. The Data Selection dialog appears. 3. 3

Select LasVegasMay1985.dat, then click the Spectral Subset button. The Spectral Subset dialog appears.

  1. 4

Select band 4 surface reflectance (0.8400) and click OK. 2. 5

Click OK in the Data Selection dialog. The Input Rasters field of the Build Band Stack dialog shows a new raster called [Subset] LasVegasMay1985.dat.

  1. 6

Repeat Steps 2-5 with band 5 of the LasVegasMay2020.dat raster. When complete, the Input Rasters field of the Build Band Stack dialog lists a new raster called [Subset] LasVegasMay2020.dat. 2. 7

Keep the default selection of No for Order Bands by Wavelength. 3. 8

Select the Virtual Raster option. This will create a temporary raster.

  1. 9

Click OK. When processing is complete, the first band of the band stack (i.e., band 4 of the 1985 image) is added to the Layer Manager and displayed in the Image window.

  1. 10

Select File > Data Manager from the Menu bar. The Data Manager appears. It lists both bands in the band stack. 2. 11

In the Data Manager, select Band 2 of the band stack and click the Load Grayscale button. This is the near-infrared band from May of 2020.

  1. 12

In the Layer Manager, uncheck and check the [1] Band Stack layer (i.e., the 2020 near-infrared image) to compare it with the 1985 near-infrared image. Having both bands in the same raster allows for their direct comparison. 2. 13

To prepare for the next exercise, click the Close All Files button in the Data Manager. 3. 14

Keep the Data Manager open.

Although the Landsat images are georeferenced, band stacks can combine images from different rasters that are not georeferenced. You may want to do this, for example, to create an animation of multiple bands without concern for geographic positioning.

Layer stacks, on the other hand, consist of multiple rasters that are georeferenced. You will build a layer stack next.

Build Layer Stacks

You can use the Build Layer Stack tool to build a new multi-band file from georeferenced images of various pixel sizes, extents, and projections. The input bands will be resampled and reprojected to a common spatial grid. A common use of Build Layer Stack is combining different band groups from Landsat-8 or Sentinel-2 data into one file. For this exercise, you will work with a Sentinel-2 image.

For additional information, see the Build Layer Stacks(opens in a new tab) topic in the Documentation Center.

Open a Sentinel-2 Dataset

  1. 1

Select File > Openfrom the Menu bar. An Open dialog appears. 2. 2

Go to the location where you saved the sample data, then go to the Sentinel-2 directory. 3. 3

Select the file MTD_MSIL1C.xml and click Open. A color composite of 10-meter bands is added to the Layer Manager and displayed in the Image window. This is a small image that covers the northeast part of the Denver, Colorado metropolitan area.

The Data Manager shows that this dataset consists of three band groups: 10, 20, and 60 meters. The 10-meter group contains four bands. The 20-meter group contains six bands. The 60-meter group contains three bands.

ENVI considers each band group a separate dataset because of their different spatial resolutions. However, you can combine all of the bands into one dataset by creating a layer stack. Having more spectral bands to work with can:

Potentially improve land-cover classification results * •

Provide more options for creating false-color composites * •

Provide a more complete visible-to-SWIR spectrum (with more "data points") for target detection and spectral mapping methods * •

Provide access to more specialized spectral indices

Layer stacking is not a requisite step when preprocessing Sentinel-2 imagery. It is only needed for workflows that benefit from having additional spectral data available. Classification, change detection, feature extraction, and machine learning are examples of applications that may benefit from using layer-stacked images.

Run the Build Layer Stack Tool

  1. 1

From the Toolbox, select Raster Management > Build Layer Stack. The Build Layer Stack dialog appears. 2. 2

Click the Browsebutton next to Input Rasters. The Data Selection dialog appears. 3. 3

Click the Select All button.

  1. 4

Click OK in the Data Selection dialog. The band groups are added to the Input Rasters field of the Build Layer Stack dialog.

Define a Common Spatial Grid

The source images or bands that comprise a layer stack must be georeferenced to a standard map projection. However, they can have different pixel sizes, extents, and projections. To create a layer stack, the source images or bands are resampled and reprojected to a common spatial grid.

A grid definition contains a known coordinate system plus any combination of other parameters such as pixel sizes, image dimensions, and tie-point coordinates for the upper-left pixel.

Rather than manually defining all of these parameters yourself, you can use the spatial reference of an existing dataset as the basis for the common spatial grid. For this exercise, you will use the spatial reference parameters of the 10-meter band group for the common grid.

  1. 1

In the Build Layer Stack dialog, click the From Dataset button. The Data Selection dialog appears.

  1. 2

Select the 10m-S2MSI1C... dataset and click OK.

The Coordinate System, Extents, and Pixel Size fields are automatically populated with the values derived from the 10-meter dataset. (Note: The Pixel Size X and Y values are both 10.)

Specify Remaining Parameters

  1. 1

Keep the default selection of Nearest Neighbor for the Resampling Method. This method will not change any pixel values, which is important for spectral applications. 2. 2

Select the Yes option for Order Bands by Wavelength. This will reorder the bands of the final layer stack from lowest to highest wavelength. 3. 3

Enter an output file name of Sentinel2_LayerStack.dat.

With Nearest Neighbor resampling, each band group will retain its original spatial resolution. Pixels will not be upsampled or downsampled to 10 meters. Cubic convolution resampling, on the other hand, would upsample the 20-meter and 60-meter bands to 10 meters. A disadvantage to this method is that you are essentially creating "fake" data during the resampling process.

  1. 4

Click OK. When processing is complete, a color composite of the first three bands is added to the Layer Manager and displayed in the Image window. 2. 5

In the Data Manager, look at the bands under Sentinel2_LayerStack.dat. Wavelengths are listed in parentheses after each band name. They range from 442.3 to 2185.7 nanometers (nm).

ENVI assigns its own name to each band (i.e., Band 1 through 13). The actual Sentinel-2 band names follow the ENVI names. For example, Band 9 corresponds to the Sentinel-2 B8A band (864 nm).

  1. 6

Optional: In the Layer Manager, right-click on Sentinel2_LayerStack.dat and select Band Animation > Raster Series to animate through all 13 bands of the layer stack. You will see different pixel resolutions because of the Nearest Neighbor resampling that we described earlier. 2. 7

Optional: In the Layer Manager, right-click on Sentinel2_LayerStack.dat and select Profiles > Spectral. The Spectral Profile window appears. 3. 8

Click on an area with green vegetation. The Spectral Profile window shows the reflectance curve for that pixel. Wavelengths are listed along the X-axis. This demonstrates the importance of ordering bands by wavelength. You would not get an accurate spectral profile if the bands were mixed up.

This concludes the quick guide.

Your input is important to us, please take a few moments to fill out ourQuick Guide Feedback(opens in a new tab)form.

© 2025 NV5 Geospatial Solutions, Inc. This information is not subject to the controls of the International Traffic in Arms Regulations (ITAR) or the Export Administration Regulations (EAR).