Gains:
- Ability to explain AI's support for cell counting, segmentation, and grading in a whole slide image (WSI) workflow
- Ability to recognize the effect of painting and scanning variability on model performance and domain shift
- Ability to validate pathology AI outputs with reference standard, sampling and pathologist approval
Pathology is the branch of medicine in which disease is identified by examining a tissue sample under a microscope; The "gold standard" of many cancer diagnoses is made here. Digital pathology is the digitization of a stained tissue section on a glass slide with a high-resolution scanner. The resulting file is called a whole slide image (WSI for short); A single slide can be a giant image of gigapixel size, that is, billions of pixels. Artificial intelligence supports cell counting, region segmentation and grading in these huge images. In this unit we will see the WSI workflow, its biggest technical pitfall: staining/scanning variability, and why pathologist approval is essential.
Let's state from the beginning: artificial intelligence can be a counter, a preliminary scanner and a second eye in pathology; But cancer diagnosis, staging and grading decisions belong to the pathologist. The model does not diagnose.
Steps of WSI Workflow
Step 1 — Screening and quality control. The glass slide is scanned; Defects such as defocus, fold marks, and air bubbles can be detected automatically. Poor quality scans should not enter the model at all.
Step 2 — Tile (patch) removal. Gigapixel image cannot be processed directly; is divided into small squares (English patch, typically 256x256 or 512x512 pixels). The model evaluates each tile separately, then the results are combined.
Step 3 — Tissue/cell analysis. Model; It carries out tasks such as tumor site segmentation, mitosis (dividing cell) counting, nuclear density or calculation of a marker (e.g. Ki-67 staining rate). The output is a numerical measurement or a heat map.
Step 4 — Consolidation and reporting. Tile results are combined at the slide level; A summary is produced, for example, "percentage of tumor area" or "mitotic count".
Step 5 — Pathologist evaluation. The pathologist examines the regions and counts marked by the model; accepts, corrects or rejects. Diagnosis and grading are up to the pathologist.
The Biggest Pitfall: Dyeing and Scanning Variability
Tissue sections are usually stained with H&E (hematoxylin and eosin; the standard dye that stains the nuclei blue-violet and the cytoplasm pink). But staining intensity varies markedly by laboratory, stain batch, section thickness, and scanner brand. The human eye easily adapts to these differences; The model may not be compatible.
If a model has learned based on the pink-purple tones of lab A, its performance will decrease on the paler or darker staining of lab B. This phenomenon is called domain shift and is the most common cause of failure in digital pathology. Solution approaches: color normalization (moving images into a common color space), multicenter training data, and — most importantly — external validation at each laboratory to be used.
Three Mini Cases: By the Numbers
Case 1 — Consistency in mitotic count. Mitotic counting in breast cancer grading is important but laborious and variable from observer to observer. AI-assisted preliminary counting in one laboratory, agreement (kappa) between two pathologists increased from 0.55 to 0.71, and counting time per slide decreased from 4 minutes to 1.5 minutes. However, each final count was confirmed by the pathologist; The model suggested, the pathologist decided.
Case 2 — Field shift hit. In the laboratory that developed a tumor segmentation model, it was working correctly 93% of the time. The same model systematically overestimated the tumor area by 20% in the partner laboratory using a different scanner and dye. After color normalization and revalidation with 200 slides from that laboratory, the difference decreased to an acceptable level.
Case 3 — Sampling fallacy. One model said "no" tumor on a slide; however, the model only evaluated the scanned area and the tumor was in an unsampled section. Pathology diagnosis is as good as slide selection and sampling; AI "negative" output does not compensate for undersampling. That's why a negative AI result alone never means "no disease".
Weak Prompt / Strong Prompt
Note: The following prompts are for configuring the pathology report and workflow text; Tissue image diagnosis is the work of verified software and pathologists.
Weak prompt:
According to this pathology report, is there cancer? [report]
Powerful prompt:
Your role: You are the pathology report structuring assistant (YOU ARE NOT DIAGNOSIS). Structure the following anonymous pathology report:- Table the specimen type, staining, tumor type/grade, surgical margin, markers.- Keep ambiguous wording ("atypical, clinical correlation recommended") intact.- Add no findings that are not in the text; write “unspecified” in the missing field.- Finally, list 3 points that the pathologist should confirm.Anonymous report:[text]
Four Copiable Templates
1) Report standardization:
Plot the following anonymous pathology report into structured fields (organ, diagnosis, grade, margin, marker percentages). Stick to the text. Report: [text]
2) Token consistency check:
List all percentage and numerical markers (Ki-67, ER, PR, HER2) mentioned in this report; Mark values that conflict with each other or with the diagnosis. Report: [text]
3) Model validation plan (digital pathology):
Write a draft validation plan for a WSI segmentation model: color normalization, multicenter external validation, pathologist agreement (kappa), field shift testing. Mark pathologist validation points separately.
4) Adding sampling warning:
Add to the following negative AI result the caveat that "sampling may be limited, a negative result does not exclude disease" and the requirement for pathologist confirmation. Output: [text]
Model's Role: By Task Type
Task type
AI contribution
criticality
verification
Tumor region segmentation
high
high
Pathologist + external verification
Mitosis/cell count
high
high
Pathologist confirmation
Percentage of marker (Ki-67)
high
medium
Reference comparison
Quality control (focus/defect)
high
low
spot check
Report configuration (text)
high
low
Pathologist confirmation
Tip: When evaluating a model proposal in digital pathology, always ask: "Which laboratories' stains and scanners has this model been trained on, and has it been validated in my laboratory?" If the answer is "no", the performance figures do not apply to you yet.
Caution: Just because the AI says "no tumor" does not mean there is no tumor in the unsampled tissue. A negative result in pathology is limited by the quality of sampling; the pattern cannot exceed this limit and a negative result is not diagnostic assurance.
Common mistakes
- Underestimating color/dye variability. Field drift is the most common cause of failure in digital pathology.
- Train in one center and use everywhere. Different browser and coloring creates silent performance degradation.
- Mistaking a negative result for assurance. The sampling limit cannot be compensated by the model.
- Ignoring interobserver variability. The model should be evaluated accordingly if the reference standard itself is variable.
- Eliminating the pathologist. Counting and segmentation are support; Diagnosis and grading rest with the pathologist.
In summary
- Digital pathology analyzes gigapixel WSI images by dividing them into tiles; AI supports with cell counting and segmentation.
- The biggest technical trap is field drift due to staining/scanning variability; color normalization and external validation are essential.
- A negative AI result is limited by the sampling limit and does not provide diagnostic assurance.
- The reference standard and interobserver variability are the context for model evaluation.
- Diagnosis, staging, and grading are the responsibility of the pathologist; AI does not diagnose.
Application task
Select a hypothetical digital pathology model (e.g. Ki-67 percentage calculation). Write an external validation plan for this model: how many slides from which labs, what color normalization, how you will measure pathologist agreement, and how you will test field drift. Then write in one sentence the constraint warning that should be added to the negative/positive output of the model.
checklist
- [ ] I know the scanning, tiling, analysis and compositing steps of the WSI workflow.
- [ ] I understand how paint/scan variability causes field drift and how it is managed.
- [ ] I understand that the negative AI result is limited by the sampling limit.
- [ ] I can use the concepts of external validation and pathologist agreement (kappa).
- [ ] I have internalized that the diagnosis and grading decision remains with the pathologist.