On Oct 23, 2013, at 5:25 AM, Ed Simmons wrote:
> Hi IJ List,
>
> I'm sure I've asked this question before but my search of the archive
> has turned up no results.
>
> I have a composite image containing two channels - this comes from
> Micro-manager (it's the live window) and I'm trying to get the two
> channels as separate imp/imageprocessor, one per channel.
>
> I have tried setting the channel of the source imp, then
> getChannelProcessor, this seems to give me two copies of the second channel.
>
> I duplicate the source imp, then wish to get access to each of the
> channels as a separate image to carry out further processing.
>
> Please could someone point me in the right direction...?
Get the stack associated with the composite image and retrieve the first two images from the stack. Here is a JavaScript example that downloads the Hela Cells sample image, duplicates it, then retrieves the first two channels and displays them as separate images.
imp = IJ.openImage("
http://imagej.nih.gov/ij/images/hela-cells.zip");
imp2 = imp.duplicate();
stack = imp.getStack();
channel1 = stack.getProcessor(1);
channel2 = stack.getProcessor(2);
new ImagePlus("channel1", channel1).show();
new ImagePlus("channel2", channel2).show();
You will need to convert hyperstack positions to a stack positions if the composite image has multiples slices and/or frames. This example retrieves and displays the first two channels of slice 6 of the Organ of Corti sample image. It uses the ImagePlus.getStackIndex(c,z,t) method to convert hyperstack positions to stack positions.
imp = IJ.openImage("
http://imagej.nih.gov/ij/images/organ-of-corti.zip");
imp2 = imp.duplicate();
stack = imp.getStack();
channel1 = stack.getProcessor(imp2.getStackIndex(1, 6, 1));
channel2 = stack.getProcessor(imp2.getStackIndex(2, 6, 1));
new ImagePlus("C1Z6", channel1).show();
new ImagePlus("C2Z6", channel2).show();
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html