pro getcur,arr,outarr ; ; MIDAS-like work with cursor. x,y position (in DEVICE coordinates) ; and pixel value are printed after each click of left mouse button. ; Exit by clicking the right mouse button. Selected positions are ; marked with arrows. ; Input: image array ARR (2-dim). ; Output: cursor table (seq.no., x, y, value) in OUTARR. ; This table can be saved in a file. ; 19.9.1994 Michal on_error,1 if n_params() lt 1 then begin print,'usage: getcur, array [,output_list]' stop endif if n_params() gt 1 then outarr=fltarr(4,200) dim=size(arr) window,0,xsize=dim(1),ysize=dim(2) tvscl,arr print,'cursor selection: left button, quit: right button' n=0 curs: cursor,x,y,/device,/down if !err eq 4 then goto,fin n=n+1 print,n,x,y,arr(x,y) if n_params() gt 1 then outarr(*,n-1)=[n,x,y,arr(x,y)] ; arrow if x lt dim(1)/2 then xs=x+10 else xs=x-10 if y lt dim(2)/2 then ys=y+10 else ys=y-10 arrow,xs,ys,x,y goto,curs fin: if n_params() gt 1 then begin outarr=outarr(*,0:n-1) print,'save the cursor table? (y/n)' if get_kbrd(1) eq 'y' then begin file='' read,'filename ?',file openw,1,file printf,1,n for i=0,n-1 do printf,1,outarr(*,i) close,1 endif endif end