Re: Specific color channel to retrieve from an image in a plugin
Posted by
Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/Specific-color-channel-to-retrieve-from-an-image-in-a-plugin-tp5004950p5004951.html
On Sep 26, 2013, at 1:02 PM, Philippe GENDRE wrote:
> Dear List,
>
> I need to retrieve the red channel of an RGB image plus object as an image
> processor in a plugin.
>
> What is the best solution ?
Use the ImageProcessor.getChannel() method. Here is a JavaScript example:
imp = IJ.openImage("
http://imagej.nih.gov/ij/images/clown.jpg");
ip = imp.getProcessor();
red = ip.getChannel(1, null);
new ImagePlus("Red Channel", red).show();
In a plugin, it would look like this:
ImagePlus imp = IJ.openImage("
http://imagej.nih.gov/ij/images/clown.jpg");
ImageProcessor ip = imp.getProcessor();
ImageProcessor red = ((ColorProcessor)ip).getChannel(1, null);
new ImagePlus("Red Channel", red).show();
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html