[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Color Overlays on Gray-Scale Image
- Subject: Color Overlays on Gray-Scale Image
- From: davidf(at)dfanning.com (David Fanning)
- Date: Tue, 30 Mar 1999 17:29:15 -0700
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:14158
Folks,
I mentioned a few days ago that I had fooled around with
the alpha blending channel on object graphics images to
see if I could create color image overlays on top of
gray-scale images. This worked extremely well, once
I realized that the foreground image had to be a 24-bit
image. (The background image can be a 24-bit image or
an 8-bit image.)
I'm in the process of writing an article about this for
my web page, but I thought the folks here might like a
preview of the code itself. (I'm trying to debug the
darn thing, if you want to know the truth.) The program
is named IMAGE_BLEND.PRO and it can be found at this URL:
http://www.dfanning.com/programs/image_blend.pro
You can just type it's name to see it in action:
IDL> Image_Blend
Or, you can pass it your own images (2D images only).
The images can be different sizes if you like:
IDL> Image_Blend, backgroundImage, foregroundImage
A COLORTABLE keyword can be used to set the colors
associated with the foreground image. The Red Temperature
color table (3) is used by default:
IDL> Image_Blend, Colortable=5
I wrote the program so that you can change either the
foreground or background image colors. (And at the same
time, if you like. Try *that* with XLOADCT!) But you
will need my color changing tool XCOLORS:
http://www.dfanning.com/programs/xcolors.pro
There is also a slider that will allow you to change
the "amount" of transparency of the foreground image.
All pixel values greater than zero are set with this
value. All zero pixel values are totally transparent.
(They don't have to be, but the example images look
better this way.) In a real application you would
probably make bone values less transparent than
muscle values, etc.
I tested the program briefly on an 8-bit display. It
"works", but like all object graphics programs it looks
a hell of a lot better on a 24-bit display and, of course,
there are no color conflicts on a 24-bit display.
There seems to be a bug in the Macintosh version of
IDL 5.2 on MacOS 8.x in which my XColors program
can go into some kind of a loop by sending an event
to another widget program. I'm investigating with RSI.
I could show you how to workaround this if it is
important to you.
Let me know what you think. This is not the be-all and
end-all. But it gets us going down the right path,
I think. :-)
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