Fig. 2: Model comparison and outcome evaluations.

A A comparison of the system's performance in analyzing microglia across regions with varying cell densities and morphotypes, such as the external capsule (EC), midbrain (MB), and substantia nigra (SN), shows strong agreement with the ground truth (blue outlines) in both cell detection (yellow boxes) and segmentation (pink fills). B The StainAI system captured intricate details of microglial morphology and accurately differentiated overlapping cells (Cell 1 and Cell 2, indicated by arrows), with high agreement to the ground truth. In contrast to the smoother cell profiles detected by Mask R-CNN and YOLACT, StainAI provided more precise segmentation. Cell masks are color-coded based on their level of agreement with the ground truth, measured by Intersection over Union (IoU). C Radar charts compare the average single-cell segmentation between the ground truth and StainAI across six microglial activation states: (R), hypertrophic (H), bushy (B), ameboid (A), rod-shaped (RD), and hypertrophic rod-shaped (HR) using 25 morphometric parameters. The results show strong agreement, except for the fractal parameters lacunarity (LC) and standard deviation of lacunarity (stdLC), which capture the fine structural details of microglial processes. D Classification errors increased when the focus measure threshold was set lower, causing ramified cells (green) to be misclassified as inflamed types (yellow, orange, and red) due to blurry boundaries. E To reduce classification errors from low focus quality, a threshold of focus measure > 600, corresponding to 70% classification accuracy, was used to exclude cell images from analysis. mAP50: Mean Average Precision at 50% IoU; DSC: Dice Similarity Coefficient; FM: focus measure; UF: Unfocused cells identified by focus measure threshold. Refer to Supplementary Information for definitions of the morphometric parameters in (C).