Login  Register

Re: Batch Z Projection

Posted by ved sharma on Dec 30, 2010; 7:54pm
URL: http://imagej.273.s1.nabble.com/Batch-Z-Projection-tp3686091p3686092.html

Hi Adina,

I wrote a macro sometime back to do something similar. I made a few changes in it, so now it does "max projection" and saves the files in a new folder, inside your TIFF stack folder. Macro is attached.

If you get error message(s), then make sure that you have the latest ImageJ version installed. If that does not help, then let me know.

Ved

path = getDirectory("Choose a Directory");
filename = getFileList(path);
newDir = path + "Max Projections" + File.separator;
if (File.exists(newDir))
   exit("Destination directory already exists; remove it and then run this macro again");
File.makeDirectory(newDir);
for (i=0; i<filename.length; i++) {
        if(endsWith(filename[i], ".tif")) {
                open(path+filename[i]);
                run("Z Project...", "projection=[Max Intensity]");
                saveAs("tiff", newDir + getTitle);
                close(); close();
        }
}