Newer
Older
//Batch macro to export avi files from supplied tiff stacks.
// Arguments string should be a list of absolute file paths to process.
//This macro can be called in Fiji's headless mode e.g.
// imagej --headless -macro /path-to-macro.ijm /path-to-file.tif
// or by runMacro(macro, arg)
outExtension = ".avi";
fileList = split(getArgument());
for (i = 0; i < fileList.length; i++) {
//parse file name
dotIndex = lastIndexOf(fileList[i], ".");
if (dotIndex >= 0) {
baseName = substring(fileList[i], 0, dotIndex);
}
outFile = baseName+outExtension;
// escape spaces in path with \ and "" // does not work!
//outFile = "\"" + outFile + "\"";
//outFile = replace(outFile, " ", "\\\\\\\\ ");
if ( indexOf(outFile," ") >= 0 ) {
exit("Input path must no contain whitespace!");
}
//print("will export to "+outFile);
open(fileList[i]);
//processing steps
//frameRate = Stack.getFrameRate();
run("8-bit");
run("AVI... ", "compression=JPEG frame="+frameRate+" save="+outFile);
close();
}