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

Re: Colormaps (a favorite subject!)



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.

        Alex
-- 
  Alex Schuster     Wonko@weird.cologne.de          PGP Key available
                    alex@pet.mpin-koeln.mpg.de