Skip to content
Snippets Groups Projects
Commit 8f92b13f authored by Marius Hintsche's avatar Marius Hintsche
Browse files

add resolution calibration function and export

parent 3eb77b64
No related branches found
No related tags found
No related merge requests found
//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);
//Batch macro to export avi files from supplied tiff stacks.
// Also prints scale bar and time stamp onto the video.
// Arguments string should be a list of absolute file paths to process.
//This macro can be called in Fiji's headless mode e.g.
......@@ -7,6 +8,10 @@
outExtension = ".avi";
frameRate = 20;
barWidth = 2; //µm
barHeight = 4; //px
tUnit = "";
tInterval = 1;
fileList = split(getArgument());
......@@ -31,7 +36,16 @@ for (i = 0; i < fileList.length; i++) {
//processing steps
//frameRate = Stack.getFrameRate();
Stack.getUnits(xUnit, yUnit, zUnit, tUnit, vUnit);
tInterval = Stack.getFrameInterval();
print("frame= "+tInterval+" "+tUnit);
getVoxelSize(x, y, z, u); print("vx size= "+x+"x"+y+"x"+z+" "+u);
run("8-bit");
run("Scale Bar...", "width="+barWidth+" height="+barHeight+" font=12 color=White background=None location=[Lower Right] bold label");
if (tInterval > 0) {
run("Time Stamper", "starting=0 interval="+tInterval+" x=2 y=15 font=12 decimal=0 anti-aliased or="+tUnit);
print("muh");
}
run("AVI... ", "compression=JPEG frame="+frameRate+" save="+outFile);
close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment