saving stacks to newly created folders
Posted by Ninja Chris on
URL: http://imagej.273.s1.nabble.com/saving-stacks-to-newly-created-folders-tp3689270.html
Hi, I'm trying to throw together some javascript to duplicate ROIs in a stack in ImageJ and save each produced stack to its own folder created in the parent. My code is:
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();
}
My problem is that the ROIs are duplicated, the folders created but the stack isn't saved to the new subfolders. A previous version created the folders but then requested confirmation of the folder to save the images too. This had the advantage of actually saving the files but lacked the automation I seek. I am working with 3K image stacks and processing them is something I want to initiate and let run in the background.
Can anyone point me to the flaw in my code as I am at something of a loss? Any help most gratefully recieved!
Chris