Layer Stacking and SLC correction of Landsat 7 image using QGIS and Erdas IMAGINE software

Layer Stacking and SLC correction of Landsat 7 image using QGIS and Erdas IMAGINE software

Table of Contents:

Using ERDAS Imagine SLC Correction:

Process 1:  Layer stack Bands

Process 2:  SLC correction

Using QGIS 2.0 SLC Correction:

Process 1:  Layer stack/merge the file

Process 2:  SLC correction

Process 3:  Layer stack /merge the SLC corrected band

Landsat 7, launched on April 15th 1999 with Advanced Enhanced Thematic Mapper Plus (ETM+) sensor. Unfortunately on May 31st 2003 the SLC (Scan line corrector) in the ETM+ instrument failed which leads to the stripping or missing of scan line in the satellite image. Various techniques are available for the SLC correction. Most of the remote sensing software package includes a separate module for it. On this tutorial we are using two software, one is an open source, QGIS and next is commercial, ERDAS Imagine 9.1 . Even though Landsat 8 is launched recently which is SLC error free, still Landsat 7 image is important for remote sensing analysis. The table below shows spectral characteristics of ETM+ sensor.






Landsat 7



Band 1



Band 2



Band 3



Band 4



Band 5



Band 6


60 * (30)

Band 7



Band 8



(USGS website)

Here we are using the Landsat 7 ETM+ image downloaded from GLCF website ( The data is in .zip format, unzip the folder using any zip software. It has 2 folders, one with all the bands (from 1 to 8) and next is gap masking files for each band (We will use this files later for the gap filling).

SLC correction Using Erdas Imagine 9.1

Process 1: Layer stack for Bands

Open the Erdas Imagine Software- click on “Image Interpreter” from the main toolset >Select “Utilities”
And  then Click on “Layer stack” tool

Layer stack

When you select the “layer stack” tool a separate small window will open

a. Select “Input file” and navigate to the downloaded folder with Landsat 7 data and select the first band and click on “ADD” button in the Layer stack window.(Change the file type to “Tiff” format because the satellite image will be in Tiff format).

b. Simultaneously add all the bands (bands that you want for your application) and click “ADD” button, you will notice all added bands

c. Change the “Layer” 1 into all

d. Set the Output folder and file name

e. Select “Ignore Zero in stats”

f. Press “OK”

Layer Selection and Stacking
Layer stacking window

Open the layer stacked image in the Viewer

Landsat 7 layer stacked with non SLC correction

Process 2: SLC correction through focal analysis

a. Select “Spatial enhancement”  from the “ Interpreter tool” in main tool set

b. From the “Spatial enhancement” select “Focal analysis” tool

c. Separate Focal analysis window will open

SLC correction through focal analysis

a. In focal analysis window Set the “output folder and file” (Give layer stacked image as input)

b. Set “output folder and name”

c. Set “output data type” as unsigned 8 bit

d. Tick onignore Zero in stats

e. From the drop down menu Set “Ignore Specified values and “Apply only Specified values

f. Leave the values as Zero

g. Press “OK”

focal analysis
Focal analysis window to perform SLC correction

LC correction through focal analysis
Modeler will start to run

h. After completing this process. Repeat the same process at least 6 or 7 times.

i. Each time the previous output should be the input for the next time.

First output

Third output

output ERDAS viewer
Pre SLC correction

output ERDAS viewer
Post SLC correction (final the output)

SLC correction Using QGIS 2.0

Process 1: Layer stack / merge the file

a. Open QGIS Desktop

b. Click on “raster”-“Miscellaneous”- select “merge tool”

c. Separate window for merge will open

QGIS Layer stack / merge the file

a. Set the “input files” (Give the Landsat 7 bands)

b. Set the “Output file and folder”

c. Tick on “Layer stack”

d. Click “OK”

QGIS merge the file
Merge window to perform Layer stacking

a. Open the layer stacked/merged image in QGIS

QGIS Layer stack / merge the file
Layer stacked image with SLC failure

Unlike Erdas Imagine here we have to do SLC correction for each bands using Gap masking file.

Process 2: SLC Correction

a. Select “analysis” from the “Raster”-and click on “Fill Nodata” tool

b. Separate Window for “Fill Nodata” will open

SLC Correction
From the Fill Nodata window

a. Set “Input folder and file”  (Layer stacked image)

b. Set “Output file and folder”

c. Tick on “ Search distance and set it 100”

d. Tick on “Band to Operate” and set the band number as 1 (Later change it to 2,3,4,5 for other bands).

e. Tick on “Validity mask” and browse the appropriate mask file for each band (Mask files for each band should be included with the downloaded Landsat 7 image folder .)

f. Tick on do not use the default validity mask

g. Press “OK”

fill nodata
Fill No data window to perform SLC correction

SLC correction
SLC corrected Image of Band 1

SLC corrected Image of Band 3
SLC corrected Image of Band 3
Correct all bands using the same tool and method.

Process 3: Layer Stack / merge the SLC corrected band

a. Layer stack the SLC corrected Landsat 7 bands using the method mentioned in Process 1

SLC corrected and Layer stacked image.
SLC corrected and Layer stacked image.

This Post Has 13 Comments

  1. could explain the process “Validity mask” , what layer? Thanks.

    1. Yes, when you download the Landsat7 image, it is included with it. Basically mask file has value 0 or 1 that means no data or data. Landsaat7 has scan line problem, so this mask file will tell software where there is data or no data. You can read more on USGS website,

  2. Hey thanks for this! A quick question: is this SLC correction procedure valid for research/scientific analysis? Or is its main purpose for viewing/aesthetic purposes only?

    1. Yes it is important for research and scientific analysis.

      1. Sorry, I will clarify. Can the SLC correction procedure described in this page be used to produce gap-filled Landsat 7 images for scientific analysis? In other word, can we – for example – produce valid NDVI imagery and accurate LULC classification from the gap-filled satellite imagery produced by the method described in this page?
        Or can these gap-filled imagery be only used for visualization purposes. Check out vs. to know what I mean.

        1. Appreciate for your comment, will go through it.

  3. Hello,

    I am having trouble when I’m stacking my bands in ERDAS Imagine 2013. I downloaded my images from USGS Earth Explorer and am trying to use bands 1- 5 for my analysis. I’ve added all 5 bands as TIFF files, then I exported the output as “stacked-file” in TIFF format. When I try to run the focal analysis the first time, the error “cannot specify multiple files” pops up each time when I hit “OK”.

    Do you know what could be causing this, and how to solve this problem?


  4. hello tankyou

    1. Thanks

    1. I will read it JCM and will update you

  5. Hello,
    if i mark the do not use default validity mask, it was still showing stripes. I tried unmarked the use default validity mask, then the output is fine without any stripes. Is it correct?. Of course i used the gap mask file for the selected band as validity mask.

  6. Hi,

    I’ve finally found your method in filling gaps in landsat 7 images. However, only band 1 was corrected. Doing the same method to the other bands only resulted to just the original, uncorrected image, with striping. Is there any other method I’m missing in correcting the succeeding bands? I’m using Qgis.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu