Re: Batch Processing, channel split window name.
Posted by mese433 on
URL: http://imagej.273.s1.nabble.com/Batch-Processing-channel-split-window-name-tp5016467p5016542.html
Hi there!
Really helpful post! I am new at macro coding as well. I wanted to do a macro to use one channel to select all my nuclei and then use this mask to count positive cells of the different channel and If I can I would like to do it in batch.
I used part of this code and it works nicely, it can do everything but it fails when I need to redirect my 'mask' channel to different channels to check if I have signal in my selections.
Not sure If I make a lot of sense so apologies for that!
Macro:
T = getTitle();
selectWindow(T);
run("Split Channels");
selectWindow(T + " (blue)");
Blue = getTitle();
selectWindow(T + " (green)");
Green = getTitle();
selectWindow(T + " (red)");
Red = getTitle();
selectWindow(Blue);
setAutoThreshold("Huang dark");
setAutoThreshold("Default");
//run("Threshold...");
setAutoThreshold("Default dark");
setAutoThreshold("Huang dark");
//setThreshold(23, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Erode");
run("Watershed");
run("Set Measurements...", "area mean modal min center redirect=None decimal=3");
run("Analyze Particles...", "clear add");
run("Clear Results");
selectWindow(Blue);
run("Set Measurements...", "area mean modal min center redirect=[Red] decimal=3");
run("Clear Results");
run("Analyze Particles...", "display clear add");
Thanks a lot!! :D