Posted by
Robert Baer on
Jul 11, 2013; 7:27pm
URL: http://imagej.273.s1.nabble.com/Loci-plugin-and-macro-file-conversion-Questions-tp5003928.html
I wrote a short macro to convert a set of images from Zeiss .zvi to
.tiff format (code below). The macro works, but I have two minor issues
I can not overcome. If prior to running my macro, I load an image with
Loci Bioformats plutgin and uncheck show metadata and then load a second
image with the windowless format turned on, I can process my whole
directory of images without manual intervention. However, I can not
figure out how to set these defaults within the context of the macro.
Can anyone point me to the proper way to set defaults for the Loci plugins?
The second issue is that if I choose to let the metadata show in windows
as the conversion goes on, I can't figure out how to close the files.
Is there way to close these files other than one by one? close and
closeAll seem to only work with image windows.
Thanks for any pointers,
Rob
// The macro code
//
macro "Batch Convert .zvi to .tif"{
requires("1.33s");
dir1 = getDirectory("Choose Source Directory ");
dir2 = getDirectory("Choose Destination Directory ");
print(dir1 + " -> " + dir2);
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i < list.length; i++) {
showProgress(i + 1, list.length);
print(dir1 + list[i]);
if (endsWith(toLowerCase(list[i]), ".zvi")){
open(dir1 + list[i]);
dotIndex = lastIndexOf(list[i], ".");
if (dotIndex!=-1){
list[i] = substring(list[i], 0, dotIndex); // remove .zvi
saveAs ("Tiff", dir2 + list[i]+'.tif');
}
}
close();
}
}
--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 USA
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html