ROI selection in ImageJ macro

2.7k views Asked by At

I am trying to record a macro on Fiji (ImageJ). I cannot find how to introduce the use of the mouse for a ROI rectangular selection. The macro keeps the registered position, in the example (2290, 1224 , 160, 314). I want them to be different for each image. If possible to draw the ROI rectangle with the mouse for each new image. Thanks !

setOption("BlackBackground", false);
run("Make Binary");
run("ROI Manager...");
makeRectangle(2290, 1224, 160, 314);
run("Strahler Analysis", "max.=6 output=[Color Map (CM)] protect method=[shortest branch]");
selectWindow("StrahlerMask_7502.jpg");
saveAs("Jpeg", "/home/StrahlerMask_7502.jpg");
1

There are 1 answers

0
Jan Eglinger On

Use the waitForUser(string) macro function.

E.g.:

setOption("BlackBackground", false);
run("Make Binary");
waitForUser("Please create a selection to indicate\nthe root for Strahler Analysis, then\nclick OK to proceed.");
run("Strahler Analysis", "max.=6 output=[Color Map (CM)] protect method=[shortest branch]");
selectWindow("StrahlerMask_7502.jpg");
saveAs("Jpeg", "/home/StrahlerMask_7502.jpg");