Commit 1c192fd6 authored by Stephan Janosch's avatar Stephan Janosch

macro for generating max projections

parent b306deb4
/*
* Macro template to process multiple images in a folder
*/
#@ File (label = "Input directory", style = "directory") input
#@ String (label = "File suffix", value = ".tif") suffix
// See also Process_Folder.py for a version of this code
// in the Python scripting language.
print("\\Clear");
processFolder(input);
print("Macro Done");
return;
// function to scan folders/subfolders/files to find files with correct suffix
function processFolder(input) {
list = getFileList(input);
list = Array.sort(list);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + File.separator + list[i]))
processFolder(input + File.separator + list[i]);
if(endsWith(list[i], suffix))
processFile(input, list[i]);
}
}
function processFile(input, file) {
targetFileName = ""+input + File.separator + file+".jpg";
if ( File.exists(targetFileName))
return;
print("Processing: " + input + File.separator + file);
open(input + File.separator + file);
run("Z Project...", "projection=[Max Intensity]");
saveAs("Jpeg",targetFileName );
close();
close();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment