Bio-Format 1sc to jpg batch conversion
Posted: Sat Oct 06, 2012 1:45 pm
Hi all!
Can someone help me?
I hope I am not off-topic here but I have seen similar threads....
I have more than 4 GB of 1sc pictures (Bio-Rad), which I can open with ImageJ/Bio-Formats.
I found a super-nice macro by Melissa to converts all files in a directory to TIFF.
The problem I have is that saved tiff pictures are almost completely black
when saved with Bio-Formats Macro Extensions but OK if manually saved with ImageJ menu.
My question is:
How can this macro be changed in such a way that:
- Files are saved in jpg and not in tiff format
- The macro uses the normal ImageJ save function and not Bio-Formats exporter?
I thank you so much for your help,
Stocca
-----
Name of the Macro: batchTiffConvert.txt (http://loci.wisc.edu/bio-formats/imagej)
-----
// batchTiffConvert.txt
// Author: Melissa Linkert <melissa at glencoesoftware.com>
// Last updated: 28 March 2011
// Converts all files in a directory to TIFF using the Bio-Formats macro
// extensions. There will either be one TIFF file per plane or one TIFF file
// per input file, depending upon the value of 'oneFilePerSlice' (see below).
// By default, one TIFF file is created for each plane in each file.
oneFilePerSlice = true;
directory = getDirectory("Choose input files");
fileList = getFileList(directory);
outputDirectory = getDirectory("Choose output directory");
run("Bio-Formats Macro Extensions");
setBatchMode(true);
for (i=0; i<fileList.length; i++) {
file = directory + fileList[i];
if (oneFilePerSlice) {
Ext.setId(file);
Ext.getImageCount(imageCount);
for (image=0; image<imageCount; image++) {
Ext.openImage("", image);
outFile = outputDirectory + fileList[i] + "-" + image + ".tiff";
saveFile(outFile);
close();
}
Ext.close();
}
else {
Ext.openImagePlus(file);
outFile = outputDirectory + fileList[i] + ".tiff";
saveFile(outFile);
close();
}
}
showStatus("Finished.");
setBatchMode(false);
function saveFile(outFile) {
run("Bio-Formats Exporter", "save=[" + outFile + "] compression=Uncompressed");
}
-----
Can someone help me?
I hope I am not off-topic here but I have seen similar threads....
I have more than 4 GB of 1sc pictures (Bio-Rad), which I can open with ImageJ/Bio-Formats.
I found a super-nice macro by Melissa to converts all files in a directory to TIFF.
The problem I have is that saved tiff pictures are almost completely black
when saved with Bio-Formats Macro Extensions but OK if manually saved with ImageJ menu.
My question is:
How can this macro be changed in such a way that:
- Files are saved in jpg and not in tiff format
- The macro uses the normal ImageJ save function and not Bio-Formats exporter?
I thank you so much for your help,
Stocca
-----
Name of the Macro: batchTiffConvert.txt (http://loci.wisc.edu/bio-formats/imagej)
-----
// batchTiffConvert.txt
// Author: Melissa Linkert <melissa at glencoesoftware.com>
// Last updated: 28 March 2011
// Converts all files in a directory to TIFF using the Bio-Formats macro
// extensions. There will either be one TIFF file per plane or one TIFF file
// per input file, depending upon the value of 'oneFilePerSlice' (see below).
// By default, one TIFF file is created for each plane in each file.
oneFilePerSlice = true;
directory = getDirectory("Choose input files");
fileList = getFileList(directory);
outputDirectory = getDirectory("Choose output directory");
run("Bio-Formats Macro Extensions");
setBatchMode(true);
for (i=0; i<fileList.length; i++) {
file = directory + fileList[i];
if (oneFilePerSlice) {
Ext.setId(file);
Ext.getImageCount(imageCount);
for (image=0; image<imageCount; image++) {
Ext.openImage("", image);
outFile = outputDirectory + fileList[i] + "-" + image + ".tiff";
saveFile(outFile);
close();
}
Ext.close();
}
else {
Ext.openImagePlus(file);
outFile = outputDirectory + fileList[i] + ".tiff";
saveFile(outFile);
close();
}
}
showStatus("Finished.");
setBatchMode(false);
function saveFile(outFile) {
run("Bio-Formats Exporter", "save=[" + outFile + "] compression=Uncompressed");
}
-----