How to use the Channelsplitter and keep the color mode of the channels?

I am using the ChannelSplitter and plotting the results. I have a problem when the image is of 1 channel that the result of the splitting is gray.

System.out.println("Is Composite? " + imp.isComposite() + "\n" + 
"No. of Channels " + imp.getNChannels())  + "\n" +
"Channel Mode " + imp.getDisplayMode());
}
ImagePlus[] imageSplittedRGB  = ChannelSplitter.split(imp);
for (int i = 0; i < imageSplittedRGB.length; i++) {
	imageSplittedRGB[i].show();
}

In the below three cases I am using different channel count images while one of them is detecting information in the green channel yet it is showing it as grey and not as green. Is there a way that I can make the imp would be different and splitted as I want?

Is Composite? false
No. of Channels 1
Channel Mode 0

Is Composite? true
No. of Channels 2
Channel Mode 1
image

Is Composite? true
No. of Channels 3
Channel Mode 1

From what I read online I tried several solutions but nothing worked,

  1. Changing the LUT
  2. using splitRGB() in ChannelSplitter class instead of split()
  3. I tried converting the image to composite view imp.setDisplayMode(IJ.COMPOSITE);

As a temporary solution I avoided using splitter to RGB single channel image but it would be great if someone can advice me if it is possible.

What do you want to archive with the single channel? If it is a grayscale you can simply apply a LUT to pseudocolour it, see:

2 Likes