Login  Register

Re: Merge Channels Macro

Posted by Krs5 on Jun 09, 2011; 9:06am
URL: http://imagej.273.s1.nabble.com/Merge-Channels-Macro-tp3684311p3684314.html

Hi Lucas,



You could try after opening your image:



title = getTitle;

run("Split Channels");

selectWindow(title+" (red)");

titleRed = getTitle;

selectWindow(title+" (green)");

titleGreen = getTitle;

run("Merge Channels...", "red=titleRed green=titleGreen blue=*None* gray=*None* keep");

Good luck



Kees



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Lucasphi
Sent: 09 June 2011 08:57
To: [hidden email]
Subject: Merge Channels Macro



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();



--

View this message in context: http://imagej.588099.n2.nabble.com/Merge-Channels-Macro-tp6456923p6456923.html

Sent from the ImageJ mailing list archive at Nabble.com.