How to change color of specific channel in a composite TIFF image

I have a TIFF image with four channels downloadable here.

With the following IJMacro command:

Stack.setDisplayMode("composite");
Stack.setActiveChannels("1001");
run("Scale Bar...", "width=500 height=12 font=70 color=White background=Black location=[Lower Right] bold serif overlay label");

I get this image:

There Channel 1 is red and Channel 4 are marked by white specks.
What I want to do is to change the color from red to white in Channel 1 and
from white to green in Channel 4. How can I do it?

1 Like

You would use:

Stack.setChannel(1);
run("Grays");
Stack.setChannel(4);
run("Green");

If you will use this type of thing frequently, you could create a function:

function recolorChannel(channel, lut) {
	Stack.setChannel(channel);
	run(lut); // Entry in Image>Lookup Tables
}

Then, your code gets simplified:

recolorChannel(1, "Grays");
recolorChannel(4, "Green");
4 Likes

@tferr Thanks so much for your answer. Is there a way to choose other color other than LUT?

With this code:

Stack.setDisplayMode("composite");
Stack.setActiveChannels("1001");
run("Scale Bar...", "width=500 height=12 font=70 color=White background=Black location=[Lower Right] bold serif overlay label");
recolorChannel(1, "Grays");
recolorChannel(4, "Green");
run("Brightness/Contrast...");
setMinAndMax(2710, 16169);
run("Smooth");
run("Close");

I get this image:

The green is not illuminating enough. How can I modify the colors?

The color that you use has to be stored in a LUT (listed under Image > Lookup Tables), but you can import LUTs from elsewhere or edit your own. Search the Fiji menu for “LUT” (press L, then type LUT in the search box) to find more tools.

To make the green channel brighter, try a lower number for the Max value when you adjust contrast.

Since setMinAndMax works on the selected channel, you could add a setChannel command first just to be sure:

Stack.setChannel(4);
run("Brightness/Contrast...");
setMinAndMax(2710, 12000); // replace Min and Max with your preferred values
1 Like