Counting neurons

I’m trying to find a good solution for counting neurons like in this picture below. I’m pretty new to image analysis and tried searching for a solution for 3 days now but nothing is working. Can someone help me get on the right track? that would be very apricated. I’ve tried cellprofiler and imagej. But I don’t get the right results. The picture bellow should have 326 cells.

Hi Pixel,

Solution for Fiji:

I would go for a small gaussian filter.
Process > Filters > Gaussian Blur…

Maybe some background subtraction with a rolling ball radius fitting the size of your objects.
Process > Subtract Background

Then maximum detection should do the trick.
Process > Find Maxima…

If this is not sufficient I would then go for Difference of Gaussian or Laplacian of Gaussian Filtering instead of just a Gaussian Blur. If that is still not sufficient try a wavelet based spot detector: icy has a really really nice implementation.

In my analysis I always aim for robust reproducible results. Not Perfection. So if the outcome is close to the manually counted, great. The measurement error you should account for with replicates. Stuff that makes your image analysis better: specific regions of interest with excluding stuff of your images that is uninteresting.

You can also test with small crops of the image so manual counting is faster, try to crop different parts of your brain slice.

Wish you happy blob detection!



  1. do not use jpegs for quantitative image analysis… saving as a jpeg corrupts your data. read more on that here.

  2. what have you tried thus far in ImageJ? You can check out this older forum post that has helpful links for segmenting in ImageJ.

  3. which channel is the signal for your neurons? If channels 2 or 3… i’m afraid you may not have a sufficient sampling of your neurons… there is a lot of single-pixel ‘noise’… and any objects that might resemble neurons are only a few pixels in area. I think a higher resolution acquisition might be necessary to properly sample your cells.


Thanks for the quick response. So far I have searched a lot of posts but I’m really an amateur in the field and can’t really understand a lot of the terms being used.

my background is more in the computer science department and was searching for an AI with deep learning that you just fed some batch of images and it could count the whole batch.

I will take a look at your helpful forum post to see if I can get myself more familiar with the tools and settings.


Thanks for the response. the result had a 0,6% difference after i tweaked with some settings. But do you have any suggestions on the parameters within these processes? I’m a real beginner and not really familiar with the program or terms.

Thanks in advance.

For the processing you can start out understanding using the ImageJ Guide:

In general the settings of the processing will depend on the size of the objects. So if your objects are in the range of 5 px then setting the Gaussian Blur and the Rolling Ball Background subtraction in this range is acceptable. Try a bit and see what it does to your images. Aim is to smooth out your objects and suppress any single pixel noise that can be misdetected. But without removing true objects.

The maxima detection will depend on the signal to background. There was a recent forum post explaining the algorithm a bit more in practical terms: New maxima finder menu in FIJI

But I would also consider the advice of @etadobson. With object detection you can get away with lower resolution but make sure that you do not have clumps of cells that you cannot resolve or noise leading to false positive detections.


Hi Pixel

I have a very simple pipeline that will identify your cells. I do agree that your image is both in the wrong format, and the resolution is very poor. Your cells are only 5-20 pixels in diameter making gaussian smoothing difficult. Take a look at the tutorials page of CellProfiler to get your head around these concepts.


Cellprofiler v3.5.1 CellCount.cpproj (651.4 KB)