X
12175

How to start ENVI on Linux with a specific file open and displayed

Sometimes it's handy to be able to launch ENVI while specifying a particular image file to open and display. There are a few different ways to do this on a Linux platform, depending on which ENVI application you are running, and exactly how you want it to work.

For ENVI 5.0+:

From a terminal window, you can issue the following command:

     envi -arg '<filepath and name>'

. . . where <filepath and name> is the full path and filename for the image file you wish to open an display when you launch ENVI. So, for example, if you want to launch ENVI with the qb_boulder_msi image that comes with an ENVI installation opened and displayed, you would use this following command (assuming that ENVI is installed in the typical location):

     envi -arg '/usr/local/exelis/envi52/data/qb_boulder_msi'

Note that the main ENVI interface automatically tries to figure out which bands you want to display, using internal logic based on characteristics of the image. If ENVI cannot determine which bands you probably want to display (for example, if it is a hyperspectral image), then the image will be opened, but not displayed.

For ENVI Classic:

The most common way to launch ENVI Classic while specifying an image file to open upon launch is to use a startup script. If you look in the ENVI Classic Help system under Getting Started with ENVI > Basics of Working With ENVI > Starting and Exiting ENVI > Using Startup Scripts, you will find an example that opens and loads an image when starting up ENVI.

Another option is to use the following steps:

1. Write some IDL code like the following:

;Start ENVI

envi

;Save the file you specified at the command line as the variable "file"

file=command_line_args()

;Open the specified file in ENVI

envi_open_file, file[0], r_fid=fid

;Display band 1 of the specified file in a grayscale display 

envi_display_bands, [fid], [0], /new

In this example, ENVI will display the first band of the specified file in a grayscale display. If you want something else, you will need to adjust the code to specify which bands to display, using the ENVI_DISPLAY_BANDS routine.

2. Save the code into a file called mylaunch.pro. Remember the full path to the location in which you save this file.

3. Start ENVI using a command something like this:

     idl '<path>/mylaunch.pro' -args '<path and name of file to open>'

For example, to open the qb_boulder_msi file mentioned earlier, I might issue a command like this:

     idl '/usr/shippert/code/mylaunch.pro' -args'/usr/local/exelis/envi52/data/qb_boulder_msi'

 

 

PS 4/6/2015; reviewed KK 4/6/2015