Login  Register

Merge Channels Macro

Posted by heshamza on Oct 08, 2010; 8:23pm
URL: http://imagej.273.s1.nabble.com/Merge-Channels-Macro-tp3686666.html

Hi Hi

I'm trying to create a merge channel macro where it automatically assigns a certain image for each merge color. Specifically, any image that ends with T1 I would like to have assigned to green, T2 for red, T3 for blue, and nothing for gray.

The problem is that whenever I run the macro (below), it says that I need a '(' in line 2... help??


run("Merge Channels...", "
red=[*None*]
green=[*None*]
blue=[*None*]
gray=[*None*]

for (i=1; i<=nImages; i++) {
        selectImage(i);
        title = getTitle;

        if (endsWith(title, "T1")) green=[title];
        else {
                if (endsWith(title, "T2")) red=[title];
                else {
                        if (endsWith(title, "T3")) gray=[title];
                        else {
                                if (endsWith(title, "T4")) gray=[title];
                                }
                        }
                }
}

create");