Created by
Dave Mason
last modified
| input = getDirectory("Input directory");
output = getDirectory("Output directory");
processFolder(input);
function processFolder(input) {
//-- get a list of files and folders in the input
list = getFileList(input);
//-- DEBUG only, print the list to see what we have
//Array.print(list);
//-- Iterate the list
for (i=0; i<list.length; i++) {
//-- If the item is a directory, list the contents of the directory and pull the first alphanumerically sorted filename
if(File.isDirectory(input + list[i])==1);{
fileList=getFileList(input + list[i]);
//-- Sort to get alphabetical
fileList=Array.sort(fileList);
fileListFirst=fileList[0];
}
//-- DEBUG only, make sure the path looks good
//print(input + list[i] +fileListFirst);
//-- Open the image sequence by specifying the first image filename in the sequence
run("Image Sequence...", "open=["+input+list[i]+fileListFirst+"] file=.tif sort");
//-- Do what you do
run("Canvas Size...", "width=5000 height=5000 position=Center");
//-- Save the file as a tif stack
save(output+replace(list[i],"/","_")+replace(fileListFirst,".tif","_series.tif"));
//-- Close the files
close("*");
} //-- folder loop
} //-- close function
|