A Small Tutorial for IMAGINE Batch - Hexagon...

26
Error: Reference source not found A Small Tutorial for IMAGINE Batch

Transcript of A Small Tutorial for IMAGINE Batch - Hexagon...

Page 1: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Error: Reference source not found

A Small Tutorial for IMAGINE Batch

Page 2: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Table of ContentsSection 1: Basics of IMAGINE Batch..................................................................................................3

Understand IMAGINE Batch ........................................................................................................3A Tutorial of How to run Batch..................................................................................................3Customize *.bcf & *.bls file......................................................................................................7

Automatic Batch.........................................................................................................................8Potential Problem for Automatic Batch.......................................................................................8Why that happen?..................................................................................................................8Solution for this Problem.........................................................................................................9

Section 2: IMAGINE Command Line................................................................................................11Some rules..............................................................................................................................11

Always Use UNIX path...........................................................................................................11Modeler Command................................................................................................................11Quote() is required!..............................................................................................................12

Run DOS Command From IMAGINE Command Line.......................................................................12Some Examples....................................................................................................................12Open IE from IMAGINE Command Line....................................................................................13

Run Modeler.exe from IMAGINE Command Line............................................................................13An example..........................................................................................................................13

Section 3: Command Line in EML....................................................................................................14Use DOS command in EML.........................................................................................................14Call DOS Batch from EML...........................................................................................................15

Section 4: Run IMAGINE Command From Shell ................................................................................16Setup Environment Variables for ERDAS IMAGINE ........................................................................16

Step1: Generate the .bat from IMAGINE .................................................................................16Step2: Modify Batch File........................................................................................................19

Run IMAGINE Command From Shell............................................................................................21Run IMAGINE Command in DOS Console.................................................................................21Run IMAGINE Command in B-Shell (Cygwin for Windows)..........................................................22

Run Modeler.exe.......................................................................................................................23Run Modeler.exe in DOS Console.............................................................................................23Run Modeler.exe Command in B Shell .....................................................................................24

Page 3: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Section 1: Basics of IMAGINE Batch

Understand IMAGINE Batch

A Tutorial of How to run BatchThere is only one way to use DOS batch: Let IMAGINE Batch to generate DOS *.bat for you.

Page 4: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables
Page 5: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables
Page 6: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Now you have 3 files: *.bls, *.bcf, *.bat

You can double-click on Export_TIFF-GeoTIFF.bat to start the process (without starting IMAGINE).

Or you can load the *.bcf from "Session->Open Batch Command File", which does the same thing.

Page 7: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Customize *.bcf & *.bls file

You may wonder that what are the *.bls & *.bcf file?

*.bcf is the real meat, which include the command lines.

*.bls contains the input file names, which allows you to process multiple input file in one batch process.

Below is a small tutorial:

For example you want to shift the following 2 images

d:/work/datat/2-2.img

d:/work/datat/2-3.img

<1> create a IMAGINE batch file (*.bcf) by yourself, let's say d:/work/datat/shift.bcf , and then edit its content like this:

/*** IMAGINE Version 8.5 Batch Commands File*/variable Input User;

imagecommand '$(Input)' -map '$(Input.Ulx)+22.07663' '$(Input.Uly)+41.913084' 1.0000000000000000e+000 1.0000000000000000e+000 other Unknown -meter imagecommand

<2> Create a IAMGINE name file (*.bls) by yourself, let's say d:/work/datat/shift.bls , and then edit its content like this:

Inputd:/work/datat/2-2.imgd:/work/datat/2-3.img

<3> Go to IMAGINE menu->Session->open Batch command files..

locate the d:/work/datat/shift.bcf.

click the Next;

it will show the Input dialog, click the button called "load names from a file" (on the bottom-right corner)

locate the d:/work/datat/shift.bls

you should see your input filename listed in the input dialog.

Click Finish to process the operation.

Page 8: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Automatic Batch

Potential Problem for Automatic Batch

For example you want to batch process NDVI. It looks very easy to do, but it is not!

Manual Batch always work!

modeler -nq $IMAGINE_HOME/etc/models/indice.pmdl -meter -state "d:/work/data/2-2.img" "d:/work/datat/d.img" Float_Single 0 1062354 2062356 1073570 2051356 Map ' ($in(3) - $in(2)) / ($in(3) + $in(2))' "None" '(($in(3) + $in(2)) ne 0)'

