Re: Macros for Colour Deconvolution plugin - saving multiple files

Posted by drew_c on
URL: http://imagej.273.s1.nabble.com/Macros-for-Colour-Deconvolution-plugin-saving-multiple-files-tp5005383p5005387.html

Heya All,

Its pretty much solved - this macro works - change the paths obviously. Its the first part of my work process.

dir1 = getDirectory("Choose Source Directory ");
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++) {
showProgress(i+1, list.length);
open(dir1+list[i]);
run("Subtract Background...", "rolling=50 light");
imgName=getTitle();
run("Colour Deconvolution", "vectors=[H DAB]");
selectWindow(imgName + "-(Colour_3)");
close();
selectWindow(imgName +"-(Colour_1)");
title = getTitle();
print("title: " + title);
saveAs("Tiff", "C:\\Dropbox\\University\\PhD\\Mouse Project\\Fresh tissues\\Colour 1\\"+title);
close();
selectWindow(imgName + "-(Colour_2)");
title = getTitle();
print("title: " + title);
saveAs("Tiff", "C:\\Dropbox\\University\\PhD\\Mouse Project\\Fresh tissues\\Colour 2\\"+title);
close();
title = getTitle();
saveAs("Tiff", "C:\\Dropbox\\University\\PhD\\Mouse Project\\Fresh tissues\\Colour 1\\"+title);
close();
}


The rest can be added to it or done in a new macro