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

Home » Public Forums » archive » Drawing 2 or 3 contours on a same image
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
Drawing 2 or 3 contours on a same image [message #26970] Wed, 03 October 2001 10:51
idlfreak is currently offline  idlfreak
Messages: 47
Registered: October 2001
Member
HI,
I have to draw some 2 or 3 contours using mouse, marking the
various region of interest. My present program helps me to draw one
contour, but i can't stop it and proceed to mark another region of
interest in the same image.
The program is as follows. I tried to check if the other mouse
button is pressed and break from the loop, it doesn't help.
Can anybody help me....
Regards,
Akhila...

PRO contour1_Event, event

WIDGET_CONTROL, event.top, GET_UVALUE = state
WIDGET_CONTROL, event.id, GET_UVALUE = id
possibleEvents = ['DOWN', 'UP', 'MOTION', 'SCROLL', 'EXPOSE']
possibleButtons = ['NONE', 'LEFT', 'MIDDLE', 'NONE', 'RIGHT']
thisEvent = possibleEvents(event.type)
thisButton = possibleButtons(event.press)
if (id eq 'draw') then begin
case thisEvent of
'DOWN': begin
case thisButton of
'RIGHT': begin
state.oROI -> AppendData,[event.x,event.y,0]
;case thisButton of
;'LEFT': break ;endcase
;if (event.press eq 4) then print, event.press
;state.oWindow -> Draw, state.oView
end
endcase
;if (event.press eq 1) then break
end


'EXPOSE': begin
state.oWindow -> Draw, state.oView
end
else:
endcase
state.oWindow -> Draw, state.oView
endif

END

PRO contour1
xdim = 512
ydim = 512
wBase = WIDGET_BASE(/COLUMN)
wDraw = WIDGET_DRAW(wBase, XSize = xdim, YSize = ydim, GRAPHICS_LEVEL
= 2, /BUTTON_EVENTS, $
/EXPOSE_EVENTS, UVALUE = 'draw', RETAIN = 0 )
WIDGET_CONTROL, wBase, /REALIZE
WIDGET_CONTROL, wDraw, GET_VALUE = oWindow
;RESTORE, FILENAME = 'trial'
;v2 = BYTSCL(v1)
;s1 = v2(*,*,120)
s1=READ_DICOM(FILEPATH('mr_knee.dcm',SUBDIR=['examples','dat a']))

sbar = OBJ_NEW('IDLgrImage', s1)
oROI = OBJ_NEW('IDLgrROI', COLOR = [255,255,255], STYLE = 2)
oView = OBJ_NEW('IDLgrView', VIEWPLANE_RECT = [0,0,512,512], COLOR =
[0,0,0], PROJECTION = 2)
oModel = OBJ_NEW('IDLgrModel')
oModel -> Add, sbar
oModel -> Add, oROI
oView -> Add, oModel
oWindow -> Draw, oView

state = {oView: oView, $
oModel: oModel, $
oWindow: oWindow, $
sbar: sbar, $
oROI: oROI}

WIDGET_CONTROL, wBase, SET_UVALUE = state
print,'Success'
XMANAGER, 'contour1', wBase
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Calling IDL from Perl
Next Topic: Re: CASE statement

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

Current Time: Thu Oct 09 22:59:14 PDT 2025

Total time taken to generate the page: 1.27537 seconds