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

Home » Public Forums » archive » Colour maps overlaid on grey-scale (medical) images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Colour maps overlaid on grey-scale (medical) images [message #14614] Thu, 11 March 1999 00:00 Go to next message
Jason Brookes is currently offline  Jason Brookes
Messages: 2
Registered: March 1999
Junior Member
Hi,

I would like to know how to display colour overlays on medical images.
For example, an overlay of bloodflow rate superimposed (in hot body
colour scale) on grey-scale images of the brain. At the moment, I am not
able to do this without obliterating the information in the original
image. Is it possible to overlay a colour map onto a grey-scale image
without obliterating information in the grey-scale image ? ie: by making
the colour overlay "transparent" to some degree ?

Jason

Jason A. Brookes,
R�sonance Magn�tique des Syst�mes Biologiques,
UMR 5536 du CNRS/Universit� Victor Segalen Bordeaux 2,
146 ru� L�o Saignat,
33076 Bordeaux,
France.

Tel: +33 (0)5 57 57 10 83
Fax: +33 (0)5 56 96 13 41
E-mail: jason.brookes@rmsb.u-bordeaux2.fr
Re: Colour maps overlaid on grey-scale (medical) images [message #14668 is a reply to message #14614] Sun, 14 March 1999 00:00 Go to previous messageGo to next message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
> Is it possible to overlay a colour map onto a grey-scale image
> without obliterating information in the grey-scale image ? ie: by making
> the colour overlay "transparent" to some degree ?

The way I understand your question, you want to blend together
two images containing different types of information.

I believe the easiest way to do this is by working in RGB "space"
to blend the two images together into one image and then display
the composite image.

If you normally use colour tables, one simpleminded approach
would be the following (assuming image1 and image2 are of equal
size, and scaled to byte values match the available number of
colours):

; load/modify your grayscale colour table "as usual"
:
; Now, to read this colour table:
tvlct,r,g,b,/get

; Form an RGB image from the byte-scaled image1
im1rgb = [[[r[image1]]],[[g[image1]]],[[b[image1]]]]

; Load/modify your "hot body colour scale"
:
; Then we read it:
tvlct,r,g,b,/get

; Form RGB image from image2
im2rgb = [[[r[image2]]],[[g[image2]]],[[b[image2]]]]

; Take the average of the two images (avoid byte overflow!)

im = byte((fix(im1rgb) + fix(im2rgb))/2)

; Now the trick: Use color_quan to quantize the existing
; colors into one color table:
im_out = COLOR_QUAN(im, 3, red, green, blue)

; Now, load the appropriate color table and display image.
tvlct,red,green,blue
tv,im_out

A better/more flexible approach would be to make some kind of
direct color coding formula based on the actual data to be shown,
i.e:

red_image = func_red(bloodflow,brain_image)
grn_image = func_green(bloodflow,brain_image)
blu_image = func_blue(bloodflow,brain_image)

;; Then:

im = color_quan(red_image,grn_image,blu_image,r,g,b)
tvlct,r,g,b
tv,im

But be warned: Finding good formulas for the final RGB color
based on the input bloodflow/brain_image data can be quite a
challenge!

Best of luck.

Stein Vidar
Re: Colour maps overlaid on grey-scale (medical) images [message #14672 is a reply to message #14614] Sat, 13 March 1999 00:00 Go to previous messageGo to next message
bowman is currently offline  bowman
Messages: 121
Registered: September 1991
Senior Member
> I would like to know how to display colour overlays on medical images.
> For example, an overlay of bloodflow rate superimposed (in hot body
> colour scale) on grey-scale images of the brain. At the moment, I am not
> able to do this without obliterating the information in the original
> image. Is it possible to overlay a colour map onto a grey-scale image
> without obliterating information in the grey-scale image ? ie: by making
> the colour overlay "transparent" to some degree ?

If you use 24-bit color, you can do this by direct manipulation of the RGB
values of each pixel.

Ken Bowman

--
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 @
Re: Colour maps overlaid on grey-scale (medical) images [message #14683 is a reply to message #14614] Tue, 23 March 1999 00:00 Go to previous messageGo to next message
Vapuser is currently offline  Vapuser
Messages: 63
Registered: November 1998
Member
davidf@dfanning.com (David Fanning) writes:

> Kenneth P. Bowman (bowman@null.tamu) writes:
>
>> If you use 24-bit color, you can do this by direct manipulation of the RGB
>> values of each pixel.
>
> Yes, well, I have tried this too, but I never seem to get
> results that are completely satisfactory to me. Do you have
> a simple example that shows us *how* to directly manipulate
> the RGB values? I've tried making one image the red channel
> and one the green, etc., but the composite image is not
> really what I want.
>
> I did fool around last week during one of those jet lag
> nights where I was wide awake at 2AM with using the alpha blending
> functionality of an object graphics image. This worked
> surprisingly well after I realized that the documentation
> was just *slightly* misleading, and that the image "color"
> could only come from a 24-bit image.
>
> If I have some time later this week I'll describe what
> I learned in the article on this subject on my web page.
>
> Cheers,
>
> David
>

We have done this sort of thing here (JPL) with clouds over
land/water, using the grayscale of the cloud image as a *mask* of the
land/water image. I've found it easier to do this in HLS; this is a
more natural way to think of the interaction of the cloud/land/water
images. I did this in a completely ad-hoc manner, just trying to get
something that looked good, but I think it could be put on a more
rigorous footing by those more knowledgible in the matter at hand
(medical imagery, in this case) than I.

You can see an example of the method at

http://haifung.jpl.nasa.gov/qs_htdocs/

Scroll to the bottom, to the 'goes overlay' section and pick one of
the two pictures you find. If this interests you, drop me a line.

whd
Re: Colour maps overlaid on grey-scale (medical) images [message #14713 is a reply to message #14614] Mon, 22 March 1999 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kenneth P. Bowman (bowman@null.tamu) writes:

> If you use 24-bit color, you can do this by direct manipulation of the RGB
> values of each pixel.

Yes, well, I have tried this too, but I never seem to get
results that are completely satisfactory to me. Do you have
a simple example that shows us *how* to directly manipulate
the RGB values? I've tried making one image the red channel
and one the green, etc., but the composite image is not
really what I want.

I did fool around last week during one of those jet lag
nights where I was wide awake at 2AM with using the alpha blending
functionality of an object graphics image. This worked
surprisingly well after I realized that the documentation
was just *slightly* misleading, and that the image "color"
could only come from a 24-bit image.

If I have some time later this week I'll describe what
I learned in the article on this subject on my web page.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Colour maps overlaid on grey-scale (medical) images [message #14749 is a reply to message #14614] Thu, 25 March 1999 00:00 Go to previous message
bowman is currently offline  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 @
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: clipboard objects and postscript (unix)
Next Topic: working with very large data sets

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

Current Time: Wed Oct 08 15:16:12 PDT 2025

Total time taken to generate the page: 0.00629 seconds