it works for single input though.

Automatically Batch can give you wrong command!

modeler -nq $IMAGINE_HOME/etc/models/indice.pmdl -meter -state "$(Input)" "$(Temp1)" Float_Single 0 '$(Input.Ulx)' '$(Input.Uly)' '$(Input.Lrx)' '$(Input.Lry)' Map '$(Output)' "None" '(($in(3) + $in(2)) ne 0)'

The automatically batch doesn't work. Since it recognize the NDVI equation as output, which is wrong!

Why that happen?

Why Batch make mistakeThe reason is Batch treat the NDVI equation as filename is because “($in(3) + $in(2))” is a totally

valid filename in Windows system.So the ($in(3) - $in(2)) / ($in(3) + $in(2)) can be read as

| |_path ||_folder name |_filename

That is why Batch make this mistake, batch tool only try to interpret the argument list, nothing else.

OK, We already know thisBecause of that, we make the manual batch tool, in case. And also we make it clear in our

documentation:

Page 9: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Modify commands automatically

This option enables the Edit Commands / Create Variables panel and automatically replaces filenames with variables. Additional manual edits may also be performed.

Examine the results of automatically modified commands carefully to ensure the resulting command and its use of variables is going to work in the way you want it to. There are often two or more ways the variables can be automated, or you may not want a particular value replaced with a variable, so the automatic modifications should always be checked.

Solution for this Problem

Use the correct format from manual batch, combine the variable from automatically batch!

Make your own batch

modeler -nq $IMAGINE_HOME/etc/models/indice.pmdl -meter -state "d:/work/data/2-2.img" "d:/work/datat/d.img" Float_Single 0 1062354 2062356 1073570 2051356 Map ' ($in(3) - $in(2)) / ($in(3) + $in(2))' "None" '(($in(3) + $in(2)) ne 0)'

From the original command line we can find certain strings can be replaced by variable:"d:/work/data/2-2.img" = "$(Input)"

"d:/work/datat/d.img" = "$(Output)"

1062354 = '$(Input.Ulx)'

2062356 = '$(Input.Uly)'

1073570 = '$(Input.Lrx)'

2051356 = '$(Input.Lry)'

Page 10: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Then below is the final command line:

modeler -nq $IMAGINE_HOME/etc/models/indice.pmdl -meter -state "$(Input)" "$(Output)" Float_Single 0 '$(Input.Ulx)' '$(Input.Uly)' '$(Input.Lrx)' '$(Input.Lry)' Map ' ($in(3) - $in(2)) / ($in(3) + $in(2))' "None" '(($in(3) + $in(2)) ne 0)'

How to run it.

Step 1: Make your own batch, save the following code into a *.bcf file

/*** INPUT IS DEFINED BY USER ( *.BLS)*/variable Input User;/*** OUTPUT IS DETERMINED BY INPUT.** FOR EXAMPLE, IF INPUT = D:/DATA/X.IMG;** THEN OUTPUT WILL = D:/DATA/X_OUTPUT.IMG*/variable Output Auto "$(Input.Path)/$(Input.Root)_output.img" Delete_Before;/*** CALL MODELER TO CALCULATE NDVI** NDVI EQUATION IS EMBEDDED IN THE COMMAND LINE (AS ARGUMENT)*/modeler -nq $IMAGINE_HOME/etc/models/indice.pmdl -meter -state "$(Input)" "$(Output)" Float_Single 0 '$(Input.Ulx)' '$(Input.Uly)' '$(Input.Lrx)' '$(Input.Lry)' Map ' ($in(3) - $in(2)) / ($in(3) + $in(2))' "None" '(($in(3) + $in(2)) ne 0)'

Step 2: Make your own input list file (*.bls)

Here is an example of the bls file:Inputd:/work/data/2-2.imgd:/work/data/2-3.imgd:/work/data/2-4.img

Step 3: Use IMAGINE batch tool

Go to ERDAS IMAGINE Menu, Session->Open Batch Command File, load the *.bcd you just created.Click Next;Click “Load Names from file”, load the *.bls you just created. You should be able to see all the input filenames in the cell array.Click Finish to process the batch.

