Splitting channels in multichannel .flex images


Hi there,

I am just getting started on Cellprofiler, and I have thousands of images in .flex format. Each file is actually 4 separate grayscale images (488, 560, 640 and Hoescht) of the same location but when I load the file using LoadImages, only the first channel is recognised (the 488). Please could you let me know how to split each image file into the four separate images so that analysis can continue?



Need help with input module setting

Can you upload a couple of sample images and the pipeline that you’re using?

Are you setting the image type correctly under “Names and Types” and then incorporating a “Color to Gray” module to split the channels later? I’ve never worked with .flex images before but that would be the place to start.

If it still doesn’t work, I’d make sure to update to the newest version of CellProfiler; if at that point it still fails, probably the easiest thing to do would be to write a macro in ImageJ to split the images into their individual channels.


Dear Beth,

Thank you very much. I attach a sample image. What would be the correct image type under the “Names and Types”? I have tried Colour to Gray to split the channels but only the first image (the 488) is recognised, and also there are only 3 options (RGB). The image is not actually in colour as you will see, there are four separate grayscale images.

Thanks again.


Dr. Rhia Ghosh
Clinical Fellow to Prof Sarah Tabrizi
Dept of Neurodegenerative Disease
UCL Institute of Neurology
and National Hospital for Neurology and Neurosurgery
Queen Square
London WC1N 3BG


Hi Rhia,
Your image didn’t come through, but under Names and Types you’d set the type to “Color Image”, then in Color To Grey under Image type set it to “Channels”. Hope that works!


Hi Beth,

I’m afraid that did not work - my images are actually grayscale in the first instance, just with each picture corresponding to a different channel.

I have tried to attach the file again, this time as a .tiff file.

Thanks so much for your help!



I understand they’re actually multiple greyscale images, that’s just how you get CP to handle multichannel TIFs correctly.

Your TIF didn’t work for me at first but when I opened it in FIJI (a type of ImageJ) I saw that the .tif you sent had the 4 images marked as 4 z planes, not 4 channels- I ran Hyperstack->StackToHyperstack, changed channels to 4 and z planes to 1, saved the new image (attached here). Then it worked perfectly.

Use the image I’ve attached to make sure you’ve got your pipeline configured correctly, then try your .flex image in that same pipeline and see if it passes or fails. If it turns out your images won’t work as configured, I can send you the code for an ImageJ/FIJI macro that will just go through and split all your images into their 4 channels.
flexsplit_channels.zip (4.7 MB)

Colour to Grey Split 4th channel not recognized

Dear Beth,

Thank you so much, I am getting there! The file you sent me does seem to work now – I can now see the 4 channels when I extract metadata from image file headers, and have used Names&Types to assign names to the 4 images based on the metadata “C matching”. This then seems to allow me to just select the relevant channel image to process objects. Should the colour to grey tool be able to split the channels without needing to extract any metadata first? I don’t seem to be able to get that part to work – are you able to send me the pipeline that you used?

Also I would be most grateful if you could send me the code for the ImageJ macro so that all my channels could be split into 4.

Thanks again.



I think you need to extract the metadata first to see it in NamesAndTypes, but I’m pretty sure you don’t need to extract it if you just use ColorToGrey (just set a single image name in NamesAndTypes and then follow the directions I gave up-thread). Either should work equally well. I didn’t actually make a pipeline, sorry.

The macro is attached, unzip it and put the file in your ImageJ/FIJI “plugins” directory (lots of instructions for this online if you need help finding it), and the next time you open the program it should be there and ready to go. Good luck!

_BatchSplitChannelsEvenIfStackFlex.zip (684 Bytes)

Extraction of metadata fails for a tiff stack
Can you use CellProfiler to analyze whole tissue samples + 6-color images?