I'm trying to crop sections in an image and then averaging all of them. I'm recycling my previous macros on imageJ. Previous macros work well by doing loops in a list of ROIs. But, for this one, I can't understand why the loop does not move to the next ROI in the list. Instead, I got the job N-times as the number of ROIs I have in the list but the macro uses the first ROI information. This is my macro:
runMacro("OpenROI");
rename("AA");
selectWindow("AA");
n=roiManager("count");
for(i=0;i<n;i++){
roiManager("select",i);
run("Copy");
run("Internal Clipboard");
rename(i);
}
selectWindow("AA");
run("Close");
run("Images to Stack", "name=Stack title=[] use");
run("Z Project...", "projection=[Average Intensity]");
Someone can catch what am I losing it? Thanks