A flowchart outlining the ImmunoRatio analysis algorithm. Step 1: A RGB color microscope image, an optional blankfield correction image, and thresholding adjustment parameters are received as an input. Step 2: The blankfield image is used to correct uneven illumination and color balance. If a blankfield image is not available, background subtraction is carried out using the Rolling ball algorithm . Step 3: The Color Deconvolution plugin  is used to separate the stains into two eight-bit component images: diaminobenzidine (DAB) and hematoxylin (H). Step 4: The components are processed with a mean filter and binarized using adaptive IsoData thresholding . Component-specific threshold adjustments are applied if defined via input parameters. Step 5: The components are processed with a median filter to smooth the thresholding result. Nucleus segmentation is performed on both components by using the Watershed algorithm  and small particles are discarded based on their size. For the H component, thin (fibroblastic) cells are identified and discarded using non-round particle removal. Step 6: The H and DAB components are overlaid on the source image. The percentage of DAB-stained nuclear area out of the total nuclear area (the labeling index) is calculated. An (optional) external calibration function is used to correct the ratio percentage. Step 7: The result image consisting of image identification string, the analysis date, the result labeling index, the original image, and a pseudo-colored image showing the staining components is created. A more detailed algorithm flowchart is available on our research group website .