[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colormaps (a favorite subject!)

Alex Schuster wrote:
> Craig Hamilton wrote:
> > Thanks for the code, but my problem is not with grey-levels vs.
> > number of colormap entries.  My problem is as originally stated
> > it:  I want the user to be able to select the number of colors
> > in the colormap, but I can't popup a window to get that information
> > without having the number of colormap entries already set
> > in the act of popping up the window.  I must not be explaining
> > myself very well.  I've done loads of image processing programming
> > in other languages on Unix and Windoze, so I'm familiar
> > with colormaps and scaling of image data for display.
> > I'm working with 16-bit data on 8-bit displays right now and I want to
> > avoid color-flashing, so I want to use from 32 to 128 colormap
> > entries for this display program.  I want the user to be
> > able to select how many entries are used.
> Why don't you just let IDL allocate as much colors as it can get (window
> & wdelete & ncolors=!d.n_colors)?
> > Maybe a little more simply:
> > I have been initializing the size of the colormap used with:
> >       window,0,colors=numcolors,/pixmap,xsize=10,ysize=10
> >       wdelete,0
> > But now I just want to get the number 'numcolors' from the user first.
> > I think I am realizing that I cannot get that number with a widget.
> > Right?
> I have had a similar problem: A tool displays brain images, but there
> are often too few colors. So I check for the number of available colors,
> and if it is at least 64, I use 64 color cells. If there are less, I
> install a private colormap. This results in a flickering display, but at
> least the user gets enought colors.
> What I did to check the number of available colors is to open a
> temporary IDL session which checks the number, and writes it to a file
> in /tmp. The session then exists, and another IDL session starts. It
> reads the file in /tmp, and allocates as much color cells as stated in
> the file.

I think Craig is looking for a way to let the user control how many colors IDL
is stealing from the colormap.  You can certainly configure this in many ways,
but I think he wants more control than letting it steal all remaining colors, or
all but some specific number of remaining colors (using negative numbers in
COLOR=numcolors).  What if he wanted two versions of IDL running at once (though
see the SET_TRANSATION keyword to DEVICE in this case), or wanted to later start
another display tool?  If IDL's color greed is not put in check, there will be
none remaining for these other applications.  

Unless this is something which users will want to change all of the time, I
would let them configure it once, write it to file, and instruct them that they
must restart IDL for changes to be in effect (Windows users will not be
disconcerted by this requirement whatsoever).  Then, upon startup, read in the
file, and set that number of colors.  They can always change it again with the
stipulation that it will go into effect on the next session only.


 J.D. Smith                             |*|      WORK: (607) 255-5842    
 Cornell University Dept. of Astronomy  |*|            (607) 255-6263
 304 Space Sciences Bldg.               |*|       FAX: (607) 255-5875 
 Ithaca, NY 14853                       |*|