http://imagej.273.s1.nabble.com/Batch-Stack-Focusing-tp5018376p5018407.html
I had a super quick look at your macro. Could it be that the closing
Also, all you files will be named "stack".
Hope that helps.
> Hi all,
>
> This is my first time attempting to write a macro in image J. I would really
> appreciate your help with this…
>
> I have a main directory with multiple subdirectories. Each subdirectory
> contains multiple images (z stacks). I would like to write a code which will
> take my main directory and open a subdirectory , open all the images in that
> subdirectory, stack the images, run the stack focusing plugin and then save
> the stack in the corresponding folder. I would like to loop this so that all
> the subdirectories within my main directory are processed.
>
> This is what I have so far. This code runs for a few minutes but I then
> can’t find my saved stacks.
>
> dir = getDirectory("Choose image sequence folder");
> setBatchMode(true);
> count = 0;
> countFiles(dir);
> n = 0;
> processFiles(dir);
> print(count+" files processed");
>
> function countFiles(dir) {
> list = getFileList(dir);
> for (i=0; i<list.length; i++) {
> if (endsWith(list[i], "/"))
> countFiles(""+dir+list[i]);
> else
> count++;
> }
> }
>
> function processFiles(dir) {
> list = getFileList(dir);
> for (i=0; i<list.length; i++) {
> if (endsWith(list[i], "/"))
> processFiles(""+dir+list[i]);
> else {
> showProgress(n++, count);
> path = dir+list[i];
> processFile(path);
> }
> }
> }
>
> function processFile(path) {
> for (i=0; i<list.length; i++)
> open(path);}
> {
> run("Images to Stack", "name=Stack title=[] use");
> run("Stack Focuser ", "enter=11");
> saveAs("Tiff", "stack" );
> close();
> }
>
> Many thanks for your help!
>
> Amy
>
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Batch-Stack-Focusing-tp5018376.html> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html*Daan M. VAN DEN BRINK*