>  Docs Center  >  ENVI API  >  Display Control

ENVI

Display Control

Display Control

ENVI allows for multiple views and layers of data. You can also display Portals, which are used to see through two layers at a time. The ENVI API provides control over the display of these components when you are working in interactive mode or writing full programs that require interaction with the ENVI user interface.

Views and Layers


ENVI loads layers of data into a single view, by default. Each view can have one or more layers. You can also have up to 16 separate views.

Copy and paste the following code into the IDL command line to start ENVI and open a raster:

e = ENVI()
File = FILEPATH('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
  SUBDIRECTORY = ['data'])
Raster = e.OpenRaster(File)

Use the ENVI::GetView method to retrieve an existing view. The ENVI application contains one view when you first start it.

ENVI> View1 = e.GetView()

Use the ENVI::CreateView method to add more views:

ENVI> View2 = e.CreateView()

Now you have two ENVIView objects named View1 and View2. See the ENVIView help topic for a list of all the methods you can use with views, including rotating, animating, zooming, and jumping to known locations.

The next step is to populate each view with one or more layers using the ENVIView::CreateLayer method. In this example, you will add a true-color version of the image to the first view and a color-infrared version to the second view.

ENVI> Layer1 = View1.CreateLayer(Raster)
ENVI> Layer2 = View2.CreateLayer(Raster, /CIR)

Now that you have two views of the same image, you can geographically link them so that both images move at the same time when you pan them.

ENVI> View1.Geolink, View2

Center the images over a large lake in the image:

ENVI> View1.GoToLocation, -105.2062514D, 39.9974865D, /GEO

Pan by 100 pixels in the x and y directions:

ENVI> View1.Pan, 100, 100

When you are finished, close the ENVI session:

ENVI> e.Close

Use the LAYOUT keyword to define views

Another way to create views is to use the LAYOUT keyword to the ENVI function to define multiple views at the beginning of your session. Use the ENVI::GetView method to retrieve a reference to all of the views and treat them as array elements to populate them with different color combinations of the same image.

; Start the application and create an ENVIView 
; object that is a two-element array
e = ENVI(LAYOUT=[2,1])
 
; Select an input file
File = FILEPATH('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
  SUBDIRECTORY = ['data'])
Raster = e.OpenRaster(File)
 
Views = e.GetView(/ALL)
 
; Create a true-color layer and load it into
; the first view
Layer1 = Views[0].CreateLayer(Raster)
 
; Create a color-infrared layer and load it
; into the second view
Layer2 = Views[1].CreateLayer(Raster, /CIR)

Layer Types

Each type of data that ENVI supports (raster, vector, ROIs, and raster series) must be added to an appropriate layer before it can be displayed in a view. For example, ROIs must be displayed using an ENVIROILayer object. The following table lists the data types and their corresponding layer objects in the ENVI API:

Data Type

Layer Object

Raster

ENVIRasterLayer

Raster Series

ENVIRasterSeriesLayer

Region of interest (ROI)

ENVIROILayer

Vector

ENVIVectorLayer

Portals


A Portal is a small window that lets you see the layer that is underneath the currently displayed layer. You can animate between the layers using flicker, swipe, or blend operations. Copy and paste the following code into the IDL command line:

; Start the application
e = ENVI()
 
; Open an image
File = FILEPATH('qb_boulder_msi', SUBDIRECTORY=['data'], $
  ROOT=e.ROOT_DIR)
Raster = e.OpenRaster(File)
 
; Get current view
View = e.GetView()
 
; Create layers with different band combinations
Layer1 = view.CreateLayer(Raster)
Layer2 = view.CreateLayer(Raster, BANDS=[3,2,1])
Layer3 = view.CreateLayer(Raster, BANDS=[2,3,1])
Layer4 = view.CreateLayer(Raster, BANDS=[0,2,3])
Layer5 = view.CreateLayer(Raster, BANDS=[2,0,1])

Create a new portal that displays Layer4, which is underneath the top-most layer:

ENVI> Portal1 = View.CreatePortal()

Create another portal in a different location that displays Layer1:

ENVI> Portal2 = View.CreatePortal(LAYER=Layer1, LOCATION=[0,0])

Create another portal with a different size in a different location that displays Layer2:

ENVI> Portal3 = View.CreatePortal(LAYER=Layer2, SIZE=[200,200], LOCATION=[600, 100])

Turn on flickering for Portal1:

ENVI> Portal1.Animate, 1.0, /FLICKER

Close the ENVI session when you are done:

ENVI> e.Close



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us