Hexagon Geospatial
MENU

ERDAS IMAGINE Q&A

ERDAS IMAGINE, the world’s leading geospatial data authoring system, supplies tools for all your Remote Sensing and Photogrammetry needs.
Showing results for 
Search instead for 
Do you mean 

Pulling out single-band images from a multi-band image.

by jdooley ‎03-16-2016 10:41 AM - edited ‎11-10-2016 09:35 AM (3,177 Views)

Question

How to split a multi-band image into a series of single-band images?

 

For example, one multispectral image has 220 bands. I want to obtain 220 Images with 1 band.

 

Image number "1" contains band 1 of multispectral image.
Image number "2" contains band 2 of multispectral image.
...
Image number "220" contains band 220 of multispectral image.

Answer

Note: This article applies to IMAGINE versions 16.00 or lower. IMAGINE version 16.01 uses a different model that this article does not appy to. A model is attached to this article that has comparable functionality and runs with IMAGINE versions 16.00 and 16.01 (but not with IMAGINE version 15.00).

 

First, create the text file that contains a list with the full path and filename of the input image along with a single band number on each line. The filename and band number must be separated by a single space and a single space must be added to the end of each line. An example of how your text file will look is provided below:

 

e:/docs/batch_kb/germtm.img 1

e:/docs/batch_kb/germtm.img 2

e:/docs/batch_kb/germtm.img 3

e:/docs/batch_kb/germtm.img 4

e:/docs/batch_kb/germtm.img 5

e:/docs/batch_kb/germtm.img 6

 

1. ERDAS IMAGINE Raster tab > Geometry group > Subset & Chip > Create Subset Image

2. Select the input file (germtm.img).

3. Choose a location and a root name (e.g. __band.img ) for the output image files.

4. Enter “1” in the Select Layers field.

5. Choose the Batch button to launch the Batch Command Editor.

 

bc_ed1.PNG

 

 

6. From the Variables: pulldown menu, select One or more inputs, one output.

 

The command should now look this:

modeler -nq subset.pmdl -meter -state "$(Input)" Integer 1 "$(Output)" Unsigned_8_bit Integer '$(Input.Ulx)' '$(Input.Uly)' '$(Input.Lrx)' '$(Input.Lry)' Map useall Continuous "Continuous" "Continuous" "None" '' '' ''

 

bc_ed2.PNG

 

 

7. Select the Edit button. From the Variable Editor dialogue, click the Add button. Rename the NEW VARIABLE to Input2.

 

var_ed1.PNG

 

 

8. Select the variable named Output1. Edit the Pattern line and insert $(Input2) after $(Input1.root). The new pattern line should read like this: e:/docs/batch_kb/$(Input1.pathright)$(Input2)___band.img. Then click Close.

 

var_ed2.PNG

 

 

9. The new variable Input2 is added to the Variable Values list. Edit the command line and replace the value 1 (after Integer) with $(Input2).

 

The command should now look like this:

modeler -nq subset.pmdl -meter -state "$(Input1)" Integer $(Input2) "$(Output1)" Unsigned_8_bit Integer '$(Input1.Ulx)' '$(Input1.Uly)' '$(Input1.Lrx)' '$(Input1.Lry)' Map useall Continuous "Continuous" "Continuous" "None" '' '' ''

 

var_ed3.PNG

 

 

10. From the Variable Values list, select both Input1 and Input2 with the mouse pointer. Right-click on the Input2 column heading and select Import

 

var_val1.PNG

 

 

11. Enter the name of the text file created in the first step into the Import from (*.txt) window. Select Space from the Separator Character pulldown menu. Then click OK.

 

import.PNG

 

 

12. The Variable Values list will be populated with the image names and band number values. Click Run Now to begin processing the data.

 

bc_ed4.PNG

 

 

 

Comments
by Nizza
on ‎11-04-2016 06:58 AM

The op button to change the variable option is grayed out in IMAGINE 2016.1Untitled.jpg

 

How can one proceed to edit the command?

 

Thanks in advance

by jdooley
on ‎11-07-2016 12:17 PM

Working on an updated document. Should be available shortly.

 

Jeff

by Nizza
on ‎11-08-2016 02:07 AM

Hi Jeff

 

Thanks, I look foward to recieving the complete workflow

 

Kind Regards

by jdooley
on ‎11-08-2016 09:14 AM

The article is updated but now it only applies to versions 16.00 or lower. The Subset function was changed from legacy modeler .pmdl to Spatial Modeler .gmdx in 16.01.

 

Original Command is grayed out because spatial model commands are variablised when they are submitted to the batch editor. The batch command can still be edited. Spatial Modeler has the internal functionality to iterate through the multiple bands inside of the model without using batch. Building a Spatial Model could be just as simple or easier than variablising the Subset batch command.

by jdooley
on ‎11-09-2016 06:37 AM

Unexpectedly, the revised document doesn't apply to 16.01 without additional modification. I'm looking for a better 16.01 solution for this example.

 

Jeff

Contributors