Login  Register

Merge Channels Macro

Posted by Lucasphi on Jun 09, 2011; 7:57am
URL: http://imagej.273.s1.nabble.com/Merge-Channels-Macro-tp3684311.html

Hi,

I'm trying to write a macro where an RGB image is split into three channels and then RB are merged together and GB are merged together.  I'm a little confused on how the arguments for run("Merge Channels...", "") works.  I'm not sure what to put for red= and blue= and how to get the action to also "keep original sources" but not "create composite".  Could anyone help me out?

So far, my code looks something like this




for (i=0; i<filename.length; i++) {
        if(endsWith(filename[i], ".tif")) {
                open(path+filename[i]);

                run("Split Channels");

                run("Merge Channel…", "red=["+red+"] green=*none* blue["+blue+"] gray=*none false true);
                rename(filename[i]+"_488");
                run("8bit");
                saveAs("tiff", newDir+getTitle);
                close();