comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: color .ps/gamma_ct

Re: color .ps/gamma_ct
type: item
description: Peter Gallagher (P.Gallagher@qub.ac.uk) writes: > I'm trying to plot two images in one Postscript file using the > same color table. The only problem is that I want to apply a > different gamma correction to each image. > The GAMMA_CT changes the appearance of both the images each time > it is applied - I want a separate gamma correction for each image. > > Any body come up against this problem before? This is another of those "color awareness" issues that comes up over and over and is a weakness, I think, in the routines that are supplied with IDL. This is one of the things I harp on in my book and I even supply several routines (e.g., XColors) to help you solve the problem. Here is a better routine named Set_Gamma that can be used to change the gamma correction. It uses the keywords NCOLORS and BOTTOM so that you can determine just which portion of the color table you want to change the gamma correction on. It will allow you to have two (or more) independent images with different gamma corrections. Suppose I had 200 colors and I wanted to use the gray-scale color table for each, but I want each image to have a different gamma correction. I would do it like this: image = GETImage() LoadCT, 0, NColors=100 LoadCT, 0, NColors=100, Bottom=100 Set_Gamma, 0.7, NColors=100 Set_Gamma, 0.3, NColors=100, Bottom=100 TV, BytScl(image, Top=99) TV, BytScl(Image, Top=99) + 100B Cheers, David *************************************************** PRO Set_Gamma, gamma, NColors=ncolors, Bottom=bottom IF N_Elements(ncolors) EQ 0 THEN ncolors = (!D.N_Colors < 256) IF N_Elements(bottom) EQ 0 THEN bottom = 0 ; Keep gamma between 0.1 and 10. IF N_Params() EQ 0 THEN gamma = 1.0 gamma = gamma > 0.1 gamma = gamma < 10.0 ; Get the current color table vectors. TVLCT, r, g, b, /Get ; Pull the colors needed. red = r[bottom:ncolors-1+bottom] green = g[bottom:ncolors-1+bottom] blue = b[bottom:ncolors-1+bottom] ; Apply gamma correction. index = Findgen(ncolors) distribution = index^gamma index = Roun…
creator: davidf
date: 1998-01-23T08:00:00-00:00

Re: color .ps/gamma_ct
type: item
description: Peter Gallagher wrote: > > Hi all, > > I'm trying to plot two images in one Postscript file using the > same color table. The only problem is that I want to apply a > different gamma correction to each image. > > Something like ... > > LOADCT, 3 > > TV, image1 > GAMMA_CT,.7 > > TV, image2 > GAMMA_CT,.3 > > The GAMMA_CT changes the appearance of both the images each time > it is applied - I want a separate gamma correction for each image. > > Any body come up against this problem before? > No, but having just read this part in David Fanning's excellent book, I would assume you will have to try the following steps: 1) load your color table 2) apply the 1st gamma correction 3) read the color table into an array (or the 3 r,g,b arrays) 4) load the original color table again 5) apply the second gamma correction 6) read the color table into an array 7) shrink both arrays by eliminating every second entry 8) load array1 in the lower part of the color table 9) load array2 in the upper part of the color table 10) re-scale your images (BYTSCL) so that they span the color range of 0..half-1 (image1) and half..top (image2) Hope this helps, Martin. ------------------------------------------------------------ ------- Dr. Martin Schultz Department for Earth&Planetary Sciences, Harvard University 186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA phone: (617)-496-8318 fax : (617)-495-4551 e-mail: mgs@io.harvard.edu IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/ ------------------------------------------------------------ -------
creator: Martin Schultz
date: 1998-01-23T08:00:00-00:00

Re: color .ps/gamma_ct
type: item
description: Liam Gumley wrote: > > How about something like this: > > SET_PLOT,'PS' > DEVICE,/COLOR,BITS=8 > > LOADCT, 3 > GAMMA_CT,.7 > TV, image1 > > LOADCT, 3 > GAMMA_CT,.3 > TV, image2 > > DEVICE,/CLOSE > > Cheers, > Liam. Thanks Liam but I tried this and GAMMA_CT still changes both the images. I also tried splitting the color table in two but again I still can't work out how to apply the GAMMA_CT to each image individually. Cheers, Peter. -- ============================================================ ====== Peter T. Gallagher, | Tel: +44 1232 273708 Dept. of Pure and App. Physics, | Fax: +44 1232 438918 The Queen's University of Belfast,| E-mail: P.Gallagher@qub.ac.uk Belfast, BT7 1NN, | http://star.pst.qub.ac.uk/~ptg Northern Ireland. | ============================================================ ======
creator: Peter Gallagher
date: 1998-01-23T08:00:00-00:00

Re: color .ps/gamma_ct
type: item
description: Peter Gallagher wrote: > I'm trying to plot two images in one Postscript file using the > same color table. The only problem is that I want to apply a > different gamma correction to each image. > Something like ... > LOADCT, 3 > > TV, image1 > GAMMA_CT,.7 > > TV, image2 > GAMMA_CT,.3 > > The GAMMA_CT changes the appearance of both the images each time > it is applied - I want a separate gamma correction for each image. How about something like this: SET_PLOT,'PS' DEVICE,/COLOR,BITS=8 LOADCT, 3 GAMMA_CT,.7 TV, image1 LOADCT, 3 GAMMA_CT,.3 TV, image2 DEVICE,/CLOSE Cheers, Liam.
creator: Liam Gumley
date: 1998-01-23T08:00:00-00:00