Automatic Cell Count using Z-stack .oib image file

Hey guys,
I am pretty new to cellprofiler. I have been trying to create a pipeline for automatic cell counts. We use a confocal microscope to take z-stack (3d) images that are saved in an .oib file. Currently we are using three channels (DAPI, Alexa488, Alexa594) so I am trying to separate the individual channels from that one big .oib file and then use “MakeProjection” to create a flattened image of the z-stack per channel.
Then I used the “EnhanceOrSurpress” on the DAPI images so far and they came out pretty good.
The problem I am encountering is when I try to use “IdentifyPrimaryObject” for some reason I cannot get the advanced settings tweaked to pick up anything from my image. Whenever I change it to not use advanced settings it picks up some particles but I would like to use the advanced settings to pick up all of my cells.
Thank you very much for all your help!
Here is my .oib picture that I am trying to work on:

CellCount_Test_pipeline.cpproj (1.0 MB)

Hi @Sunnyschlecht,

From a quick look, it appears that your lower bounds for your thresholds may be set too high and so it’s excluding all staining.

It’s also worth mentioning that with CellProfiler it’s generally best to make the projections in a separate pipeline, since the image won’t be ready for analysis until all images have been processed. Per the help dialog for the MakeProjection module:

Keep in mind that the projection image is not immediately available in subsequent modules because the output of this module is not complete until all image processing cycles have completed. Therefore, the projection should be created with a separate pipeline from your analysis pipeline.

Generally, we’d approach this by running the MakeProjection module and then SaveImages to write that projection into a file. Those projected images can then be used in an analysis pipeline.

As you have a lot of slices with minimal data, you may also want to use maximum intensity for your projections rather than average. This may allow you to detect cells without needing an Enhance step.

Hope that helps

1 Like

Hello @DStirling

Thank you very much for your help. That really makes a lot of sense. What would you recommend then? Should I process the individual channels with “MakeProjections”, save them and put them into a new pipeline to analyze the z-stack?
What would you recommend for the lower bounds to be? Should i measure the length of my average cell diameter?
Thank you for all your help. I will try to make a separate analysis pipeline now!

Yup, the easiest solution would be to adapt your current pipeline (which has names and groups set up) to make projections for each channel and then save each projection for use in a new pipeline.

What would you recommend for the lower bounds to be? Should i measure the length of my average cell diameter?

Threshold bounds should be determined by looking at the intensity of the image itself. Without the projection on hand it’s hard to guess, but if you open such an image in a window in CellProfiler you can hover over a pixel to get it’s intensity value. Threshold boundaries are most useful in situations where some of your images may be blank, as this will then prevent automatic thresholding from trying to find something to detect and pulling out nothing but noise. Generally I’d place the minimum just above the normal range of background intensity that you don’t want to detect.

Measuring cell length is useful for setting the object size filters, and there’s a measurement tool for doing so in the tools menu of image preview windows.

Thank you very much for your fast reply again. I managed to create separate pipelines. One that just does MakeProjections and saves the images as a tiff.
I changed the analysis pipeline to fit the three channels for the image and it seems to be working better at least for DAPI.
I am still having a little bit of trouble trying to make cellprofiler distinguish between clumps of cells that are very close to each other. I can see in the outline of the IdentifyPrimaryObjects, that it separates the cells very good, however in the actual counting window (where it shows colored circular dots for each cell) it doesn’t distinguish it very well. Any idea how I can fix that?
Also, when I am adding my second channel (Alexa488, since 594 has no cells in this picture) cellprofiler has a hard time distinguishing what cells are since some of the cells look more like speckles and are not brightly labeled. I can see the outlines of my cells in purple, which means that cellprofiler is excluding them, but i cannot get to tweak my settings right for it to pick up all the cells. I got it to the point where my cells show the purple outline but everything else that I am trying just makes the borders of my cells worse.
Thank you so much for your help!
Greatly appreciated!

CellCount_Test_pipeline_NEW.cpproj (808.7 KB)

It’s not entirely clear to me what the problem in the screenshot is. There appears to be a lot of noise on the image and only a few cells. I’m not sure how large a cell is here, but you may want to tweak the declumping settings further, particularly disabling the “remove holes” option before attempting to declump.

Regarding the outlines, those cells highlighted in blue/purple are being discarded for being outside the size filter you’ve set in ‘expected diameter’. You can disable that exclusion in the module settings or refine the limits/threshold to get them to be a more appropriate size.

When working with multiple stains it’s generally best to identify the objects with one wavelength, then use that segmentation to measure staining in other wavelengths. Do you absolutely need to detect them in both wavelengths separately?