Login  Register

Re: Problem with split channels

Posted by Rasband, Wayne (NIH/NIMH) [E] on Sep 22, 2014; 3:18pm
URL: http://imagej.273.s1.nabble.com/Problem-with-split-channels-tp5009703p5009709.html

On Sep 21, 2014, at 9:41 AM, Matt Pearson wrote:

> Hi all,
>
> I also have a problem with split channels.  I'm using it within a macro and i have two images, one is a single 16bit image the other is a 3 colour composite.  I'm using the print function to troubleshoot.  Basically i want the merged image to be split into its RGB components.  Firstly i use selectImage to activate the composite image to be split.  The print command confirms that the composite image is being activated prior to split.  The image is split and produces the 3 component images.  I then have a getTitle function to see which image is active post split channels and its the 16bit image that i mentioned earlier, not the last component image of the composite.  
>
> Perhaps this is normally behaviour that the last newly created window when using split channels does not automatically become activated?  I've just never had an issue with this before and i've used split channels in a macro many times.

Are you using batch mode? These types of problems are less likely in batch mode because images are not displayed and activated on a separate thread. For example, the following macro always outputs "C3-Composite" when run in batch mode but it sometimes displays "Overlays" when not run it batch mode. The macro also runs *much* faster in batch mode.

  setBatchMode(true);
  newImage("Overlays", "16-bit black", 400, 400, 1);
  newImage("Composite", "RGB random", 400, 400, 1);
  run("Make Composite");
  run("Split Channels");
  print(getTitle);

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html