Re: Merge Channels Macro
Posted by
Michael Schmid on
Jun 09, 2011; 8:47am
URL: http://imagej.273.s1.nabble.com/Merge-Channels-Macro-tp3684311p3684312.html
Hi Lucas,
you simply need to find out how the output images of "Split Channels"
are named:
red = filename[i]+" (red)";
blue = filename[i]+" (blue)";
Also note that checkboxes are not activated/deactivated with true/
false, but with giving the first word of the checkbox name to
activate it or omitting to deactivate.
So you have, e.g.,
.... gray=*None* keep ignore
for "Keep source images" and "Ignore source LUTs" on, but "Create
Composite" off.
If you want to create two output images, you will probably want to
have "Keep source images" on when creating the first one and off when
creating the second one.
Michael
________________________________________________________________
On 9 Jun 2011, at 09:57, Lucasphi wrote:
> 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();