Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/analyze_cursor.pro'
;+
; NAME:
; Analyze_Cursor
;
; PURPOSE:
; Check if cursor is in either the image or subimage window,
; and if so, display the cursor Location and pixel value.
; This routine is called in "timer" mode when the
; cursor-pixel label widget generates a timer event.
;
; CALLING:
; Analyze_Cursor, analyze_widget
;
; INPUT:
; analyze_widget = structure variable containing all info
; about the pro Analyze_Image widget.
;
; EXTERNAL CALLS:
; function get_cursor_win
; COMMON BLOCKS:
; common opticon0, imaged, imhead, imhist
; common opticon1, subimage, subhead, subhist
; PROCEDURE:
; Find out if cursor is in either image or sub-image window, and if so,
; get value of pixel at cursor location and display in label widget.
; In any case, reset the label widget timer (for longer time if
; cursor was not in either window).
; HISTORY:
; Frank Varosi NASA/GSFC 1993.
;-
pro Analyze_Cursor, analyze_widget
common opticon0, imaged, imhead, imhist
common opticon1, subimage, subhead, subhist
wi = where( analyze_widget.imspec.window EQ get_cursor_win( px,py ), nw )
if (px GE 0) AND (py GE 0) AND (nw EQ 1) then begin
WIDGET_CONTROL, analyze_widget.pixel_wid, $
TIMER = analyze_widget.pixel_timer
if (px EQ analyze_widget.px) AND (py EQ analyze_widget.py) then return
analyze_widget.px = px
analyze_widget.py = py
if (wi(0) EQ 0) then begin
sim = size( imaged )
imspec = analyze_widget.imspec(0)
if (sim(0) EQ 2) then begin
rf = analyze_widget.reducf
ps = (rf-1) > 0
L = sim(1:2)-1-ps
px = ( ( (px - imspec.wx) * rf ) > 0 ) < L(0)
py = ( ( (py - imspec.wy) * rf ) > 0 ) < L(1)
WIDGET_CONTROL, analyze_widget.pixel_wid, $
SET_VAL = "image( " + $
strtrim( px + imspec.x0, 2 ) + " , " + $
strtrim( py + imspec.y0, 2 ) + " ) = " + $
strtrim( Long( total( imaged(px:px+ps,py:py+ps) )/rf^2 ), 2 )
endif
endif else if (wi(0) EQ 1) then begin
sim = size( subimage )
imspec = analyze_widget.imspec(1)
if (sim(0) EQ 2) then begin
if (analyze_widget.reducsub GT 1) then begin
rf = analyze_widget.reducsub
ps = (rf-1) > 0
L = sim(1:2)-1-ps
px = ( ( (px - imspec.wx) * rf ) > 0 ) < L(0)
py = ( ( (py - imspec.wy) * rf ) > 0 ) < L(1)
value = Long( total( subimage(px:px+ps,py:py+ps))/rf^2 )
endif else begin
rf = 1.0/analyze_widget.magf
L = sim(1:2)-1
px = ( fix( (px - imspec.wx) * rf ) > 0 ) < L(0)
py = ( fix( (py - imspec.wy) * rf ) > 0 ) < L(1)
value = subimage(px,py)
endelse
WIDGET_CONTROL, analyze_widget.pixel_wid, $
SET_VAL = "sub-image( " + $
strtrim( px + imspec.x0, 2 ) + " , " + $
strtrim( py + imspec.y0, 2 ) + " ) = " + $
strtrim( value, 2 )
endif
endif
endif else WIDGET_CONTROL, analyze_widget.pixel_wid, $
TIMER = 3 * analyze_widget.pixel_timer
END