Merging channels macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Merging channels macro

Charly
Hi everybody, I am trying a macro to merge channels, but I keep getting a "not valid choice" or "undefined variable" errors. All I want is for ImageJ to merge two images into 1, with the correct color.
This is what I have that does not work:

for (i=1; i<=nImages; i++) {
  selectImage(i);
  title = getTitle();
 run("Merge Channels...", "red=[*MAX_C2*.*] gray=[ *MAX_C3*.*] green=*None*  blue=*None*

create");
}

I have also tried this other option, but does not work either:

for (i=1; i<=nImages; i++) {
  selectImage(i);
  title = getTitle();
  if (startsWith(title, "MAX_C3"))
      Channel_3.tif=title;
else if (startsWith(title, "MAX_C2"))
       Channel_2.tif=title;
run("Merge Channels...", "red=[Channel_2.tif] gray=[ Channel_3.tif] green=*None*  blue=*None*

create");
}

Any help is appreciated!
Thanks!