Bug in Make Composite or Stack.setActiveChannels

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

Bug in Make Composite or Stack.setActiveChannels

Anderson, Charles (DNR)
While studying the "Replacing Red with Magenta in RGB Images" macro examples in the ImageJ Tutorial, I think I found a bug, possibly related to tracking the active image.  When I run this macro starting with the run("Clown (14K)") line, it works.  When I run starting with the first line, it generates an error message saying "Stack required in line 4" and the Debug shows ' getTitle()      "leaf.jpg" '

The same error appears if the second line is replaced with run("Duplicate...", "a");

If you insert a third line selectWindow("leaf.jpg");  the error message vanishes, but the magenta action is done on leaf rather than clown (or a).

run("Leaf (36K)");
run("Clown (14K)");
run("Make Composite");
Stack.setActiveChannels("100");
run("Magenta");
Stack.setActiveChannels("111");
run("RGB Color");

// Stack required in line 4
// Debug shows: getTitle()     "leaf.jpg"

Charles Anderson
Minnesota DNR
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Make Composite or Stack.setActiveChannels

Rasband, Wayne (NIH/NIMH) [E]
On Sep 1, 2011, at 12:36 PM, Anderson, Charles (DNR) wrote:

> While studying the "Replacing Red with Magenta in RGB Images" macro examples in the ImageJ Tutorial, I think I found a bug, possibly related to tracking the active image.  When I run this macro starting with the run("Clown (14K)") line, it works.  When I run starting with the first line, it generates an error message saying "Stack required in line 4" and the Debug shows ' getTitle()      "leaf.jpg" '
>
> The same error appears if the second line is replaced with run("Duplicate...", "a");
>
> If you insert a third line selectWindow("leaf.jpg");  the error message vanishes, but the magenta action is done on leaf rather than clown (or a).
>
> run("Leaf (36K)");
> run("Clown (14K)");
> run("Make Composite");
> Stack.setActiveChannels("100");
> run("Magenta");
> Stack.setActiveChannels("111");
> run("RGB Color");

This bug is fixed in the ImageJ 1.45o daily build, or avoid it by using batch mode:

  setBatchMode(true);
  run("Clown (14K)");
  run("Make Composite");
  run("Magenta");
  run("RGB Color");
  setBatchMode(false);

This has the advantages of making the macro run faster and preventing unwanted images from being displayed. I removed the two Stack.setActiveChannel() calls because they are not needed.

-wayne