SlideLab/abMiL
This document explores the research code for the tenant pilot that trains an ABMIL (Attention-Based Multiple Instance Learning) model on Whole Slide Images (WSI) using ColabBio’s MedVFS FUSE architecture and the SlideLab preprocessing pipeline.
1. Architectural Design (MedVFS FUSE-First)
Section titled “1. Architectural Design (MedVFS FUSE-First)”The differentiating factor of this pilot is that it does not use direct API connections or raw storage PVCs. The AI consumes all data through the MedVFS Daemon (FUSE) programmed in Go, which acts as a real-time POSIX-to-FHIR/OMERO bridge.
The Magic File: wsi-vfs.yaml
Section titled “The Magic File: wsi-vfs.yaml”The entire data ecosystem of the tenant is centrally defined in datasets/wsi-vfs.yaml.
This file tells MedVFS how to connect to the FHIR server, where the local SVS files (or DICOMweb) are, and where OMERO is. When the AI executes a read(), MedVFS orchestrates the network calls underneath.
graph TD
A["FHIR Server (Clinical Data)"] -->|REST API| M["MedVFS FUSE Daemon"]
B["OMERO Server (WSI)"] -->|JSON API| M
M -->|Virtual POSIX /data/vfs| S["SlideLab Preprocessing (Nextflow)"]
S -->|Tiles & H5 Embeddings| P["ABMIL Model Training (Nextflow)"]
P -->|model.pt| O["MLFLOW_REGISTER (Platform)"]
O -->|Hot Reload| T["TRITON_DEPLOY (Platform)"]
[!TIP] Legacy Maintenance: If you run this code on a Kubernetes cluster that forbids FUSE privileged Pods (
securityContext.privileged), the platform supports falling back to standard PVC mounting via the MedVFSsetupmode to populate a raw volume first.
2. Preprocessing Pipeline: SlideLab
Section titled “2. Preprocessing Pipeline: SlideLab”Before the ABMIL model can train, the WSIs must be preprocessed. The pilot integrates SlideLab, an H&E preprocessing pipeline designed for computational pathology. SlideLab was originally developed as part of Lorenzo Olmo Marchal’s thesis on computational pathology and AI models.
Preprocessing Steps
Section titled “Preprocessing Steps”- Masking: Filters out artifacts such as pen marks and blots from slides and segments tissue sections according to adjustable thresholds. It utilizes an H&E Otsu adaptation.
- Normalization: Normalizes the staining of the tiles to ensure model robustness across different lab scanners (e.g., using Macenko normalization).
- Tiling: Divides the large WSI into manageable tiles (e.g., 256x256 at 20x magnification) for the Multiple Instance Learning algorithm.
SlideLab provides comprehensive summary reports (tissue percentage, time taken) and error reports.
3. Operations & Runbook
Section titled “3. Operations & Runbook”The life cycle of the Tenant assumes we first populate the master databases, and then let MedVFS abstract the read operations.
Step 0: Initial Ingestion (Populating the Core)
Section titled “Step 0: Initial Ingestion (Populating the Core)”Before MedVFS can operate, clinical metadata (FHIR) must be injected and images (OMERO) registered using ETL scripts:
# Inject synthetic patients into FHIRkubectl apply -f ingestion/ingestion-job.yaml -n colabbio-dev
# (Optional) Register symlinks in OMEROkubectl apply -f legacy-pure-k8s/omero-import-job.yaml -n colabbio-devStep A: Metadata Materialization (Setup)
Section titled “Step A: Metadata Materialization (Setup)”MedVFS extracts the tabular structure from FHIR and the thumbnails from OMERO.
medvfs setup --config datasets/wsi-vfs.yamlStep B: Start Training (Nextflow)
Section titled “Step B: Start Training (Nextflow)”Execute the Nextflow Job injecting MedVFS. The Nextflow script main.nf executes the core ML logic and then imports the MLOps modules from the platform to register the model to MLflow and deploy to Triton automatically.
kubectl apply -f pipelines/nextflow-runner-job.yamlInside the AI Python code, the model simply reads images from the POSIX paths provided by the MedVFS manifest! When finished, the pipeline registers the model and sets up the inference endpoint transparently.