This routine only works with ENVI Classic display groups and cannot be used with the ENVI display or in code that starts the application with the ENVI function.

Use this procedure to return the x and y locations of the current pixel in a given display group. Pixel locations are returned in a modified file coordinate system:

pixel coord = file coord + (x|y)start - 1

Where (x|y)start is the xstart or ystart value in the ENVI header for the displayed image.

Note: An interactive ENVI Classic session is required to run this procedure.

Syntax


DISP_GET_LOCATION, DN, XFLOC, YFLOC [, /FLOATING] [, /NO_OFFSET]

Arguments


DN

This keyword cannot be used to reference the ENVI display. It is only for use with ENVI Classic display groups.

This is the display number corresponding to an open display group. Display numbers (DNs) are zero-based; ENVI Classic Display #1 corresponds to DN=0. You can retrieve DNs in the event handler of user-managed display events. For example, use the following code to retrieve the uvalue for ev.top:

widget_control, ev.top, get_uvalue=dn

XFLOC

This returned variable contains the x location of the current pixel in modified file coordinates.

YFLOC

This returned variable contains the y location of the current pixel in modified file coordinates.

Keywords


FLOATING (optional)

Set this keyword if you want the XFLOC and YFLOC coordinates to be returned as floating-point values. If you do not set this keyword, then XFLOC and YFLOC will be long-integer values.

NO_OFFSET (optional)

Set this keyword to return the current pixel location in ordinary zero-based file coordinates without (x|y)start values being added.

Example


The following example prints the location of the current pixel for each display.

PRO EXAMPLE_DISP_GET_LOCATION
  compile_opt IDL2
  ; 
  ; Get all the display numbers and 
  ; check to make sure at least one  
  ; display is present.  
  ;
  display = envi_get_display_numbers()  
  if (display[0] eq -1) then return  
  ;
  ; Print out the location of the 
  ; current pixel for each display
  ;   
  for i=0, n_elements(display)-1 do begin
     disp_get_location, display[i], xloc, yloc    
     print, display[i], xloc, yloc  
  endfor
END

API Version


4.3