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

Home » Public Forums » archive » "marching ants" rubberband box
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
"marching ants" rubberband box [message #31993] Wed, 04 September 2002 10:21 Go to next message
graves is currently offline  graves
Messages: 7
Registered: September 2001
Junior Member
Hi all,

Just wondering if anyone had implemented (or knew of a simple way to
implement) a "marching ants" rubberband box. I'm working on a program
involving ROI analysis and would like a better of identifying the
selected ROI than just changing its color. I didn't see anything on
this subject in David's tips archive or elsewhere in the IDL-verse.
Perhaps it is not efficient within an IDL framework ... I can't see
any way to do it short of essentially rewriting PLOTS. Any clever
ideas appreciated!






Ted
graves@helix.mgh.harvard.edu
sec : U Re: "marching ants" rubberband box [message #32050 is a reply to message #31993] Thu, 05 September 2002 18:35 Go to previous message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
"Ted Graves" <graves@helix.mgh.harvard.edu> wrote in message
news:dcd95cfc.0209040921.76329af2@posting.google.com...
> Hi all,
>
> Just wondering if anyone had implemented (or knew of a simple way to
> implement) a "marching ants" rubberband box. I'm working on a program
> involving ROI analysis and would like a better of identifying the
> selected ROI than just changing its color. I didn't see anything on
> this subject in David's tips archive or elsewhere in the IDL-verse.
> Perhaps it is not efficient within an IDL framework ... I can't see
> any way to do it short of essentially rewriting PLOTS. Any clever
> ideas appreciated!
>
>
>
>
>
>
> Ted
> graves@helix.mgh.harvard.edu
Ted Graves wrote:
>
> Hi all,
>
> Just wondering if anyone had implemented (or knew of a simple way to
> implement) a "marching ants" rubberband box. I'm working on a program
> involving ROI analysis and would like a better of identifying the
> selected ROI than just changing its color. I didn't see anything on
> this subject in David's tips archive or elsewhere in the IDL-verse.
> Perhaps it is not efficient within an IDL framework ... I can't see
> any way to do it short of essentially rewriting PLOTS. Any clever
> ideas appreciated!
>
> Ted
> graves@helix.mgh.harvard.edu


Hi Ted,

No doubt one of the Gurii will produce a decent "marching ants"
soon, but in the meantime here's a simple Direct Graphics attempt
with the ants "marking time", i.e. marching on the spot.


Andrew


PRO Marching_Ants1

; A.D. Cool 05-Sep-02 Marching Ants "Marking Time"

loadct,0
roi_ex ; an amended example from RSI doco

END


PRO roi_ex

Device,decomp=0
device,set_graphics = 3
; Load and display an image.
img=READ_DICOM(FILEPATH('mr_knee.dcm',SUBDIR=['examples','da ta']))
img_size = SIZE(img)
window,xsize=img_size(1)*2,ysize=img_size(2)*2
TV, REBIN(img,img_size(1)*2,img_size(2)*2)

; Print instructions.
PRINT,'To create a region:'
PRINT,' Left mouse: select points for the region.'
PRINT,' Right mouse: finish the region.'

; Collect first vertex for the region.
CURSOR, xOrig, yOrig, /UP, /DEVICE

Device,set_graphics = 6

PLOTS, xOrig, yOrig, PSYM=1, /DEVICE
xc = xorig & yc = yorig

;Continue to collect vertices for region until right mouse button.
x1 = xOrig
y1 = yOrig
while !MOUSE.BUTTON ne 4 do begin
x0 = x1
y0 = y1
CURSOR, x1, y1, /UP, /DEVICE
xc = [xc,x1] & yc = [yc,y1]
x2 = x1
while x2 eq x1 AND !MOUSE.BUTTON ne 4 Do Begin
PLOTS,xc,yc,linestyle = 2,/DEVICE , COLOR = !P.COLOR,thick=1
wait,0.1
CURSOR, x2, y2, /NOWAIT, /DEVICE
endwhile
endwhile
PLOTS, [x1,xOrig], [y1,yOrig], /DEVICE
xc = [xc,xorig] & yc = [yc,yOrig]

Device,set_graphics = 3

; Blink on/off using Linestyle=2 for Dashed lines.
print,'Hold down Mouse button 1 to finish.'
XYOUTS,0.5,0.9,'Hold down Mouse button 1 to finish.',align=0.5

; Blink away until user presses MB 1
Device,set_graphics = 6
While !MOUSE.BUTTON NE 1 Do begin
PLOTS,xc,yc,linestyle = 2,/DEVICE , COLOR = !P.COLOR,thick=1
CURSOR, x1, y1,/nowait, /DEVICE
wait,0.3
PLOTS,xc,yc,linestyle = 0,/DEVICE,COLOR = !P.COLOR,thick=1
End

; replot in solid colour
Device,set_graphics = 3
PLOTS,xc,yc,linestyle = 0,/DEVICE,COLOR = !P.COLOR
print,'Fin!'
END



------------------------------------------------------------ ----------------
-
Andrew D. Cool
Electromagnetics & Propagation Group
Intelligence, Surveillance & Reconnaissance Division Transmitted on
Defence Science & Technology Organisation 100% recycled
PO Box 1500, Edinburgh electrons
South Australia 5111

Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
Email : andrew.cool@no-spam.dsto.defence.gov.au
------------------------------------------------------------ ----------------
-
Re: "marching ants" rubberband box [message #32065 is a reply to message #31993] Thu, 05 September 2002 09:30 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Pavel A. Romashkin (pavel_romashkin@hotmail.com) writes:

> You know, that one can be turned off. Or, like I have, you can change it
> to a purring cat. If you choose to do that, you will immediately see
> that some department of Microsoft had *way* too much time on their
> hands, because the cat sleeps, scratches, meows, sleeps, catches
> butterflies and does all sorts of other things. And it behaves
> differently in different Office programs.
> Oh well. It has a lot more personality than the clip.

Oh, I *love* the cat. Now the dog, who is always
underfoot, is rooting around looking for the
damn thing, and the chance of me getting any work
done is just about nil. So much for Microsoft
productivity. :-(

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Problem with IDL 5.5 on Red Hat 7.2
Next Topic: RSI User contributed library - ActiveX Mediaplayer control

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

Current Time: Wed Oct 08 17:02:37 PDT 2025

Total time taken to generate the page: 0.00588 seconds