;+ ; NAME: ; OVERLAY ; PURPOSE: ; Overlays 2 images and displays them on the screen. One image is ; displayed in red, the other one in blue. ; CATEGORY: ; CALLING SEQUENCE: ; overlay,ima,imb,xoffset,yoffset ; INPUTS: ; ima = first image. Must be a 2-D array. ; imb = second image. Must be of same size as ima. ; xoffset = int, optional. Image is displayed with offset in x. ; yoffset = int, optional. Image is displayed with offset in y. ; KEYWORDS (INPUT): ; amax = intensity of ima will be scaled evenly between 0 and amax. ; If not supplied, image scaled according to brightest pixel. ; bmax = intensity of imb will be scaled evenly between 0 and bmax. ; coffset = lowest intensity value for color map. ; cgain = intensity gain for color map. Make shure that ; coffset + cgain * 14 < 256. Optimum values for coffset and ; cgain depend upon the display hardware. ; OUTPUTS: ; No explicit outputs. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; An image is displayed, and the color map is modified. ; RESTRICTIONS: ; Requires a color display with at least 225 colors. ; PROCEDURE: ; The idea is to use the lower 4 bit of the image display for one ; image, and the upper 4 bit for the other image. Except that this ; version only uses 15 * 15 = 225 colors instead of 16 * 16 = 256. ; MODIFICATION HISTORY: ; JPW, Jan. 92 ;- pro overlay,ima,imb,xoffset,yoffset,amax=ma,bmax=mb,coffset=coff,cgain=cgain ; set default values if n_elements(xoffset) eq 0 then xoffset=0 if n_elements(yoffset) eq 0 then yoffset=0 if n_elements(ma) eq 0 then ma = max(ima) if n_elements(mb) eq 0 then mb = max(imb) if ma le 0 then ma=1 if mb le 0 then mb=1 if n_elements(coff) eq 0 then coff=17b if n_elements(cgain) eq 0 then cgain=17b ; useful values: for screen/transp.: cgain=17, coff=17, ; for print: cgain=15, coff=45 ; scale images into range 0...14 ia = byte(ima*(14.9/ma)) ib = byte(imb*(14.9/mb)) ; make shure intensities are not higher than 14 ia = ia < 14b ib = ib < 14b ; put them together ia = ia + ib * 15b ; create color table tvlct,r,g,b,/get col=bytarr(225) auxc=bindgen(15)*cgain+coff for i=0,14 do col(i*15:i*15+14)=auxc r(0:224)=col col=rebin(auxc,225,/sample) b(0:224)=col g(0:224)=col tvlct,r,g,b ; display the image tv,ia,xoffset,yoffset return end