comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Puzzled by colour tables...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Puzzled by colour tables... [message #7994 is a reply to message #7901] Tue, 28 January 1997 00:00 Go to previous message
Phil Williams is currently offline  Phil Williams
Messages: 78
Registered: April 1996
Member
David Kennedy wrote:

> I would much prefer to use 'loadct, 3' simply for compatibilty with
> earlier software I'm using. The problem is that the help on this subject
> is thin and I can't find anything relevant in the various IDL
> books knocking about the lab (all old, all tattered!). I have no idea
> what to set 'color' to in my call to 'polyfill', brief
> experiments with random numbers proved more confusing.
> How do the tables scale? Are they 0-225 or what for example?

print, !d.n_colors

-or-

print, !d.table_size

will tell you how many colors IDL is using for it's color table. Once
this is know use bytscl to scale your data into this range using the top
= !d.n_colors.

tv, bytscl(data, top = !d.n_colors) + bottom

If you are using all the colors then bottom = 0. This gives you a way
of splitting the color table up so that different images can be
displayed using different colors. For instance:

IDL> a = dist(64,64)
IDL> print,!d.n_colors
256
IDL> loadct,3,ncolors = 128
% Compiled module: LOADCT.
% Compiled module: FILEPATH.
% LOADCT: Loading table RED TEMPERATURE
IDL> window,xsize=64,ysize=64
IDL> tv,bytscl(a,top=128)
IDL> window,2,xsize=64,ysize=64
IDL> loadct,5,ncolors = 127, bottom=129
% LOADCT: Loading table STD GAMMA-II
IDL> tv,bytscl(a,top=127) + 129

BTW, anyone know the difference between table_size and n_colors? They
seem to always be equal to each other.

> Oh, and would I be right at all in assuming that a routine to add
> a 'colour bar' up the side of an image exists in a library or FAQ
> somewhere? Seems like a common type of operation, anyone know where
> I can lay my hands on something useful?
> I reckon this would prove to be tricky to be honest and it seems like
> re-inventing the wheel.

David Fanning has one of these in his library of functions. I usually
have an extra draw widget to the side of the main draw widget to display
the color tables. Haven't had time to make it a compund widget, but the
plan is there.

> Sorry for sounding like a complete idiot! I do know how to program,
> honest. Its just that IDL always seems to have the perfect answer
> buried somewhere within it, and I only ever find it after writing
> 100s of lines of code that didn't really work... "Show3? Whats that?
> You can do that? Wow!"
>
> As usual, as this is work, I'd appreciate email as well as a post due
> to the fact that my University newserver is somewhat eccentric and
> might decide that I don't need helpful advice.
>

Good luck,
Phil
--
/*********************************************************** ********/
Phil Williams, Ph.D.
Research Instructor
Children's Hospital Medical Center "One man gathers what
Imaging Research Center another man spills..."
3333 Burnet Ave. -The Grateful Dead
Cincinnati, OH 45229
email: williams@irc.chmcc.org
URL: http://scuttle.chmcc.org/~williams/
/*********************************************************** ********/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: where help
Next Topic: Shaded circles request.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:43:47 PDT 2025

Total time taken to generate the page: 0.00437 seconds