How to merge gray slices into a RGB stack

I do have many slices comprising the tree channels of a z-stack I want to create. I now know how to use “-append z” to create a stack so I could potentially (not tested yet) create 3 stacks, one for each channel, and then use “-append c” to create the RGB stack I want from these intermediate grayscale stacks.

I was wondering if there is a way to bypass the creation of these intermediate stacks and use a single call of gmic to create the final RGB stack using as input the slices. Possible?

  • Alex
1 Like

With G’MIC, this is quite simple to achieve. Assuming all your stack images are ordered, you can first create a big volume (by appending all these stacks along z), then split it into three volumetric images (one for each channel), then append them again along the channel axis c.
If your image are ordered first along the z axis (slices), then along the c axis (channels), then do :

$ gmic image*.png -a z -s z,3 -a c

On the contrary if your image are ordered first along the c-axis, then the z-axis, you can do :

$ gmic image*.png -a c -s c,-3 -a z

It should be as simple as this.

It couldn’t be any simpler! Thanks.