;+ ; ; NAME: ; CPCOLOR ; ; PURPOSE: ; Creates arrays for CP black and white and CP differcence color tables ; ; CATEGORY: ; CP display ; ; CALLING SEQUENCE: ; CPCOLOR, DIFF_R=DIFF_R, DIFF_G=DIFF_G, DIFF_B=DIFF_B, $ ; NORM_R=NORM_R, NORM_G=NORM_G, NORM_B=NORM_B ; ; CALLED BY: ; CP.PRO ; ; CALLS TO: ; none ; ; INPUTS: ; none ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; DIFF_R = red color array for difference images ; DIFF_G = green array for difference images ; DIFF_B = blue array for difference images ; NORM_R = red color array for normal (not difference) images ; NORM_G = green color array for normal (not difference) images ; NORM_B = blue color array for normal (not difference) images ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; CPLASTPASS for values need to reconstruct scale data ; ; SIDE EFFECTS: ; Temporarily creates a small IDL window. Users will see it "blip" ; on the screen. Necessary to obtain a corrrect value in !D.N_COLORS. ; ; RESTRICTIONS: ; Must have X window system graphic device. ; ; PROCEDURE: ; Create color array of size !D.N_COLORS. For normal (not difference) ; images, the color table is linear black to white, with cyan, red ; and white at the top index. For difference images the ; color table goes from blue to black (mid point ; index) to red to yellow, with black at lowest index and ; 3 indexes of white at top. ; ; MODIFICATION HISTORY: ; 1991 - Elaine Einfalt (HSTX) ; Apr 93 - modified color table ; ;- pro cpcolor, diff_r=diff_r, diff_g=diff_g, diff_b=diff_b, $ norm_r=norm_r, norm_g=norm_g, norm_b=norm_b @cplastpass.common window,/free,xsize=10,ysize=10 & wdelete,!d.window ; get # colors the system cpmaxscale = !p.color ; ; ; Create the normal image color table: ; ; black --> white with cyan, red and white line at max color indexes ; ;4/93 norm_r=indgen(!d.n_colors) & norm_g=norm_r & norm_b=norm_r ; ; There are this many color slots available for use. ; norm_r=intarr(!d.n_colors) & norm_g=norm_r & norm_b=norm_r ; ; In the data values area, squeeze in the gray scale color table that will ; span ~0 to ~255, to be used by normal images, leaving 3 indexes at top. ; remaining = !d.n_colors - 3 factor = 255. / remaining ; each index increases this much grays = indgen(remaining) * factor norm_r(0) = grays & norm_g(0) = grays & norm_b(0) = grays ; ; White line at max value ; index = !p.color norm_r(index)=255 & norm_g(index)= 255 & norm_b(index)=255 ; ; RED line at max-1 value ; index = !p.color-1 norm_r(index)=255 & norm_g(index)=0 & norm_b(index)=0 ; ; Cyan line at max-2 value ; index = !p.color-2 norm_r(index)=0 & norm_g(index)=255 & norm_b(index)=255 ;========================================================================= ; ; ; Create the difference color table: ; the black --> blue --> black --> red --> yellow ; with 3 indexes of white at top to mimic normal color table sestup. ; ; ; ; There are this many color slots available for use. ; diff_r=intarr(!d.n_colors) & diff_g=diff_r & diff_b=diff_r ; ; Find the mid point of the data display area. Adjust for top 3 and bottom 1 ; indexes, which are not used to show the data. ; cpmidscale = ((!p.color-4.)/2.) + 1. ; ; if not integer make two black indexes at middle to center arrays ; lomid = fix(cpmidscale) & himid = fix(cpmidscale + 0.5) ; ; Create the black (at mid point) --> red (3 indexes from top) part of the ; color table that will indicate positive data. ; ; avail = (!p.color - 3) - himid factor = 255. / avail ; each index increases this much reds = indgen(avail) * factor ; values of 0-255 ; ; Create the blue (1 index from bottom) --> black (at mid point) part of the ; color table that will indicate negative data. ; blues=max(reds) - reds ; array values from ~255 to 0 ; ; Assign values to red and blue color gun arrays ; diff_r(himid+1) = reds diff_b(1) = blues ; ; Now add a yellow to the top 20 indexes of the top of the data area. ; greennum = 20 factor = 255. / greennum ; each index increases this much green = (indgen(greennum)+1) * factor ; ; Assign values to green color gun arrays ; startgreen = !d.n_colors-3-greennum diff_g(startgreen) = green ; fill in green color gun array ; ; White lines at top 3 max indexes. ; index = !p.color diff_r(index) = 255 & diff_g(index)= 255 & diff_b(index)=255 index = !p.color-1 diff_r(index) = 255 & diff_g(index)= 255 & diff_b(index)=255 index = !p.color-2 diff_r(index) = 255 & diff_g(index)= 255 & diff_b(index)=255 ; ; Black line at min index ; diff_r(0) = 0 & diff_g(0)= 0 & diff_b(0)=0 end