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 
Return to the default flat view Create a new topic Submit Reply
sec : U Re: "marching ants" rubberband box [message #32050 is a reply to message #31993] Thu, 05 September 2002 18:35 Go to previous messageGo 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
------------------------------------------------------------ ----------------
-
[Message index]
 
Read Message
Read Message
Read Message
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: Sun Oct 12 14:47:25 PDT 2025

Total time taken to generate the page: 1.28032 seconds