Hi,
I'm trying to write a macro where .nd2 images/file within a folder are
opened, split into 2 channels, and merged into a single image and saved as a
new merged file.
When I use Bio-Format Importer to split the channels, it generates 2
images/channels named:
"file_name" - C=0
"file_name" - C=1
Here's my macro code so far:
path = getDirectory('Choose Directory');
filelist = getFileList(path);
output = path+"MergedJPG"+File.separator;
File.makeDirectory(output);
setBatchMode(true);
for (i=0; i< filelist.length; i++) {
if (endsWith(filelist[i], ".nd2")) {
name = path + filelist[i];
run("Bio-Formats Importer", "open= ["+name+"] color_mode=Default
view=Hyperstack stack_order=XYCZT color_mode=Default split_channels");
red = filelist[i]+" - C=1";
green = filelist[i]+" - C=0";
run("Merge Channels...", "c1=["+red+"] c2=["+green+"] create");
saveAs("jpeg", output + filelist[i]);
run("Close");
setBatchMode(false);
}
}
It's almost there. When I run it, I choose the directory (in this case the
folder "nd2" containing my .nd2 image files), it creates the MergedJPG
folder fine, but then this window pops up and I still have to click on each
.nd2 file with in my chosen folder, and in the right order, for each image
to get processed and saved as the merged .jpg files.
<
http://imagej.1557.x6.nabble.com/file/t382408/Capturefuji.jpg>
I assume I'm just missing some simple thing in order for it to actually
automate and batch process all the .nd2 files in my chosen folder without me
having to select/click on each one.
Thanks for the help,
YL
--
Sent from:
http://imagej.1557.x6.nabble.com/--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html