Problem with batch processing
Posted by sam on Apr 05, 2014; 8:17am
URL: http://imagej.273.s1.nabble.com/Problem-with-batch-processing-tp5007213.html
Hi there,
I am trying to write a macro to do some basic batch processing on all open images. For some reason it only does 2 or 3 of the open images, then stops, so I have to keep running the macro until the job is done.
Can anyone see what I am doing wrong? Thanks for your help!
The macro is below:
dir = getDirectory("Choose a Directory");
for (i=1; i<=nImages; i++) {
selectImage(i);
processImage();
}
function processImage() {
title=getTitle;
run("Make Composite", "display=Color");
Stack.setChannel(1);
resetMinAndMax();
run("Red");
Stack.setChannel(2);
resetMinAndMax();
run("Grays");
Stack.setChannel(3);
resetMinAndMax();
run("Green");
saveAs("tiff", dir+title);
close;
}