Login  Register

Re: How to change ROI during a Macro?

Posted by Ninja Chris on Feb 22, 2010; 3:00pm
URL: http://imagej.273.s1.nabble.com/How-to-change-ROI-during-a-Macro-tp3689228p3689231.html

Hi Gargar, I'm working on some iterative code to process multiple ROIs within a single stack. The code

n = roiManager("count");
for (i=0; i<n; i++) {
     roiManager("select", i);

will allow any subsequenty function to work on each ROI in succession. Eg:

sdir = getDirectory("choose source directory ");
n = roiManager("count");
for (i=0; i<n; i++) {
     roiManager("select", i);
     bee = "bee_"+i+"_";
     ddir = sdir+bee;
     File.makeDirectory(ddir);
     run("Duplicate...", "title = ["+bee+"] duplicate range=1-3000");
     run("Image Sequence... ", "format=TIFF name=["+bee+"] start=0 digits=4 save=["+ddir+"]");
close();
  }

Hope this helps,
Chris