Creating color overlay with more than 3 channels for RGB display

Hi all,
We’re in the process of creating some scripts where users can specify up to 6 different imaging channels that get plotted together as a color overlay. Each imaging channel is stored as a greyscale, single channel image, which we then combine together according to the user’s color preference for each channel.

Our current implementation takes the values of R, G, B and assigns them to index 0, 1, and 2, respectively, of the 3D array we’re using to store the data. For example, if the DAPI greyscale image gets assigned to blue, the values of that greyscale image will be assigned to index 2 of the 3D array.

For the other three channels, we compute the weighting of R, G, and B for the color, and proportionally add the signal corresponding to that channel to the appropriate index. I’m wondering if there is a better way to generate the RGB image? I’m more used to working with multiple channels in photoshop, where everything remains separate. For actually rendering the image so that it can be plotted via matplotlib, I’m not sure if this (seemingly hacky) solution is the only way to do this, or if there are other options.

Thanks in advance,
Noah

It looks like FIJI has this functionality: https://imagej.net/Color_Image_Processing#Merging_images_to_a_color_composite

I’m wondering what the code to do this actually looks like?

It looks like you can see what the code for that command in ImageJ does here.

Have you browsed the color module in scikit-image? Do any of the methods there look like they’d work? convert_colorspace looks like it could be promising.