Help! Why do my output images seem all black?

Double clicking on the output images produced by CellProfiler sometimes opens up a screen in your operating system’s default image viewer that looks all black. This can make it seem like your pipeline didn’t work or didn’t produce the right output. However, this can happen for a couple of reasons:

(a) If you’re exporting objects and have only a few objects in your image
(b) If you’re exporting 16-bit images

This has to do with the fact that most non-scientific photo software is designed to show 256 levels of grey – comparable to what a commercial or phone camera captures, and roughly a couple times more than what human eyes can distinguish. (a) If there are only a few levels of grey (as when only a few objects are displayed in the image using a grayscale colormap)*, they aren’t bright enough to see and your eyes see a black image. (b) If there are many tens of thousands of grey levels (as when exporting 16-bit images) when they’re opened in the system viewer the levels get “scrunched down” to fit into 256, so even though your cells are plenty bright on the microscope screen or inside CellProfiler the compression may put your actual cell signals in the bottom few grey levels, and then they once again aren’t bright enough to see.

The easiest solution to both of these problems is to open your images using scientific software such as ImageJ/FIJI or CellProfiler, which will rescale them so that they’re in a viewable grayscale range no matter how many grey levels you start with. If you’re creating output images just for your own review later and won’t be doing further quantitative analysis on them, you can also take advantage of CellProfiler’s Rescale module or save your images as 8-bit in the future so that they’re easy to see in Preview or any other non-scientific piece of software you have handy**.

For more information, please see the always-excellent MicroscopyU website.

* = When CellProfiler exports objects in this way, it colors the background pixels with a grayscale value of 0 then colors all the pixels in object 1 with a grayscale value of 1, all the pixels in object 2 with a grayscale value of 2, etc. If there are zero objects, you truly will have an all-black output image.
** = While this is great for display, those extra levels could have useful information in them, so always make sure to use the un-rescaled version when analyzing using CellProfiler.

Start the discussion at forum.cellprofiler.org