Newer
Older
//Batch macro to set spatial and temporal resolution of supplied tiff stacks
//Arguments are:
// frame-interval frame-unit xy-pixelsize xy-unit file1 file2 ...
// (apparently file path must be absolute)
//This macro can be called in Fiji's headless mode e.g.
// fiji --headless -macro /path-to-macro.ijm /path-to-file.tif
// or by runMacro(macro, arg)
arguments = split(getArgument());
tInterval = parseFloat(arguments[0]);
tUnit = arguments[1];
xySize = parseFloat(arguments[2]);
xyUnit = arguments[3];
fileList = Array.slice(arguments,4);
if (isNaN(tInterval)) { exit("Frame interval is not a valid number."); }
setBatchMode(true);
for (i = 0; i < fileList.length; i++) {
open(fileList[i]);
//processing steps
Stack.setFrameInterval(tInterval);
Stack.setTUnit(tUnit);
setVoxelSize(xySize, xySize, xySize, xyUnit);
save(fileList[i]);
close();
}
setBatchMode(false);