Overview
Digital pathology and whole-slide imaging (WSI) present unique evaluation challenges due to their massive scale (gigapixel images), hierarchical viewing patterns, and complex annotation requirements. Rubric provides specialized support for pathology AI evaluation.
SVS Aperio ScanScope format
DICOM WSI DICOM Supplement 145
Additional formats: .mrxs (MIRAX), .vsi (Olympus), .qptiff (PerkinElmer), .czi (Zeiss)
Logging Pathology AI Output
client.pathology.log(
project = "breast-cancer-detection" ,
# Slide reference
slide_id = "slide_2024_001234" ,
slide_url = "https://pathology-store.example.com/slides/001234.svs" ,
# Slide metadata
metadata = {
"stain" : "H&E" ,
"tissue_type" : "breast" ,
"specimen_type" : "core_biopsy" ,
"scanner" : "Aperio AT2" ,
"magnification" : "40x"
},
# AI analysis output
ai_analysis = {
"classification" : {
"diagnosis" : "invasive_ductal_carcinoma" ,
"confidence" : 0.94 ,
"grade" : "2" ,
"subtype" : "luminal_a"
},
"regions_of_interest" : [
{
"id" : "roi_001" ,
"type" : "tumor" ,
"geometry" : {
"type" : "Polygon" ,
"coordinates" : [[[ 100 , 200 ], [ 150 , 200 ], [ 150 , 250 ], [ 100 , 250 ]]]
},
"level" : 0 , # Pyramid level
"confidence" : 0.91 ,
"features" : {
"mitotic_count" : 12 ,
"nuclear_grade" : "intermediate"
}
}
],
"quantitative_metrics" : {
"tumor_percentage" : 45.2 ,
"ki67_index" : 22.5 ,
"til_score" : 15
}
},
# Ground truth
expected = {
"diagnosis" : "invasive_ductal_carcinoma" ,
"grade" : "2" ,
"pathologist_annotations" : [ ... ]
}
)
Pathology Evaluators
Classification Accuracy
For slide-level or region-level diagnosis:
{
"type" : "pathology_classification" ,
"config" : {
"classes" : [
"benign" ,
"atypical" ,
"dcis" ,
"invasive_ductal_carcinoma" ,
"invasive_lobular_carcinoma"
],
"hierarchical" : True , # Malignant > IDC/ILC
"severity_weighting" : {
"benign_as_malignant" : 1.0 , # False positive
"malignant_as_benign" : 5.0 # False negative - critical
}
}
}
Detection & Localization
For cell detection, mitosis counting, or region identification:
{
"type" : "pathology_detection" ,
"config" : {
"target_objects" : [ "mitosis" , "tumor_cell" , "lymphocyte" ],
"iou_threshold" : 0.3 , # Lower threshold for small objects
"evaluate_at_levels" : [ 0 , 2 ], # Pyramid levels
"metrics" : [ "precision" , "recall" , "f1" , "froc" ]
}
}
Segmentation Quality
For tissue segmentation and tumor delineation:
{
"type" : "pathology_segmentation" ,
"config" : {
"regions" : [ "tumor" , "stroma" , "necrosis" , "normal" ],
"metrics" : [ "dice" , "hausdorff" , "surface_distance" ],
"dice_threshold" : 0.7
}
}
Multi-Resolution Handling
WSI pyramids require evaluation at appropriate magnification levels:
# Specify evaluation at specific magnification
client.pathology.log(
ai_analysis = {
"regions_of_interest" : [
{
"geometry" : { ... },
"level" : 0 , # Native resolution
"effective_mpp" : 0.25 , # Microns per pixel
"magnification" : "40x"
}
]
}
)
Rubric automatically handles coordinate transformation between pyramid levels for evaluation.
GeoJSON (Recommended)
{
"type" : "Feature" ,
"geometry" : {
"type" : "Polygon" ,
"coordinates" : [[[ 100 , 200 ], [ 150 , 200 ], [ 150 , 250 ], [ 100 , 250 ], [ 100 , 200 ]]]
},
"properties" : {
"classification" : "tumor" ,
"confidence" : 0.91
}
}
QuPath Export
# Import QuPath annotations
client.pathology.import_annotations(
slide_id = "slide_001" ,
format = "qupath" ,
file_url = "https://storage.example.com/annotations/slide_001.geojson"
)
ASAP XML
client.pathology.import_annotations(
slide_id = "slide_001" ,
format = "asap" ,
file_url = "https://storage.example.com/annotations/slide_001.xml"
)
Quality Control
Evaluate pre-analytical factors that affect AI performance:
{
"type" : "slide_quality" ,
"config" : {
"check_focus" : True ,
"check_staining" : True ,
"check_artifacts" : True ,
"check_tissue_folds" : True ,
"min_tissue_percentage" : 20
}
}
Biomarker Quantification
For IHC and special stains:
client.pathology.log(
metadata = {
"stain" : "HER2" ,
"antibody" : "4B5"
},
ai_analysis = {
"her2_score" : "2+" ,
"membrane_completeness" : 0.75 ,
"intensity_distribution" : {
"0" : 0.15 ,
"1+" : 0.25 ,
"2+" : 0.45 ,
"3+" : 0.15
}
},
expected = {
"her2_score" : "2+" ,
"fish_result" : "amplified" # Ground truth from reflex testing
}
)
Next Steps