An automatic counting algorithm for the quantification and uncertainty analysis of the number of microglial cells trainable in small and heterogeneous datasets

This paper proposes a flexible, non-parametric automatic kernel counter that enables accurate microglial cell counting and uncertainty estimation in small, heterogeneous datasets by bypassing traditional cell detection in favor of a tailored feature extraction and single hyper-parameter training approach.

L. Martino, M. M. Garcia, P. S. Paradas, E. Curbelo

Published 2026-02-27
📖 5 min read🧠 Deep dive

Imagine you are a detective trying to count how many specific suspects (microglial cells) are hiding in a massive, chaotic city map (a high-resolution microscope image of a rat's spinal cord).

The city is huge, but the suspects are tiny, dark brown specks. The rest of the map is filled with noise: random clouds, streetlights, and artifacts that look like suspects but aren't.

The Problem:
Traditionally, counting these suspects has two big issues:

  1. Manual Counting: A human detective has to squint at the map for hours, counting every single speck. It's boring, slow, and different detectives often get different counts because they get tired or have different opinions.
  2. Old Computer Methods: Early computers tried to "find" the suspects first (like a metal detector) and then count them. But because the city is so noisy and the suspects look so different (some are spiky, some are round), the metal detector gets confused. Also, teaching a computer to "find" them requires labeling every single pixel, which is a massive amount of work.

The New Solution: The "Kernel Counter" (KC)
The authors of this paper, led by Luca Martino, came up with a clever shortcut. Instead of asking the computer to find and outline every suspect, they asked it to just count the total number based on a "vibe check" of the whole image.

Here is how their method works, broken down into simple steps:

Step 1: The "Sieve" (Filtering)

Imagine you have a giant bucket of mixed sand and gold dust. You want to count the gold.
Instead of picking out every grain of gold, you pour the bucket through a series of different sieves (filters).

  • Sieve A catches only the very darkest, heaviest dust.
  • Sieve B catches slightly lighter dust.
  • Sieve C catches even lighter dust.

In the paper, they take the microscope image and run it through many different "color sieves." Since microglial cells are dark brown, they will stick to the "dark" sieves. The background noise (which is lighter) falls through.

  • The Result: For each image, they don't get a perfect picture of the cells. Instead, they get a list of numbers: "Sieve A caught 50 blobs, Sieve B caught 120 blobs, Sieve C caught 200 blobs."
  • Why this helps: It turns a messy, high-resolution picture into a simple list of numbers that is much easier for a computer to understand. It's like turning a complex painting into a simple recipe.

Step 2: The "Smart Guessing Game" (The Kernel Counter)

Now, the computer has a list of numbers (from the sieves) and a human expert's count (the "ground truth").

  • The Training: The computer looks at a new image. It runs it through the sieves and gets a new list of numbers. It then looks at its "memory bank" of past images to find the ones that had the most similar sieve-results.
  • The Magic: It doesn't just pick the closest match. It looks at the top 10 or 20 most similar past images and takes a weighted average of their counts.
    • If the new image looks very similar to a past image where the expert counted 10 cells, the computer leans heavily toward 10.
    • If it looks somewhat like an image with 10 cells and somewhat like one with 12, it guesses 11.

Why is this special?

  1. It's Flexible: It doesn't need a huge database. Because it's "non-parametric," it gets smarter the more data you give it, but it works perfectly fine even with a tiny dataset (like 12 images).
  2. It Knows When It's Unsure: This is the coolest part. The computer can tell you, "I'm pretty sure it's 15 cells," or "I'm not sure, it could be anywhere between 10 and 20." This "uncertainty score" tells the human expert when they need to double-check the image.
  3. It Handles Disagreement: If three different experts look at the same image and give three different counts, the computer can learn from all of them and find the "average truth," smoothing out the human errors.

The Analogy: The "Weather Forecaster"

Think of the microglial cells as raindrops.

  • Old Method: Try to count every single raindrop falling in a storm. Impossible and messy.
  • The New Method: You have a bunch of sensors (the sieves) that measure humidity, wind speed, and cloud darkness. You ask an expert, "How much rain fell?"
    • The computer learns: "When the humidity is 90% and the wind is 5mph, the expert usually says 10mm of rain."
    • Now, a new storm comes. The sensors say "90% humidity, 5mph wind." The computer doesn't count drops; it just says, "Based on past patterns, I predict 10mm."
    • If the sensors are weird (e.g., 90% humidity but 50mph wind), the computer says, "I'm not sure, the prediction could be anywhere from 5 to 15mm."

Why Does This Matter?

  • Speed: It's much faster than a human counting every cell.
  • Cost: You don't need to hire armies of people to label every single pixel. You just need an expert to give a rough count of the whole image.
  • Reliability: It admits when it's confused, preventing false confidence.
  • Versatility: It works even if the images are taken in different labs with different microscopes (different lighting, different sizes).

In short, this algorithm is a smart, adaptable assistant that learns to count by looking at the "big picture" patterns rather than getting lost in the details, making it perfect for small, messy, real-world scientific data.

Get papers like this in your inbox

Personalized daily or weekly digests matching your interests. Gists or technical summaries, in your language.

Try Digest →