color mapping question [message #6806] |
Thu, 29 August 1996 00:00 |
gennari
Messages: 25 Registered: April 1994
|
Junior Member |
|
|
Hi all,
I have a 256 color grayscale image and i'd like to overlay a
coastline with some color (red). How would I strech the grayscale
data values to fit 0-254 and reserve value 255 for a certain rgb
color? I'm Not having much luck with STRETCH,0,254 and then assigning
a rgb color to 255.
Thanks,
Scott
------------------------------------------------------------ ------
University of Hawaii voice (808) 956 5392
Dept. of Information & Computer Sciences fax (808) 956 9399
2565 The Mall, Keller 304A
Honolulu, HI 96822 email gennari@Hawaii.Edu
|
|
|
Re: color mapping question [message #6809 is a reply to message #6806] |
Thu, 29 August 1996 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
Scott Gennari wrote:
> I have a 256 color grayscale image and i'd like to overlay a
> coastline with some color (red). How would I strech the grayscale
> data values to fit 0-254 and reserve value 255 for a certain rgb
> color? I'm Not having much luck with STRETCH,0,254 and then assigning
> a rgb color to 255.
Try something this:
;- load grey scale color table
loadct,0
;- display image scaled to full color range, leaving one color
;- free at top of lookup table
tv,bytscl(dist(256),top=!d.n_colors-2)
;- make top color in lookup table red
tvlct,r,g,b,/get
g(!d.n_colors-1)=0
b(!d.n_colors-1)=0
tvlct,r,g,b
;- overplot a line in red
plots,[0,0],[200,200],color=!d.n_colors,/device
Cheers,
Liam.
|
|
|
Re: color mapping question [message #6810 is a reply to message #6806] |
Thu, 29 August 1996 00:00  |
Christian Soeller
Messages: 46 Registered: August 1996
|
Member |
|
|
gennari@universe.Hawaii.edu (Scott Gennari) writes:
> I have a 256 color grayscale image and i'd like to overlay a
> coastline with some color (red). How would I strech the grayscale
> data values to fit 0-254 and reserve value 255 for a certain rgb
> color? I'm Not having much luck with STRETCH,0,254 and then assigning
> a rgb color to 255.
Even on a 256 color display IDL will in general only have a subset of all
those colors as a few are normally already allocated by other applications.
The actual number of colors available to IDl can be found in the sys var
!D.TABLE_SIZE. So you might try to scale your data to 0...!D.TABLE_SIZE-2
and assign the color number !D.TABLE_SIZE-1 to red (colors 0...!D.TABLE_SIZE-2
set to shades of grey from 0 to 255). You get the idea. See also documentation
for the TVSCL procedure.
Hope this helps,
Christian
------------------------------------------------------------ --------
Christian Soeller mailto: csoelle@sghms.ac.uk
St. Georges Hospital Medical School Dept. of Pharmacology
Cranmer Terrace London SW17 0RE
|
|
|
Re: color mapping question [message #6946 is a reply to message #6806] |
Thu, 29 August 1996 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Christian Soeller wrote:
>
> gennari@universe.Hawaii.edu (Scott Gennari) writes:
>
>> I have a 256 color grayscale image and i'd like to overlay a
>> coastline with some color (red). How would I strech the grayscale
>> data values to fit 0-254 and reserve value 255 for a certain rgb
>> color? I'm Not having much luck with STRETCH,0,254 and then assigning
>> a rgb color to 255.
>
> Even on a 256 color display IDL will in general only have a subset of all
> those colors as a few are normally already allocated by other applications.
> The actual number of colors available to IDl can be found in the sys var
> !D.TABLE_SIZE. So you might try to scale your data to 0...!D.TABLE_SIZE-2
> and assign the color number !D.TABLE_SIZE-1 to red (colors 0...!D.TABLE_SIZE-2
> set to shades of grey from 0 to 255). You get the idea. See also documentation
> for the TVSCL procedure.
I use the following routines I've written to do this. If any look
useful to you let me know and I'll mail them to you.
BYTE_SCALE.PRO : scale contents of array between specified upper
and lower bounds
GRAYSCALE.PRO : Small popup widget with sliders to allow grayscale
adjustments. Can specify reserved colors.
ADJUST_PALETTE.PRO : Adjust RGB values for individual color index.
ADJUST_COLORS.PRO : Widget that lets you interactively adjust the
colors for any color index.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
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 ]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|