
Wait for user ROI generation? (doprompt)

Ralf Schmauder
Hi,
I am attempting a rather basic GUI to let a user select to use cutoff values in an image or draw a ROI. However I can not figure out how to get the system to wait for the user to draw a ROI.
As a test I just have a small routine attempting to let the user draw a ROI with different Versions of ShowTools (see below). It just does not work. Also, using different PauseForUSer attempts failed
Is there way to make it work with doprompt, or do I have to use another Interactionstyle e.g. with NewPannel; Button etc?
Thanks!
Ralf
display /k=1/n=img/w=(80,365,350,635); appendimage i1 variable gui=3 prompt gui, "gui", popup, " keep; none; poly ; rectangle" do if (gui>2) doprompt "gui", gui endif doupdate if (gui>1) SetDrawLayer /k progFront endif setdrawenv fillpat=0 if (gui==2) ShowTools/A poly PauseForUser/C img, gui elseif (gui==3) ShowTools/A poly PauseForUser /C img, gui endif ImageGenerateROIMask i1 duplicate /o M_ROIMask, Roi display /k=1/w=(80,0,350,260); appendimage M_ROIMask while(gui>2)
I struggled with something similar, here is what worked for me:
March 20, 2023 at 09:09 am - Permalink
In my case with Image Tools, I have a button to Start the draw action. Clicking the button changes the button's name and userdata for the button. It also puts userdata on the graph window.
The image window has a hook function with this code.
The End button code is as below.
The approach could likely be improved when GetWindow would have a flag to return the drawing mode state for a graph or image window, such as ...
March 21, 2023 at 08:10 am - Permalink