Trying to familiarize myself with the macros and use the macro template to process multiple images (“Process folder”) to run “split channels” on a folder of multiple files.
After running the “split channels” I want to select and close the red and blue channels and keep the green channel open, but I am not sure how to specify this (see in lines 30 and 32 below)
/*
* Macro template to process multiple images in a folder
*/
#@ File (label = "Input directory", style = "directory") input
#@ File (label = "Output directory", style = "directory") output
#@ String (label = "File suffix", value = ".tif") suffix
// See also Process_Folder.py for a version of this code
// in the Python scripting language.
processFolder(input);
// 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, output, list[i]);
}
}
function processFile(input, output, file) {
// Do the processing here by adding your own code.
open(input + File.separator + file);
run("Split Channels");
selectWindow(input + File.separator + file + (blue)); //I am not sure how to specify the blue channel
close();
selectWindow(input + File.separator + file + (red)); //I am not sure how to specify the red channel
close();
// Leave the print statements until things work, then remove them.
print("Processing: " + input + File.separator + file);
print("Saving to: " + output);
}