Skip to content

Quick and Easy Automatic Cell Counting

Posted in: Microscopy and Imaging
Quick and Easy Automatic Cell Counting

Are you wondering how on earth you’re going to count thousands of cells across a stack of images? Well, I’m going to show you a simple method for automatic cell counting with ImageJ. For those of you unfamiliar with ImageJ, it’s a popular image processing program that runs on Mac, Windows, and Linux.

Assuming you have ImageJ downloaded, let’s begin with a single image of fluorescent cells waiting to be counted.

1.  Setup for Automatic Cell Counting

First, load your image by dragging it into the ImageJ toolbox. If you aren’t using colored images, that’s not a problem. As long as you can identify the cells against the background you’re in good shape. As you’ll see, we need to convert to grayscale in the first step either way. To do this, select: Image > Type > 16-bit Grayscale

cell counting fig 1

2.  Adjust the Threshold

To distinguish cells from background, use the threshold feature. You use this feature to suppress certain pixels in the background by removing intensities below/above a certain threshold.

To adjust threshold, select: Image > Adjust > Threshold. The first slider determines the lower bound while the second slider determines the upper bound. The goal is to suppress lower intensity pixels that do not makeup cells; therefore set the second slider at 255 and focus on adjusting the lower bound. Each image is different; therefore, you’ll need to play around with the slider to remove as much background as possible without removing cells. In this example, I removed pixels with an intensity value below 97. This gave me a binary image in which cell pixels are black while everything else is white.

cell counting fig 2

3.  Identify Cells

Now that we’ve identified which pixels makeup cells, we’re going to cluster pixels based on circularity using the analyze particles feature.

To analyze particles, select: Analyze > Analyze Particles. The first parameter to consider is size. Basically you’re telling the program to ignore any clusters it identifies that are too small to be a cell. It’s important to put a lower bound in place to ignore circular substructures within cells. One way to find a good number is to draw a circle representative of the smallest cell in your image. You can then press the key m and a measurement box will popup, providing the area (pixels^2). Set this value as your lower bound. Usually you can leave the upper bound as infinity unless multiple cells are packed together. However, if this is the case, set the maximum cell size using the same method just described. The second parameter is circularity which asks how circular your cells are. I’d recommend retaining the default setting.

cell counting fig 3

Automatic Cell Counting

After clicking OK in the analyze particles box, the ROI manager and a summary will automatically appear. The ROI manager contains all the cells (or regions of interest) that were selected. If necessary, select cells and make manual adjustments if non-cell clusters were selected. The summary box provides you with the total number of cells along with other useful measurements. To alter the summary measurements, before you analyze the particles in the previous step, select: Analyze > Set Measurements.

cell counting fig 4

And we’re done. Happy counting!

If you’re looking for more ways to automate data processing in the lab, don’t be afraid to search online. ImageJ is a powerful tool and there are hundreds of tutorials even for more advanced work flows. Also, check out my article on measuring intracellular fluorescence with ImageJ.

Share this to your network:

1 Comments

  1. Jamal on January 23, 2018 at 11:34 pm

    I’m using imagej to count cells in specific regions on on brain slices. The problem is: I’m using a shape in ROI to count cells from different slices in the same relative surface area (hopefully) the problem is the area of my shape is different from the area in the count summary when I use ‘analyze particles’.

    The analyze tool is indeed only counting the cells in the shape, so why is the area (in the results summary) different in different slices??

Leave a Comment

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll To Top