0

I would like to enlarge several rois with the following loop:

counts=roiManager("count");
 for(i=0; i<counts; i++) {
    roiManager("Select", i);
    run("Enlarge...", "enlarge=10");
 }

However, I can’t figure out, what’s wrong with this macro.

JerryTheForester
  • 456
  • 1
  • 9
  • 26
  • Interestingly, if I skipp "enlarge=10"; I am asked for each ROI by how much I would like to enlarge it; and it works fine... – JerryTheForester Mar 14 '14 at 20:32
  • Interestingly, when I run the macro it ignores the "enlarge=10". It allways uses a default of "enlarge=15", but I can change the value manually in the menu Edit>Selection>Enlarge... – new2R Mar 08 '18 at 13:38

1 Answers1

0

Your code enlarges every ROI by 10 pixels, but does not store the new ROI in the ROI manager. You are missing the roiManager("Update"); command, which you get when running the macro recorder while clicking the Update button in the ROI Manager window.

counts=roiManager("count");
for(i=0; i<counts; i++) {
    roiManager("Select", i);
    run("Enlarge...", "enlarge=10");
    roiManager("Update");
}
Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51