Re: Cut, copy and paste [message #12230] |
Tue, 28 July 1998 00:00 |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Daniel SAGE wrote:
>
> Hello,
> I am using IDL 5.1. I create a widget to visualize an image (TIFF)
> with different options. It misses the traditional Edit with the well
> known command cut, copy, and paste to copy a portion of an image.
> Is there a possibility to write a cut/copy/paste in IDL ?
Jan -
Yes! But the key word here is "write". You can use IDL's DEFROI.PRO to
define a polygonal region of interest on the image (or download
DEFROI2.PRO/.DOC and DEFROIS.PRO/.DOC from:
ftp://bial8.ucsd.edu pub/software/idl/share/idl_share.tar.gz
These routines allow you to define multiple ROI's at once, and
are a bit more flexible than DEFROI.PRO. It looks like you're
involved with medical imaging, so there might be more routines
here that would be useful. See the README file for routine
summaries.
You can also get a rubber-band box routine from Ray Sterner's
libraries:
http://fermi.jhuapl.edu/s1r/idl/idl.html
There are a *ton* of other routines here. I wouldn't think of writing
something unless I had checked here first.
As for the method, I'd suggest implementing a "buffer" for your
cut/copy/paste, as a pixmap window, and then use a combination of:
"TV", "TVRD", "DEVICE, COPY=[]" to perform the moving of data from
your window to/from the pixmap. Be careful using TVRD with scrollable
draw widgets or when the widget is obscured/iconified. This has been
a bug under X-Windows for some time now, and I'm not sure if it has
been fixed in 5.x or not. You can always use my SAFE_TVRD.PRO instead,
but it's just a bit slower (but it works consistently!).
Hope this helps.
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
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 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|
Re: Cut, copy and paste [message #12231 is a reply to message #12230] |
Tue, 28 July 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Daniel SAGE (daniel.sage@epfl.ch) writes:
> I am using IDL 5.1. I create a widget to visualize an image (TIFF) with
> different options. It misses the traditional Edit with the well known
> command cut, copy, and paste to copy a portion of an image.
> Is there a possibility to write a cut/copy/paste in IDL ?
Absolutely. I would start with the program ZOOMER that you can
download from my web page. This program allows you to draw
a rubberband box (CUT) around an area of an image and zoom
it (COPY/PASTE) into another window. Minor modifications
would probably give you exactly what you want.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|