PRO STEPPER5_S1, INDEX, DATA, INFO_ARRAY=INFO_ARRAY,$ NOSCALE=NOSCALE, SUBSCRIPT=SUBSCRIPT, $ COLOR=COLOR, out=out,nohelp=nohelp,att=att, $ pauz=pauz,loud=loud,xoff=xoff,yoff=yoff ;+ ; NAME: ; STEPPER5_s1 ; PURPOSE: ; Step through individual images a single frame at a time ; and permit flagging the output vector with a 0 or 1. ; It is possible to switch back and forth on a given image ; as much as you want. ; Stepping or jumping through the data cube is the same ; as in stepper. ; Quarter resolution images are rebinned to 512x512. ; INPUTS: ; INDEX = SXT index structure array ; DATA = Three-dimensional array ; OUTPUT ; A vector of 0's and 1's permitting easy selection or ; de-selection of images for further processing. ; OPTIONAL INPUT KEYWORDS: ; INFO_ARRAY = String array containing descriptive text ; NOSCALE = If set, will turn off tvscale ; SUBSCRIPT = Subset of array is displayed. ; COLOR = The color to use for displaying the info text string. ; /nohelp, don't print out the STEPPER5 Options. ; att, input weekly att file for drawing limb. Otherwise, limb ; is drawn using $DIR_GEN_ATT. ; pauz, pause between frames (sec). ; /loud, print runtime message re ATT time. ; xoff, yoff = offset of tvscl'd images (pixels) ; HISTORY: ; 11-Nov-2002 LWA, Gutted stepper_s1 for purposes of stepper2.pro. ; 24-Oct-2007 LWA, Created from stepper2_s1.pro ; 31-Oct-2007 LWA, added keyword nohelp to inhibit printout. ; 6-Nov-2007 LWA, Changed switch input from "k" to "1". ; 9-Nov-2007 LWA, Added att keyword. ; 3-Dec-2007 LWA, New conversion of att for rebinned images. ; 29-Jul-2008 LWA, Use sxt_shift_res to convert to HR xy. ; 30-Sep-2008 LWA, Added keyword pauz. ; 5-Oct-2008 LWA, If loud then print ATT time. ; 6-Oct-2008 LWA, Replaced REBIN with MOD_RES. ; 13-Oct-2008 LWA, Clarified use of att in header. ; 29-Oct-2008 LWA, Use draw_circle rather than sxt_grid. ; 9-Nov-2008 LWA, Generalized limb overlay for all resolutions. ; 12-Nov-2008 LWA, Fixed up rsun for rebinned QR images. ; Added keywords xoff and yoff. ; 18-Dec-2008 LWA, Deleted "if not qdone then erase" in line 144. ; When I recall why it was there I'll fix it better. ; 8-May-2013 LWA, Added /quiet in calls to get_rb0p. ;- ;on_error,2 ; Return to caller ans= '' nohelp=keyword_set(nohelp) if keyword_set(xoff) then xoff=xoff else xoff=0 if keyword_set(yoff) then yoff=yoff else yoff=0 if n_elements(color) eq 0 then color=255 ; Default color nimg=data_chk(DATA,/nimages) if n_elements(att) eq 0 then useatt=0 else useatt=1 if not keyword_set(pauz) then pauz=0.0 else pauz=pauz help,att,useatt if not keyword_set(subscript) then subscript = indgen(nimg) n_sel = n_elements(subscript) ; See if we should turn off the tvscl option: if keyword_set(noscale) then nosc = 0 else nosc = 2 DISP = nosc ; Set up info_array if it does not exist already: if n_elements(info_array) eq 0 then begin if n_elements(info_p) eq 0 then $ info_array = strtrim(string(indgen(nimg))+' :',2) $ else info_array = info_p endif stt=0 ; Starting image stt = min(abs(stt-subscript)) & stt=!c & !c=0 ; Get closest index i = stt qdisp = 1 qmovie = 0 qprint = 1 ;always print the menu message the first time qdone = 0 qfirst = 1 while not qdone do begin if (qfirst or qprint and not nohelp) then begin ; print, '-------- STEPPER5 Options --------' print,'STEPPER5: There are ',strtrim(string(nimg),2),' images in the array' ; print,'There are ',strtrim(string(n_sel),2),' images selected' ; print, 'Enter "b" to step backwards ; print, ' "m" for movie mode ; print, ' "s" to select new start index ; print, ' "1" to toggle value of index in out array ; print, ' "q" to quit ; print, ' "anything else" to step forward end qprint = 0 if (not qfirst) then ans = get_kbrd(1-qmovie) ans = strlowcase(ans) ; Convert to lower case if (qmovie) and (ans ne '') then begin qmovie = 0 qdisp = 0 ;;ans = '-' ;zero out the answer which stopped movie (might be "q") end qdisp = qfirst case ans of '-': ;do nothing 'm': begin ;movie mode selected print,'Type anything to abort movie mode ("q" will exit movie and STEPPER)' qmovie = 1 qdisp = 1 end 'b': begin i = i-1 if i lt 0 then i=n_sel-1 qdisp = 1 end 'q': qdone = 1 's': begin print,'* Enter the requested start image number',format='($,a)' read,i i=min(abs(i-subscript)) i=!c !c=0 qdisp = 1 end '1': begin if out(i) eq 0 then out(i)=1 else out(i)=0 xyouts,charsize=1.6,/norm,0.25,0.08,'Switched out('+strtrim(i,2)+') value to'+string(out(i)) end '*': stop else: if (not qfirst) then begin i = i + 1 if i ge n_sel then i = 0 qdisp = 1 end endcase ; if not qdone then erase if (qdisp) then begin j = subscript(i) ; Get selected images x0=0 & y0=0 if gt_res(index(j)) eq 2 then $ dat=mod_res(index(j),data(*,*,j),outres=1,norm_fact=1.) $ else dat=data(*,*,j) case DISP of 0: tv,dat, xoff, yoff 2: tvscl,dat, xoff, yoff endcase xyouts,charsize=1.6,/norm,0.25,0.12,'Currently out('+strtrim(i,2)+') is set to'+string(out(i)) if gt_res(index(j)) lt 2 then rsun=get_rb0p(index(j),/radius,/quiet)/gt_pix_size(index(j)) else $ rsun=get_rb0p(index(j),/radius,/quiet)/gt_pix_size(index(j))*2. if useatt then begin attj=tim2dset(att,index(j)) xy0=att(attj).pnt(0:1)/100. case 1 of gt_res(index(j)) eq 0 : xy=xy0 gt_res(index(j)) eq 1 : xy=sxt_shift_res(xy0,/xy,/fh) gt_res(index(j)) eq 2 : xy=sxt_shift_res(xy0,/xy,/fh) endcase draw_circle,/device,xy(0),xy(1),rsun endif else begin xy0 = gt_sxt_cen(index(j)) ;invert the sign case 1 of gt_res(index(j)) eq 0 : xy=xy0 gt_res(index(j)) eq 1 : xy=sxt_shift_res(xy0,/xy,/fh) gt_res(index(j)) eq 2 : xy=sxt_shift_res(xy0,/xy,/fh) endcase draw_circle,/device,xy(0),xy(1),rsun endelse break_point = 38 ; Break point if (get_logenv('STEPPER_BREAK') ne '') then break_point = fix(getenv('STEPPER_BREAK')) if strlen(info_array(j)) le break_point then begin xyouts,x0,y0+10,info_array(j),charsize = 1.26,/device,color=color endif else begin str0 = strmid(info_array(j),0,break_point) str1 = strmid(info_array(j),break_point,strlen(info_array(j))) xyouts,x0+10,y0+10,str1,charsize = 1.26,/device,color=color xyouts, x0,y0+23,str0,charsize = 1.26,/device,color=color endelse wait,pauz end qfirst = 0 end return end