Re: How to draw a line on an image? [message #5652] |
Wed, 31 January 1996 00:00 |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
yoshida@fermi.bsd.uchicago.edu (Hiro Yoshida) wrote:
>
> Hello IDL experts,
>
> Is there a handy way to draw lines on an image in IDL?
>
> I would like to draw some simple graphics such as lines, boxes, and circles
> on an image. (I am not talking about modifying image itself by putting
> white pixels to draw these figures.) I believe that IDL has some commands
> for this type of "overlay" task. Unfortunately, however, I cannot find one
> so far.
You might try using the normal drawing routines, like PLOT, OPLOT
and PLOTS, but set the graphics mode to XOR (exclusive-or) mode
like the following:
< xarray and yarray are integer arrays of coordinates >
wset, current_window
device, get_graphics = oldg, set_graphics = 6
plots, xarray, yarray, /device
This "draws" the lines on your image by XOR'ing all pixels. What
you get is usually not one continuous color, depending on the
contents of the image, but it may be workable. You can then
"undraw" the lines and restore the original image with:
plots, xarray, yarray, /device
device, set_graphics = oldg
Usually you will also want to restore the original graphics mode,
since most drawing operations are done using a different mode.
Hope this helps.
Dave Foster
UCSD Brain Image Analysis Lab
foster@bial1.ucsd.edu
|
|
|
|
Re: How to draw a line on an image? [message #5663 is a reply to message #5658] |
Mon, 29 January 1996 00:00  |
Hermann Mannstein
Messages: 22 Registered: September 1995
|
Junior Member |
|
|
Hiro Yoshida wrote:
>
> Hello IDL experts,
>
> Is there a handy way to draw lines on an image in IDL?
>
> I would like to draw some simple graphics such as lines, boxes, and circles
> on an image. (I am not talking about modifying image itself by putting
> white pixels to draw these figures.) I believe that IDL has some commands
> for this type of "overlay" task. Unfortunately, however, I cannot find one
> so far. Any suggestions are welcome.
Hi, look for the cw_defroi.pro within the lib directory of your IDL, but basically
you have to give some pixels of the display another color to see them ;-)
--
Regards,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Hermann Mannstein Tel.: +49 8153 28-2503
Institut fuer Physik der Atmosphaere or -2558
DLR - Oberpfaffenhofen Fax.: +49 8153 28-1841
Postfach 1116 \ mailto:H.Mannstein@dlr.de
D-82230 Wessling \ 0 http://www.op.dlr.de/~pa64
Germany ________\/|________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`--------\--------'~ ~~~~~~~~~~~~~~~~~~~~
\
|
|
|
Re: How to draw a line on an image? [message #5665 is a reply to message #5663] |
Mon, 29 January 1996 00:00  |
offenbrg
Messages: 31 Registered: August 1993
|
Member |
|
|
yoshida@fermi.bsd.uchicago.edu (Hiro Yoshida) writes:
> Hello IDL experts,
> Is there a handy way to draw lines on an image in IDL?
> I would like to draw some simple graphics such as lines, boxes, and circles
> on an image. (I am not talking about modifying image itself by putting
> white pixels to draw these figures.) I believe that IDL has some commands
> for this type of "overlay" task. Unfortunately, however, I cannot find one
> so far. Any suggestions are welcome.
I believe that the routine you want is "plots" (not "Plot"), which
allows you to draw graphics on a TV window (such as lines, circles, etc).
Also tvcircle and tvbox.
Now, this does change the image as stored in the window. The array stored
in memory will not be changed by this. There isn't really any way to
"overlay" in video memory without altering the contents of the window.
What you *could* do is copy the image into a pixmap window, so you can
recover it unchanged after you've finished with the graphics. The only
other trick I can think of involves using a 24-bit display...
Joel
--
"...And I am unanimous in this" - Mrs. Slocumbe
------------------------------------------------------------ ----------
| Joel D Offenberg | offenbrg@fondue.gsfc.nasa.gov |
| Hughes STX, NASA/GSFC/LASP | I get paid to stare into space. |
|
|
|
|