;------------------------------------------------------------- ;+ ; NAME: ; OVERG ; PURPOSE: ; Generates an 8-bit IDL image consisting of a BBSO VMG ; and a grid produced by the HGRID function. ; CATEGORY: ; IMAGE PROCESSING ; CALLING SEQUENCE: ; outp = overg,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. We assume a2 is always in short ; integer format (the output of HGRID). ; NBIT = If present, NBIT indicates how the image is to be ; scaled. If NBIT has a value between 8 and 12, the ; input image is raw VMG pixel values (not calibrated) ; and the image is scaled as if it were being displayed ; on the Datacube or Quantex. If NBIT is less than zero, ; the image is a calibrated floating point image. Pixels ; with absolute value greater than the absolute value of ; NBIT are clipped. ; OUTPUTS: ; outp = IDL byte image ; Prints relative shift of one image over the other. ; COMMON BLOCKS: ; NOTES: ; MODIFICATION HISTORY: ; J. Varsik, 09 Nov, 1995 --- Adapted from IMAGSCL program. ; J. Varsik, 25 Feb, 1999 --- Added support for calibrated images. ;- ;------------------------------------------------------------- function overg,a1,a2,nbit=nbit,nobyte=nobyte,help=help ;Display idl header if help is required. if keyword_set(help) or n_params() lt 2 then begin get_idlhdr,'overg.pro' goto,finishup endif sizea1 = size(a1) outp = bytarr(sizea1(1),sizea1(2)) ;Byte scale images if (n_elements(nobyte) eq 0) then begin if (n_elements(nbit) ne 0) then begin if nbit gt 0 then begin if nbit eq 8 then div = 1 if nbit eq 9 then div = 2 if nbit eq 10 then div = 4 if nbit eq 11 then div = 8 if nbit eq 12 then div = 16 na1 = BYTSCL(FIX(a1 / div)+128,MIN=0,MAX=255) endif else begin na1 = BYTSCL(a1, min=nbit, max = abs(nbit)) endelse endif else begin maxa1 = max(a1) mina1 = min(a1) if (abs(mina1) gt maxa1) then begin big = abs(mina1) endif else begin big = maxa1 endelse na1 = BYTSCL(FIX((128./ big) * a1) + 128,MIN=0,MAX=255) endelse endif else begin na1=a1 endelse na2 = bytscl(a2,MIN=0,MAX=25000) na2siz = size(na2) centerx = na2siz(1) / 2 centery = na2siz(2) / 2 nai = FIX(na1) + na2 nas = BYTSCL(nai,MAX=255,MIN=0) outp = byte(nas) finishup: return,outp end