IDCC-SAM: A Zero-Shot Approach for Cell Counting in Immunocytochemistry Dataset Using the Segment Anything Model

Samuel Fanijo, Ali Jannesari, Julie DickersonBioengineering 2025 · DOI

TL;DR

This paper introduces IDCC-SAM, a novel zero-shot approach for automated cell counting in immunocytochemistry images. By leveraging Meta AI's Segment Anything Model (SAM), IDCC-SAM eliminates the need for manual annotations, significantly improving scalability and efficiency in biomedical research. It achieves competitive results, outperforming several state-of-the-art methods on public datasets.

What Problem Does This Paper Address?

Accurate cell counting is crucial for diagnosing and treating various diseases, from neurological disorders to cancer. Traditional manual counting methods are laborious, time-consuming, and prone to human error, making standardization difficult. While deep learning offers automated solutions, these typically require extensive, manually labeled datasets. Acquiring and annotating these datasets is costly and time-consuming, hindering the widespread adoption of these powerful tools, especially in resource-limited research settings. This paper addresses the need for an automated cell counting method that is both accurate and scalable, without the burden of manual data annotation.

Methods

The core of IDCC-SAM is the Segment Anything Model (SAM), a powerful foundation model for image segmentation. The authors adapt SAM for cell counting through a three-stage pipeline:

  1. Preprocessing: Images are enhanced using Contrast-Limited Adaptive Histogram Equalization (CLAHE) to improve illumination and contrast, making cellular structures more visible. This involves dividing images into tiles, computing local histograms, clipping them to prevent noise amplification, and normalizing intensity values.
  2. Mask Extraction: The preprocessed image is fed into SAM's image encoder and mask decoder. SAM, pre-trained on a massive dataset, generates segmentation masks that delineate individual cells from the background. Crucially, IDCC-SAM uses SAM in a "zero-shot" manner, meaning it doesn't require any task-specific training or fine-tuning on the cell counting data. The prompt encoder of SAM is frozen and not used, allowing for autonomous mask generation.
  3. Post-processing and Cell Counting: The extracted masks are refined to remove the background. The center point of each segmented cell mask is then calculated. These center points are plotted on the original image for visualization, and the total count of these points provides the final cell count.

Datasets

The IDCC-SAM model was evaluated on three public benchmark datasets:

  • IDCIA (Immunocytochemistry Dataset for Cellular Image Analysis): A dataset of annotated neural cells from rat Adult Hippocampal Progenitor Cells (AHPCs) after electrical stimulation. It's noted for its diversity, using seven primary antibodies.
  • VGG (Synthetic Fluorescence Microscopy Dataset): A dataset of simulated bacterial cells from fluorescence microscopy, designed to mimic real-life imaging conditions.
  • ADC (Human Subcutaneous Adipose Tissue Dataset): A dataset of adipocyte cellular images derived from high-resolution histology slides.

Key Insights and Ideas

  • Zero-Shot Power: The most significant insight is SAM's remarkable ability to perform cell segmentation and counting in a zero-shot manner. This bypasses the need for costly and time-consuming manual annotation, a major bottleneck in biomedical image analysis.
  • Preprocessing is Key: The CLAHE preprocessing step is vital for improving image quality and illumination, which directly impacts SAM's ability to extract accurate masks, especially in images with uneven lighting.
  • Post-processing for Precision: The custom post-processing step, which identifies cell centers and refines masks, is crucial for translating segmentation masks into accurate cell counts.
  • Robustness to Noise: IDCC-SAM shows robustness in handling noisy images and potentially inconsistent ground truth annotations, sometimes providing counts that align better with the original image than the human-annotated labels.

Key Results

IDCC-SAM demonstrated strong performance across the evaluated datasets:

  • Overall: Achieved the lowest average Mean Absolute Error (MAE) on the VGG (26) and ADC (28) datasets.
  • Low-Density Scenarios: Excelled in low-density images, achieving a perfect Acceptable Absolute Error (AAE) of 100% on the ADC dataset.
  • High-Density Challenges: While performing well on average, performance dipped on the IDCIA dataset, particularly for high-density images (MAE of 90), where it was outperformed by some supervised methods.
  • Comparison: Outperformed supervised methods like U-Net and Mask R-CNN in several scenarios, and was competitive with or superior to other zero-shot methods like SAM4Organoid and NP-SAM. For instance, on the VGG dataset, IDCC-SAM predicted 97 cells against a ground truth of 97, while U-Net predicted 75.

Limitations and Future Work

The authors acknowledge two main limitations:

  • High-Density Performance: IDCC-SAM struggles with accurately delineating overlapping cells in densely packed images, particularly in datasets like IDCIA.
  • Staining Variability: Sensitivity to diverse staining techniques and cell morphologies can impact segmentation accuracy, suggesting a need for greater adaptability.

Future work proposed to address these limitations includes:

  • CLIP Integration: Incorporating CLIP for enhanced multimodal understanding and improved segmentation in diverse conditions.
  • Few-Shot Fine-Tuning: Fine-tuning IDCC-SAM on small labeled subsets to boost performance on high-density images and complex staining.
  • Domain-Adaptive Fine-Tuning: Developing domain-adaptive encoders/decoders for better robustness.
  • Dynamic Patch Sizes: Exploring dynamic patch sizes in the ViT encoder to better capture fine-grained details in crowded images.
  • Downstream Tasks: Extending IDCC-SAM to related tasks like cell classification, clustering, and morphological analysis.

Summary updated

Abstract

Cell counting in immunocytochemistry is vital for biomedical research, supporting the diagnosis and treatment of diseases such as neurological disorders, autoimmune conditions, and cancer. However, traditional counting methods are manual, time-consuming, and error-prone, while deep learning solutions require costly labeled datasets, limiting scalability. We introduce the Immunocytochemistry Dataset Cell Counting with Segment Anything Model (IDCC-SAM), a novel application of the Segment Anything Model (SAM), designed to adapt the model for zero-shot-based cell counting in fluorescent microscopic immunocytochemistry datasets. IDCC-SAM leverages Meta AI's SAM, pre-trained on 11 million images, to eliminate the need for annotations, enhancing scalability and efficiency. Evaluated on three public datasets (IDCIA, ADC, and VGG), IDCC-SAM achieved the lowest Mean Absolute Error (26, 28, 52) on VGG and ADC and the highest Acceptable Absolute Error (28%, 26%, 33%) across all datasets, outperforming state-of-the-art supervised models like U-Net and Mask R-CNN, as well as zero-shot benchmarks like NP-SAM and SAM4Organoid. These results demonstrate IDCC-SAM's potential to improve cell-counting accuracy while reducing reliance on specialized models and manual annotations.
BibTeX
@inproceedings{fanijo2025idcc,
  author = {Samuel Fanijo and Ali Jannesari and Julie Dickerson},
  title = {{IDCC-SAM: A Zero-Shot Approach for Cell Counting in Immunocytochemistry Dataset Using the Segment Anything Model}},
  booktitle = {Bioengineering},
  year = {2025},
  doi = {10.3390/bioengineering12020184},
}
Figure