Hi guys, this is my first time trying to use a macro. Maybe this is a stupid question, but I was struggling on this for 3 days.
I have a file with dozens files in it. The files are 12 bit tiff format. I can not open any of the files with Fiji directly, but I can open each of them from Bio-format. The macro-record shows:
run("Bio-Formats", "open=[C:/Users/shiji/OneDrive/Desktop/Tiff bio-format/2-A.tif] autoscale color_mode=Default display_metadata rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT");
I want open all the files and save them as JPEG.
If the files are not 12 bit, but 16 bit. Then they can be opened directly by Fiji. And the following Macro works.
function action(input, output, filename) {
open(input + filename);
saveAs("Jpeg", output + filename);
close();
}
input = "C:/Users/shiji/OneDrive/Desktop/tiff/";
output = "C:/Users/shiji/OneDrive/Desktop/JFP/";
setBatchMode(true);
list = getFileList(input);
for (i = 0; i < list.length; i++)
action(input, output, list[i]);
setBatchMode(false);
When I tried to operate the file with 12 bit files with the following macro. it did not work.
function action(input, output, filename) {
run("Bio-Formats", "open=[input + filename] autoscale color_mode=Default display_metadata rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT");
saveAs("Jpeg", output + filename);
close();
}
input = "C:/Users/shiji/OneDrive/Desktop/tiff/";
output = "C:/Users/shiji/OneDrive/Desktop/JFP/";
setBatchMode(true);
list = getFileList(input);
for (i = 0; i < list.length; i++)
action(input, output, list[i]);
setBatchMode(false);
What’s wrong with it?