Background:: Whole slide imaging (WSI) offers a novel approach to digitize and review pathology slides, but the voluminous data generated by this technology demand new computational methods for image analysis. Materials and Methods:: In this study, we report a method that recognizes stains in WSI data and uses kernel density estimator to calculate the stain density across the digitized pathology slides. The validation study was conducted using a rat model of acute cardiac allograft rejection and another rat model of heart ischemia/reperfusion injury. Immunohistochemistry (IHC) was conducted to label ED1+ macrophages in the tissue sections and the stained slides were digitized by a whole slide scanner. The whole slide images were tessellated to enable parallel processing. Pixel-wise stain classification was conducted to classify the IHC stains from those of the background and the density distribution of the identified IHC stains was then calculated by the kernel density estimator. Results:: The regression analysis showed a correlation coefficient of 0.8961 between the number of IHC stains counted by our stain recognition algorithm and that by the manual counting, suggesting that our stain recognition algorithm was in good agreement with the manual counting. The density distribution of the IHC stains showed a consistent pattern with those of the cellular magnetic resonance (MR) images that detected macrophages labeled by ultrasmall superparamagnetic iron-oxide or micron-sized iron-oxide particles. Conclusions:: Our method provides a new imaging modality to facilitate clinical diagnosis. It also provides a way to validate/correlate cellular MRI data used for tracking immune-cell infiltration in cardiac transplant rejection and cardiac ischemic injury.