[ImageJ-devel] Getting green channel image when splitting channels

Rasband, Wayne (NIH/NIMH) [E] rasbandw at mail.nih.gov
Mon Jan 13 09:29:03 CST 2014


On Jan 12, 2014, at 2:54 PM, Safaa Al-Haj Saleh wrote:

> Hi all, 
> 
> I need to get the second channel (green) image after running "Split Channels" command in imageJ menu:
> 
>   IJ.run(imp,"Split Channels","");
> 
> when using "IJ.getImage()" I got the last image which is the third channel (blue).
> 
> any help please?

Type "l" (Plugins>Utilities>Find Commands) to open the Command Finder. Type "split channels" in the search box and you will see that the "Split Channels" command is implemented by the ChannelSplitter class. Look at the source or API for this class and you will see that it has a split() method that you can use to get the second channel of an image.

   greenChannel = ChannelSplitter.split(imp)[1];

In the future, it would be better to direct ImageJ programming questions to the ImageJ mailing list (http://imagej.nih.gov/ij/list.html). The ImageJ-devel list is for technical and developer discussion of the ImageJ2 project. 

-wayne




More information about the ImageJ-devel mailing list