Re: Colour maps overlaid on grey-scale (medical) images [message #14749 is a reply to message #14614] |
Thu, 25 March 1999 00:00  |
bowman
Messages: 121 Registered: September 1991
|
Senior Member |
|
|
In article <MPG.115fe42a3c79ceeb989727@news.frii.com>, davidf@dfanning.com
(David Fanning) wrote:
> Do you have
> a simple example that shows us *how* to directly manipulate
> the RGB values?
My thought was that one image (the 'base' image) is loaded into the 24-bit
image as gray-scale. That is, with equal R, G, and B values. The other
image is used to identify some pixels that should be colored. The R, G,
and B values for those pixels are then changed to produce, say, a "red
gray-scale" to indicate the parameter identified in the second image.
Below is some code for a different kind of problem. I'm plotting points
(with PLOTS) to represent two different quantities, a and and b,
simultaneously, one coded by the red intensity and one be the green
intensity. If both quantities are large, then the color should be yellow
(R + G). If both are small, however, I want white not black, so that I
can plot on a white background.
;a and b are in the range 0.0 to 1.0
np = N_ELEMENTS(a) ;Number of points to be plotted
COLOR_CONVERT, BYTE(255.0*a), $ ;Convert red and green to HSV
BYTE(255.0*b), REPLICATE(0.0, np), h, s, v, /RGB_HSV
s = v ;Make background white instead
of black
v[*] = 1.0 ;Make background white instead
of black
COLOR_CONVERT, h, s, v, r, g, b, /HSV_RGB ;Convert HSV back to RGB
point_color = COLOR_24(r, g, b) ;24-bit color for each point to
be plotted
The lesson here is that it is often easier to work in the HSV or HSL color
models. (I prefer HSV - H represents the 'color', S is like the amount of
that color pigment added into a can of white paint, and V controls the
overall 'brightness' level between black and full illumination. If I
remember the numerical values correctly (H, S, V) = (0, 128, 255) gives
bright pink.
Similar things would work with image pixel values.
Ken
--
Kenneth P. Bowman, Professor 409-862-4060
Department of Meteorology 409-862-4466 fax
Texas A&M University bowmanATcsrp.tamu.edu
College Station, TX 77843-3150 Change the AT to @
|
|
|