From a controlled photograph to a number with a state.
This page describes every stage of the VITRA pipeline, the sources of error we know about, the data a real calibration would need, and the regulatory position of the prototype. It is written to be checked, not to persuade.

Eleven steps, in order.
Each step either passes the run forward or stops it with a recorded reason. There is no path from an image to a displayed value that skips a check.
- 01
Sample and strip preparation
A fresh, well-mixed urine sample is collected in a clean container. One reagent strip from a sealed, in-date vial is dipped so that all ten pads are wetted, then drawn along the rim to remove excess liquid. The strip product, lot number and expiry are recorded against the sample so a calibration model can be matched to the exact chemistry used.
- 02
Timed reaction
Pad colour develops over roughly 60–120 s and keeps changing afterwards. VITRA uses a fixed reaction window of 120 s from dip to capture, started by the operator on the device. Captures outside the window are flagged; there is no manual override of the timer in research mode.
- 03
Controlled image acquisition
The strip is inserted handle-first into the enclosure slot, which seats the pads at a known position under the camera. Brightness-regulated LED strips provide the only illumination; exposure, gain and white balance are locked. The Raspberry Pi 5 captures a single full-resolution frame and submits it with device identity, LED current and timer metadata.
- 04
Image-quality validation
Before any colour is read, the image is checked for focus (Laplacian variance), exposure (clipped-pixel fraction), glare (specular highlight area), tilt and completeness. A frame that fails is recorded with the reason and the run is stopped with the state “Invalid image”. No pad is analysed from a rejected frame.
- 05
Strip localization
OpenCV finds the strip body: adaptive thresholding, contour extraction and a minimum-area rectangle, followed by a perspective correction that rotates the strip to a canonical horizontal pose. Because the slot fixes the geometry, a fixed-geometry fallback can be used when the contour search fails, and the fallback is recorded in the run.
- 06
Ten-pad segmentation
Along the rectified strip the ten pads are found as regularly spaced high-saturation squares. Each pad region is shrunk by a margin to avoid the edges where dye bleeds, and the configured pad map assigns an analyte to each position. A pad whose region is too small, non-uniform or occluded is marked “Indeterminate”.
- 07
RGB/CIELAB feature extraction
For each pad VITRA records the trimmed mean and standard deviation of R, G and B, converts to CIE L*a*b* under a D65 assumption, and derives chroma and hue angle. Uniformity, glare fraction and local contrast become pad-quality scores. A white reference region on the strip handle, when present, provides a per-image normalisation term.
- 08
Calibration
A calibration model maps pad features to an analyte value for one strip product. The calibration studio accepts reference pairs (image features paired with laboratory values), fits scikit-learn baselines (ridge regression, gradient boosting, k-nearest neighbours) with cross-validation, and stores the model with its reference range and training provenance. Models trained on synthetic data are flagged and only usable in demo mode.
- 09
Model inference
At run time each analyte is matched to the best compatible model for the strip product. A result-state policy then decides what is shown: a value is only displayed when the image and pad passed quality checks, a model exists, and the prediction lies inside the model’s reference range. Otherwise the analyte carries a state such as “Calibration required” or “Outside calibrated range” and no number.
- 10
Report generation
A report bundles the capture, overlay, feature table, per-analyte states and values, model identifiers and versions, quality metrics, and the review trail into PDF and JSON. Every page of the PDF carries the research-prototype disclaimer; synthetic runs are watermarked.
- 11
Human review
A clinician or researcher opens the run, compares the overlay against the raw image, and either accepts, annotates or overrides each analyte with a recorded reason. Sign-off locks the run. Nothing in VITRA leaves the review queue automatically.
Sources of variability
Colour on a reagent pad is the product of chemistry, time, light and optics. Each of these moves the measured RGB independently of the analyte concentration.
- 01Strip branddifferent manufacturers use different dyes and pad substrates; a model is valid for one product only.
- 02Batchlot-to-lot differences in reagent loading shift the ramp; lot numbers are recorded with every run.
- 03Lightingcolour temperature and intensity change hue and lightness; the enclosure removes ambient light but not LED variation.
- 04LED aging and driftLED output falls and shifts with age and temperature; device-level drift tracking is part of the roadmap.
- 05Segmentation errorsa pad region that includes edge bleed or background biases the mean colour; margins and quality scores limit but do not remove this.
Reference-data requirements
A calibration model is only as good as the paired data behind it. For each strip product and analyte VITRA expects reference pairs that cover the clinically relevant span, captured on the same device class under the same acquisition protocol, with laboratory values obtained by an accepted reference method and recorded with timestamps so the reaction window can be verified.
VITRA ships with no real reference data. The seeded datasets are synthetic, generated from the demo colour ramps, and exist only to exercise the pipeline.
Model limitations and uncertainty
Colour-to-concentration mappings are non-linear and saturate at both ends of the chart. A model will extrapolate badly beyond its reference range, which is why out-of-range predictions are suppressed rather than displayed.
Baseline models report cross-validated error on their training set; this is not a measure of clinical performance. Qualitative analytes (nitrite) are reported as categories. No model in VITRA estimates its own per-sample uncertainty yet; that is listed as future work.
Clinical validation requirements
Before any output could be considered for clinical use, a prospective study would be required: a predefined protocol, an adequately sized sample across the intended population, comparison against laboratory reference methods, pre-registered accuracy and agreement metrics per analyte, and ethics approval. None of this has been done. VITRA’s result states make that status visible on every result.
Patient-data protection (DPDP Act 2023)
The Digital Personal Data Protection Act, 2023 governs the processing of personal data in India. In VITRA, sample records are keyed by an internal identifier and the platform does not require patient-identifying fields. Where a deployment chooses to record them, the data fiduciary must establish lawful purpose and consent, limit retention, provide access and erasure, and secure the data. Images and reports are stored under access control and served only to authenticated users with the relevant permission.
Regulatory context (CDSCO MDR 2017 — IVD)
Under the Medical Devices Rules, 2017 administered by the Central Drugs Standard Control Organisation, software that interprets in-vitro diagnostic results would be regulated as an IVD medical device and would require classification, a quality management system, and a licence before manufacture or sale. VITRA is not registered and makes no claim under these rules. It is a research prototype and must not be used for diagnosis or patient management.
Implemented today / Future work
| Implemented today | Future work |
|---|---|
| Image upload and in-browser capture | Raspberry Pi capture integration on the enclosure |
| Whole-image quality checks (focus, exposure, glare, tilt) | MobileSAM / learned segmentation |
| OpenCV strip localisation and pad detection with fixed-geometry fallback | Real reference datasets per strip product |
| RGB / CIELAB feature extraction with pad-quality scores | Clinical validation study |
| Calibration studio with scikit-learn baselines | Optional LLM narration of reports |
| Policy-driven result states on every analyte | |
| PDF / JSON report generation | |
| Review queue with overrides and sign-off | |
| Simulated device adapter and ingest API |
Built for the KJS-HC-03 use case. No endorsement by K. J. Somaiya Hospital or Paramcare Lifesciences is implied. Research prototype — not a medical device — not clinically validated.