Merge 3 single color images to composite and keep colors

Hello,

I have been creating scatter plots with one color each.(read, green, blue), which automatically are saved a RGB each.(all in python)

I would like to know how I can make a composite image being, the red scatters the red channel, green scatters, the green channel…

I created a stack containing all 3 images, but when merging, I get a pinkish scatter plot of the original green image.

What am I missing?

Thanks you!!

35

Have you tried Image > Color > Merge Channels…

https://imagej.nih.gov/ij/docs/guide/146-28.html#toc-Subsection-28.5

Ved

@vedsharma

I believe that requires gray-scale images as input. Though I suppose one could use split channels on the original RGB images and then merge channels; one from each set. Depending on the specifics on the input and desired colors.

@kratschie

Are these colors pure red, blue, and green (0xFF0000, 0x0000FF, and 0x00FF00)? If not, does the exact shade of these colors matter to you?

I am assuming that the white is pure white. In that case, you could use a macro like the following:

waitForUser("Activate red image. Then click \"OK\".");
red = getImageID();
changeValues(0xFFFFFF, 0xFFFFFF, 0);
waitForUser("Activate green image. Then click \"OK\".");
green = getImageID();
changeValues(0xFFFFFF, 0xFFFFFF, 0);
waitForUser("Activate blue image. Then click \"OK\".");
blue = getImageID();
changeValues(0xFFFFFF, 0xFFFFFF, 0);
imageCalculator("add create", red, green);
rg = getImageID();
imageCalculator("add create", rg, blue);
changeValues(0, 0, 0xFFFFFF);

Yes.The 4th image show the result to this approach. It looks the same for all 3 images(here the blue one is shown)

I tried your approach and unfortunately, get the same results as before. I cannot look into channels separately then.

Please think about how white is represented in RGB.
If your images had a black background, your processing would be straighforward.

2 Likes

That was such a helpful hint!
Here is how it works for me now:

##after all images were set up with black backround
##split channels for every image and only keep the corresponding one
run("Split Channels");
selectWindow("green.tif (blue)");
close();
selectWindow("green.tif (red)");
close();
saveAs("Tiff", "/green(green).tif");

##merge these three images resulting in one 3 channel image
run("Merge Channels...", "c1=red(red).tif c2=green(green).tif c3=blue(blue).tif create keep");