Page 11: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

How to deal with Multiple Variables

In the previous example, there is only one User variable. The next example will demo how to deal with multiple variables.For example, you want to rescale a image from 16 bit to 8 bit. You can go to Image Interpreter->Utility->Rescale

The original command line should look like this:

modeler -nq $IMAGINE_HOME/etc/models/rescale.pmdl -meter -state "d:/work/data/quickbird_pyramids_pan.img" "d:/work/datat/out.img" 319404.460522 3318576.715953 320579.060522 3317754.215953 Map 0 0 Unsigned_8_bit 1 2 0 255 "None" Continuous "Continuous" "Continuous"

So you *.bcf file should look like this:variable Inputuser;variable Output user;modeler -nq $IMAGINE_HOME/etc/models/rescale.pmdl -meter -state "$(Input)" "$(Output)" '$(Input.Ulx)' '$(Input.Uly)' '$(Input.Lrx)' '$(Input.Lry)' Map 0 0 Unsigned_8_bit 1 2 0 255 "None" Continuous "Continuous" "Continuous"

Your *.bls file should look like this, and different variables are separated by tab.Input Outputd:/work/data/quickbird_pyramids_pan.img d:/work/datat/output.img

If you have more than one image, your *.bls file should follow this format:Input Outputd:/work/Input1.img d:/work/output1.imgd:/work/Input2.img d:/work/output2.imgd:/work/Input3.img d:/work/output3.img...d:/work/InputN.img d:/work/outputN.img

Page 12: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Section 2: IMAGINE Command Line

Some rules

Always Use UNIX path

You have to make sure to use UNIX path ("\"), not Windows ("/") in your command line

For example the following command will not work in IMAGINE Command line:

exporttif -inputfilename "d:\work\data\2-2.img" -outputfilename "d:\2-2.tif" -compressionname None -tile 64 64 -photointerp RGB

You need to change the path:exporttif -inputfilename "d:/work/data/2-2.img" -outputfilename "d:/2-2.tif" -compressionname None -tile 64 64 -photointerp RGB

Modeler Commandjob modeler -nq quote("d:/work/gi91/root/etc/models/createfile.pmdl") -meter -state quote("d:/foo.img") "Unsigned 8 bit" Continuous 0 0 511 511 File "" 0 1 Integer "None"

Note: You have to add quote() around all the input and output file path.

Page 13: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Quote() is required!

Quote() is not only required for modeler.exe, it actually required for all IMAGINE Job command as long as there is filename involved.

For example, If you run the commands below in your IMAGINE Command Line, it will work!

viewer create at 0 48 size 600 600;viewer truecolor quote("d:/work/data/lanier.img") rgb 1 2 3 transbackground 0;

But the commands below doesn’t work!viewer create at 0 48 size 600 600;viewer truecolor "d:/work/data/lanier.img" rgb 1 2 3 transbackground 0;

Run DOS Command From IMAGINE Command Line

Some Examples

Erdas Imagine Command line fully support DOS command.Here is some examples:

Del:Dos command: >del c:\test\dd.txt

Imagine Command:system cmd “/c” del quote(“c:\\test\\dd.txt”)

copy:Dos command: >copy c:\test\dd.txt d:\work

Imagine Command:system cmd “/c” copy quote(“c:\\test\\dd.txt”) quote(“d:\\work”)

Note:“/c” : will append argument to cmdYou have to use quote() and \\ for your path.

Open NotePad and Load some txt fileSystem cmd "/c" notepad quote("d:\\tree.txt")

Use “ssr.exe” to replace string system cmd "/c" ssr quote(0) quote(":") quote("=") quote("c:\\input.txt") quote("c:\\output.txt")

Page 14: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Open IE from IMAGINE Command Line

Open IE, and load some html fileSystem cmd "/c" quote("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE") "d:/demo.html"OrSystem cmd "/c" quote("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE") "d:\\demo.html"OrSystem cmd "/c" quote("C:/Program Files/Internet Explorer/IEXPLORE.EXE") "d:/demo.html"

You can use either “\\” or “/”

Run Modeler.exe from IMAGINE Command Line

An example

For example, if you want stack the first and third layer from 2-2.img, and output to stack.img.

Original Command line from batch:

modeler -nq $IMAGINE_HOME/etc/models/layermerge.pmdl -meter -state Union None 'FLOAT RASTER n1 FILE OLD NEAREST NEIGHBOR AOI NONE EDGE FILL"d:/work/data/2-2.img"; FLOAT RASTER n2 FILE OLD NEAREST NEIGHBOR AOI NONE EDGE FILL"d:/work/data/2-2.img"; ' ignore Unsigned_8_bit "d:/work/datat/stack.img" 'n1(1),n2(3)'

If you copy it to a *.bcf, it will not run. You need to modify it:

Modified Original command line to:

modeler -nq "$IMAGINE_HOME/etc/models/layermerge.pmdl" -meter -state Union None "FLOAT RASTER n1 FILE OLD NEAREST NEIGHBOR AOI NONE EDGE FILL \"d:/work/data/2-2.img\"; FLOAT RASTER n2 FILE OLD NEAREST NEIGHBOR AOI NONE EDGE FILL \"d:/work/data/2-2.img\";" ignore Unsigned_8_bit quote("d:/work/datat/stack.img") "n1(1),n2(3)"

Note the following change:from"d:/work/data/2-2.img";to\"d:/work/data/2-2.img\";

The reason is IMAGINE command line will treat “ as the end of the string, so you need to add \ before “.

Page 15: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Section 3: Command Line in EML

EML = IMAGINE Command line.So just copy whatever works from IMAGIEN Command line to EML, and it should work in EML Script!

Use DOS command in EML

For example:

component test{frame test{

title "test";

button m1btn; button closebtn;

group test{

geometry 0,0,200,100;button m1btn{

title above center "test1";on mousedown{

# Call DOS Commandsystem cmd "/c" copy quote("c:\\test\\dd.txt") quote("d:\\work");

}}

button closebtn{

title "close";below m1btn;on mousedown{

unload;}

}} # End of "group test"

} # End of "frame test"on startup {

display test;}} # End of "component test"

