The ENVI application is written in a language called IDL.
You can use this to automate various tasks.
As a first example, let's load an image from the command prompt, following the envi help pages example.
Having started ENVI, you should see an ENVI prompt:
ENVI>
At the ENVI prompt, type:
ENVI> here = getenv('PWD')
ENVI> e = ENVI(/CURRENT)
ENVI> File = FILEPATH('ETM-190600',Subdir=['data'], Root_Dir=here)
ENVI> Raster = e.OpenRaster(File)
ENVI> View = e.GetView()
ENVI> Layer = View.CreateLayer(Raster)
ENVI> View.Zoom, /FULL_EXTENT
ENVI> data = raster.GetData(BANDS=[1,2,3], SUB_RECT=[100,449,550,899])
Explaining that:
Set a variable called here to be the current directory (i.e. where we started from). In fact, this needs to be the directory where the data are in this case.
ENVI> here = getenv('PWD')
Now connect to the ENVI windowing session and return the variable e that contains information on that session.
ENVI> e = ENVI(/CURRENT)
Soecify the full pathname of the raster file we want to load.
ENVI> File = FILEPATH('ETM-190600',Subdir=['data'], Root_Dir=here)
Load the raseter dataset into ENVI.
ENVI> raster = e.OpenRaster(file)
Create a 'layer' and display the inage.
ENVI> View = e.GetView()
ENVI> Layer = View.CreateLayer(Raster)
ENVI> View.Zoom, /FULL_EXTENT
In this last command, we load bands 1 2 and 3 into the array data
In [ ]: