Login  Register

User interaction in Macros

Posted by JiHO-2 on Apr 01, 2009; 10:12pm
URL: http://imagej.273.s1.nabble.com/User-interaction-in-Macros-tp3693110.html

Hello everyone,

I would like to do the following:
- open an image
- make a selection automatically
- manually alter the automatic selection
- measure some variables on this ROI
- save the measurements and quit
all that with as little user interaction as possible.

So I wrote macro (because macros are easy!) that gets executed using  
the -eval command line switch of ImageJ. What I am currently stuck on  
is how to "pause" the execution of the macro while the user is  
tweaking the ROI and resume it once (s)he is finished. I tried popping  
up a dialog to notify the user but the dialog windows are modal so the  
user cannot get to the image when the dialog is up.

Could you please suggest me an alternative route? Is that something  
that would be better tackled with a plugin?

Thank you very much in advance.


Code of the (very simple) macro:

------------
run("Image Sequence...", "open=00001.JPG number=1 starting=1  
increment=1 scale=100 file=[] or=[] sort");

makeOval(402, 99, 1137, 1137);

Dialog.create("Selection");
Dialog.addMessage("If necessary, alter the selection to fit the  
aquarium better.\nPress OK when you are done");
Dialog.show()

run("Set Measurements...", "  centroid perimeter redirect=None  
decimal=3");

run("Measure");

saveAs("Measurements", "Results.txt");

run("Quit");
------------

Jean-Olivier Irisson
---
Division of Applied Marine Physics
Rosenstiel School of Marine and Atmospheric Sciences
4600 Rickenbacker Causeway, Miami, Florida 33149-1098
+1 786 342 3410
http://jo.irisson.free.fr/work/