Page 16: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Call DOS Batch from EML

It is very easy to do:

For example, you have a DOS batch file called c:\test.bat

#This is test.bat filecopy c:\dd.txt d:

In your Imagine command line, you can call this batch file:job “c:/test.bat” #use unix path style

Same as EMLbutton btn_OK{

title above center "test1";on mousedown{

job “c:/test.bat” #use unix path style}

}

Page 17: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Section 4: Run IMAGINE Command From Shell

Setup Environment Variables for ERDAS IMAGINE

In order to run IMAGINE Command outside IMAGINE Session, you need to setup all the IMAGINE environment variables in you own session.The following two steps will generate a template batch file, which will setup all the IMAGINE environment variables outside IMAGINE session.

Step1: Generate the .bat from IMAGINE

Let's assume you want to generate a new image from IMAGINE Batch.

Create New Image...

Page 18: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Click "Batch" Button

Click "Use Commands as they are", and click "Next"

Change the time to some time in the future (make sure the batch doesn't run immediately), and click "Next"

Type in your User name & password, which has the privilege to do the Windows task scheduler. Click "Finish"

Page 19: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

This list give you the exact location for the bat file.

Here you go, you should be able to see all the files.

Page 20: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Step2: Modify Batch File

If you open the "foo.bat" file, you will see there is a lot of "Set" command, which used to setup the all the IMAGINE environment variable for the running session.

You need to remove the IMAGINE JOB part, which is highlighted in the red box.

Page 21: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

After remove the IMAGINE JOB part, your .bat should look like this:

Now, you can save this .bat file as a template, which will setup all IMAGINE environment variables needed for processing IMAGINE JOB command.

let's assume you save it to d:/IMGEnvSetup.bat

Page 22: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Run IMAGINE Command From Shell

Run IMAGINE Command in DOS Console

The prototype of the IMAGINE JOB command can be retrieve from Batch, or session log.

Prototype from Session Log :exporttif -inputfilename d:/work/data/2-2.img -outputfilename d:/work/datat/2-2.tif -compressionname None -tile 64 64 -photointerp RGB

Command Line in DOS (You can use either Windows or Unix Path)exporttif -inputfilename "d:\work\data\2-2.img" -outputfilename "d:\2-2.tif" -compressionname None -tile 64 64 -photointerp RGBorexporttif -inputfilename "d:/work/data/2-2.img" -outputfilename "d:/2-2.tif" -compressionname None -tile 64 64 -photointerp RGB

Page 23: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Run IMAGINE Command in B-Shell (Cygwin for Windows)

Similar to DOS console!

You need to setup the ERDAS IMAGINE environment variables first from DOS console, then launch the B-shell environment!

Since the Cygwin B-shell can inherit all the environment variables from DOS console, you can access all the IMAGINE command.You can type "env" in B-shell to verify if you inherit all the IMAGINE environment variables.

Page 24: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Run Modeler.exe (IMAGINE9.3 or older)

Run Modeler.exe in DOS Console

Modeler.exe is different from other IMAIGNE commands, so it deserve a special treatment. Since Modeler need the IMAGINE session log to running, so it is impossible to directly run modeler in DOS Console.

You have to write all your command line into *.bcf file, since directly calling modeler.exe from command line will not work.Below is an example of the *.bcf file.

Make sure you have *.bcf, *.bls file ready before run this command:

batchprocess -bcffile "d:\foo.bcf" -blsfile "d:\foo.bls" -logfile "d:\foo.log"

Page 25: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

Run Modeler.exe Command in B Shell

You also need to create an empty *.bls file Now you can run this in B-shell:

batchprocess -bcffile "d:\foo.bcf" -blsfile "d:\foo.bls" -logfile "d:\foo.log"

Section 5: New Update from IAMGINE 2010

Run Modeler.exe from IMAGINE Command Line (Easy!) - IMAGINE 10.0

A Simple model demo!

IMAGINE 2010 introduce the single quote in IMAGINE, which make command line much easier!!

For example:Here is your Spatial model:

/*** inputs from ii_layermerge.emlarg1~arg7: THE FILE PATH FOR ALL 7 LANDSAT BANDSarg8: THE FILE PATH FOR OUTPUT LAYERSTACK***/ show arg1;#if(argcount != 8) {quit;}SET CELLSIZE MIN;SET WINDOW UNION;SET AOI NONE;

Page 26: A Small Tutorial for IMAGINE Batch - Hexagon …community.hexagongeospatial.com/...ERDAS_IMAGINE_Q_A/...Tutorial.pdfA Small Tutorial for IMAGINE Batch. ... Setup Environment Variables

## declarations#Integer RASTER B1 FILE OLD NEAREST NEIGHBOR AOI NONE arg1;Integer RASTER B2 FILE OLD NEAREST NEIGHBOR AOI NONE arg2;Integer RASTER B3 FILE OLD NEAREST NEIGHBOR AOI NONE arg3;Integer RASTER B4 FILE OLD NEAREST NEIGHBOR AOI NONE arg4;Integer RASTER B5 FILE OLD NEAREST NEIGHBOR AOI NONE arg5;Integer RASTER B6 FILE OLD NEAREST NEIGHBOR AOI NONE arg6;Integer RASTER B7 FILE OLD NEAREST NEIGHBOR AOI NONE arg7;Integer RASTER out FILE DELETE_IF_EXISTING PUBOUT IGNORE 0 ATHEMATIC 8 BIT UNSIGNED INTEGER arg8;show "------Show all input arguments:------";show "------arg1-----", arg1;show "------arg2-----", arg2;show "------arg3-----", arg3;show "------arg4-----", arg4;show "------arg5-----", arg5;show "------arg6-----", arg6;show "------arg7-----", arg7;show "------arg8-----", arg8;{## function definitions#out = STACKLAYERS ( $B1, $B2, $B3, $B4, $B5, $B6, $B7 ) ;}QUIT;

Here is your DOS batch file:@echo offecho "----task 1-----";"d:/work/gi2010/root/bin/ntx86/modeler.exe" '"D:/work/gi93/root/etc/models/landsat_2.mdl"' -meter -state '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b10.tif"' '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b20.tif"' '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b30.tif"' '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b40.tif"' '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b50.tif"' '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b60.tif"' '"d:/work/data/output/lt50190372009320edc00/l5019037_03720091116_b70.tif"' '"d:/work/data/output/output1.img"';echo "----DONE-----";

How to run:Start IMAGINE.Then double click on the .bat file, you are done!! Easy!