;+ ; NAME pos_lab_time ; ; FUNCTION Determine pixel coordinates of the mouse cursor. ; ; SYNTAX pos_lab_time, fname, xdim, ydim, xcen, ycen, pixrs, roll, pos=1 ; file image filename ; xdim, ydim image dimensions ; xcen, ycen sun center ; pixrs pixels/Rsun ; roll angle (deg) of solar north w.r.t. +Y axis. ; pos Optional position number label. ; pfile Optional output file name. ; disp_label Display label option ; ; HISTORY Andrew L. Stanger HAO/NCAR 14 May 1999 ; 26 Sep 2001: Label cursor position. ; 17 Jul 2003: Adapted from "mouse_pos_lab.pro". ; Computes time at position angle for Mk3 & Mk4. ; 7 Oct 2004: Add disp_label option. ;- PRO pos_lab_time, fname, xdim, ydim, xcen, ycen, pixrs, roll, $ pos=pos, pfile=pfile, disp_label=disp_label IF (KEYWORD_SET (pos)) THEN pos_num = pos $ ELSE pos_num = 1 IF (KEYWORD_SET (pfile)) THEN $ BEGIN CLOSE, 21 OPENU, 21, pfile, /APPEND END angle = 0.0 radius = 0.0 TVCRS, xcen, ycen ; Enable cursor PRINT, 'Click left mouse button to print cursor position [r,pos_angle].' PRINT, 'Click middle mouse button to terminate cursor position coordinates.' WHILE ( 1 ) DO $ BEGIN CURSOR, rxcur, rycur, /DEVICE, WAIT=3 IF (!ERR EQ 2) THEN GOTO, quit ; Done if middle button clicked. ierror = rcoord (radius, angle, rxcur, rycur, -1, roll, xcen, ycen, pixrs) ;--- Get time for position angle if telescop = mk3 or mk4. ;--- Print position information to workstation window. imghdu = headfits (fname) telescop = fxpar (imghdu, 'TELESCOP') telescop = STRTRIM (telescop, 2) IF (telescop EQ 'MK3') THEN $ BEGIN angle_time = mk3_time (fname, angle) PRINT, FORMAT = '("#", i3, " [x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees", " time: ", a8)', $ pos_num, rxcur, rycur, radius, angle, angle_time IF (KEYWORD_SET (pfile)) THEN $ PRINTF, 21, FORMAT = '("#", i3, " [x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees", " time: ", a8)', $ pos_num, rxcur, rycur, radius, angle, angle_time END $ ELSE $ IF (telescop EQ 'MK4') THEN $ BEGIN angle_time = mk4_time (fname, angle) PRINT, FORMAT = '("#", i3, " [x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees", " time: ", a8)', $ pos_num, rxcur, rycur, radius, angle, angle_time IF (KEYWORD_SET (pfile)) THEN $ PRINTF, 21, FORMAT = '("#", i3, " [x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees", " time: ", a8)', $ pos_num, rxcur, rycur, radius, angle, angle_time END $ ELSE $ BEGIN PRINT, FORMAT = '("#", i3, " [x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees")', $ pos_num, rxcur, rycur, radius, angle IF (KEYWORD_SET (pfile)) THEN $ PRINTF, 21, FORMAT = '("#", i3, " [x,y]: ", i4, i4, " [r,th]: ", F5.2, " Rsun ", F7.2, " degrees")', $ pos_num, rxcur, rycur, radius, angle END WAIT, 0.5 ;--- Write info to screen. ; PRINT, 'x, y: ', rxcur, rycur, ' radius, angle: ', radius, angle ; PRINT, STRING (rmin, FORMAT='(F7.2)'), ' --> ', $ ; STRING (rmax, FORMAT='(F7.2)'), ' Rsun ', $ ; STRING (angmin, FORMAT='(F7.2)'), ' --> ', $ ; STRING (angmax, FORMAT='(F7.2)'), ' degrees' ;--- Draw point at cursor position. xv = [rxcur - 3, rxcur + 3] yv = [rycur - 3, rycur + 3] PLOTS, xv, yv, color=254, /DEVICE xv = [rxcur + 3, rxcur - 3] yv = [rycur - 3, rycur + 3] PLOTS, xv, yv, color=254, /DEVICE IF (KEYWORD_SET (disp_label)) THEN $ XYOUTS, rxcur+5, rycur, STRTRIM (STRING (pos_num), 2), color=254, /DEVICE pos_num = pos_num + 1 END quit: WAIT, 1.0 IF (KEYWORD_SET (pfile)) THEN CLOSE, 21 END