;------------------------------------------------------------- ;+ ; NAME: ; IMAGSCL ; PURPOSE: ; Procedure to find shift between two BBSO magnetograms, ; to estimate the telescope image scale. ; This is only good to the nearest whole pixel. ; ; This procedure, given two images a1 and a2, ; displays a1 overlaid with a negative (pixels inverted) ; version of a2. The relative shift of a2 over a1 ; is controlled by moving the mouse and clicking. ; When done, the relative shift is printed on the screen. ; CATEGORY: ; IMAGE PROCESSING ; CALLING SEQUENCE: ; imagscl,a1,a2,... ; INPUTS: ; a1 = The first image. ; type: array, any type. ; a2 = The second image. ; type: array, any type. ; KEYWORD PARAMETERS: ; NOBYTE = If present, then NOBYTE specifies that a bytscl ; isn't to be performed. It assumes that the input is ; already in byte format. ; OUTPUTS: ; Prints relative shift of one image over the other. ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; J. Varsik,01 Nov, 1995 --- Adapted from Cohl's FLICKER program. ;- ;------------------------------------------------------------- pro imagscl,a1,a2,nobyte=nobyte,help=help ;Display idl header if help is required. if keyword_set(help) or n_params() lt 2 then begin get_idlhdr,'imagscl.pro' goto,finishup endif ;Print introduction. print,' -------------------' print,' Imgscl is running.' print," Type 'q' to exit. ' print,' Press a mouse button' print,' to shift the image.' print,' You may have to press' print,' the mouse button again' print," after typing 'q' to exit.' print,' -------------------' ;Byte scale images if (n_elements(nobyte) eq 0) then begin na1=bytscl(a1) na2=bytscl(a2) endif else begin na1=a1 na2=a2 endelse dev=getenv('IDL_DEVICE') dnc=!d.n_colors if (dev(0) eq 'SUN') then begin ;Scale Images na1=235*na1/255. na2=235 - (235*na2/255.) endif else begin na2 = 255 - na2 endelse na2siz = size(na2) centerx = na2siz(1) / 2 centery = na2siz(2) / 2 nas = na1 if (dev(0) eq 'SUN') then begin nas = na1 + na2 + 117 endif else begin nas = na1 + na2 + 128 endelse tv,nas while get_kbrd(0) ne 'q' do begin ; read mouse position cursor,mx,my,/device ; calculate image shift shiftx = centerx - mx shifty = centery - my if (dev(0) eq 'SUN') then begin nas = 117 + (na1 + shift(na2,shiftx,shifty)) endif else begin nas = 128 + (na1 + shift(na2,shiftx,shifty)) endelse tv,nas print,'shiftx = ',shiftx,' shifty = ',shifty endwhile finishup: return end