Puzzled by colour tables... [message #7901] |
Mon, 27 January 1997 00:00  |
D.Kennedy
Messages: 26 Registered: January 1997
|
Junior Member |
|
|
I have a plot (which grew from a request here not so long ago!)
consisting of circular data 'regions' (its basically a map of a part
of the sky). I'd like these circles to be colour coded according to
the value of that 'region'.
The problem is that while I have worked with colour tables before
its always been in the context of 'contour' or similar or in
prewritten software.
Basically, what is the best way to go about putting together
a routine to easily scale the colours according to the data (I wish
to do this for many datasets therefore need it to scale itself with
no interaction from me. And I'm lazy!).
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?
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.
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.
--
David Kennedy, Dept. of Pure & Applied Physics, Queen's University of Belfast
Email: D.Kennedy@Queens-Belfast.ac.uk | URL: http://star.pst.qub.ac.uk/~dcjk/
Hi! I'm a .signature virus! Copy me into yours and join the fun!
|
|
|
Re: Puzzled by colour tables... [message #7986 is a reply to message #7901] |
Tue, 28 January 1997 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Phil Williams wrote:
>
> BTW, anyone know the difference between table_size and n_colors? They
> seem to always be equal to each other.
Hard to tell from the discussion of !D in the IDL help. Seems the only
difference might be that you can use !D.TABLE_SIZE as a test to see
if there are ANY color indices available to modify. If TABLE_SIZE
is equal to zero, then you have a static color table (and presumably
N_COLORS might be nonzero, though this doesn't seem clear).
>
>> 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.
>
David:
If you want a simple widget routine that will let you modify
the color table, I can send you a copy of my ADJUST_COLORS.PRO,
which is just an expansion of the example in the IDL manual.
I find it pretty useful, and it's a good example of using
widget uvalues to store state information.
Included would be ADJUST_PALETTE.PRO (probably a misnomer) that
adjusts one color index using a function call.
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2200
La Jolla, CA 92037
[ UCSD Mail Code 0949 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|
Re: Puzzled by colour tables... [message #7988 is a reply to message #7901] |
Tue, 28 January 1997 00:00  |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
Phil Williams <williams@irc.chmcc.org> writes:
> BTW, anyone know the difference between table_size and n_colors? They
> seem to always be equal to each other.
If you have a 24 bit system, then they're not the same. !D.Table_size is still
~255, but !D.N_colors is the cube of that.
Bill Thompson
|
|
|
Re: Puzzled by colour tables... [message #7994 is a reply to message #7901] |
Tue, 28 January 1997 00:00  |
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/
/*********************************************************** ********/
|
|
|