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.
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.
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" '' '' ''
7. Select the Edit button. From the Variable Editor dialogue, click the Add button. Rename the NEW VARIABLE to Input2.
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.
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" '' '' ''
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…
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.
12. The Variable Values list will be populated with the image names and band number values. Click Run Now to begin processing the data.