segauge
DICOM-native evaluation for medical image segmentation: surface-mesh distance metrics, per-lesion detection, fairness slices, and a confidence interval on every number.
segauge computes Dice, IoU, Hausdorff distance (HD), HD95, average symmetric surface distance (ASSD), Normalized Surface Dice (NSD), and per-lesion detection F1 for 3D medical image segmentation, and puts a bootstrap confidence interval on every number. It reads NIfTI, DICOM-SEG, RTSTRUCT, and NumPy directly, so you can evaluate the output of nnU-Net, MONAI, or TotalSegmentator without a lossy conversion.
It exists because the metrics you report should be the metrics that are true, and today they often aren't.
pip install segauge
import segauge as sg
result = sg.evaluate([
sg.Case("patient_001", pred="pred.nii.gz", gt="gt.nii.gz", metadata={"scanner": "siemens"}),
sg.Case("patient_002", pred="pred2.dcm", gt="gt2.dcm", metadata={"scanner": "ge"}),
])
print(result.summary()) # every metric with a 95% CI
print(result.by_subgroup("scanner")) # where does the model quietly fail?
result.to_html("report.html") # one self-contained report
Or from the command line:
segauge eval --pred preds/ --gt labels/ --metadata cases.csv --report report.html
Why not just use MONAI or Metrics Reloaded?
segauge bundles four things no incumbent provides together: a confidence interval on every metric, per-lesion detection, subgroup/fairness slicing, and native DICOM-SEG/RTSTRUCT input.
It also computes distance metrics on a surface mesh rather than the voxel grid: it extracts the object surface with marching cubes at true voxel spacing and integrates over the surface, following the MeshMetrics method (Podobnik & Vrtovec, 2025). In our own benchmark (benchmarks/mesh_vs_grid.py) this measurably reduces HD95 error under anisotropic, thick-slice spacing, where grid rasterization hurts most; for mean distance (ASSD) on smooth shapes the two methods are comparable. A formal validation suite against the MeshMetrics reference is in progress; we report what the benchmark shows, not more.
| segauge | MONAI | Metrics Reloaded | seg-metrics | DeepMind surface-distance | |
|---|---|---|---|---|---|
| Surface-mesh distances (vs voxel grid) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Confidence intervals | ✅ | ❌ | ❌ | ❌ | ❌ |
| Per-lesion detection F1 | ✅ | partial | ✅ | ❌ | ❌ |
| Subgroup / fairness slicing | ✅ | ❌ | ❌ | ❌ | ❌ |
| DICOM-SEG / RTSTRUCT native | ✅ | partial | ❌ | ❌ | ❌ |
pip install |
✅ | ✅ | ❌ | ✅ | ✅ |
Metrics
- Overlap: Dice (DSC), IoU (Jaccard) — exact, integer-counted.
- Surface distance: Hausdorff (HD), HD95, ASSD, MASD, Normalized Surface Dice (NSD) — mesh-based, spacing-aware, area-weighted.
- Per-lesion detection: precision, recall, F1 via connected-component matching, so you can answer "did it find the tumor?" not just "how much voxel overlap?"
- Every aggregate carries a deterministic bootstrap confidence interval.
Inputs
NIfTI (.nii, .nii.gz), DICOM-SEG, RTSTRUCT, NumPy arrays, and .npy. Voxel spacing is read from the file header and used for the distance metrics, so a segmentation from a clinical pipeline is evaluated as-is.
FAQ
How do I compute HD95 correctly in Python? segauge.surface_metrics(pred, gt, spacing) returns HD, HD95, ASSD, MASD, and NSD computed on the surface mesh, not the voxel grid.
Can it evaluate DICOM-SEG / RTSTRUCT directly? Yes. pip install segauge[dicom] and pass a .dcm SEG, or use segauge.load_rtstruct(series_dir, rtstruct, roi_name).
Does it work with nnU-Net / TotalSegmentator / MONAI outputs? Yes. Point it at the NIfTI (or DICOM) they produce.
Why a confidence interval? A Dice of 0.85 on 12 cases is not the same claim as 0.85 on 1200. segauge makes the difference visible.
2D images? Overlap and detection metrics work in any dimension; surface-distance metrics are 3D in v0.1 (2D is planned for v0.2).
Status
Pre-release (0.1.0.dev), built in the open. segauge is an evaluation tool for developers and researchers. It is not a medical device and produces no diagnosis.
References
- Maier-Hein, Reinke et al. Metrics Reloaded. Nature Methods (2024). https://www.nature.com/articles/s41592-023-02151-z
- Podobnik & Vrtovec. MeshMetrics. arXiv:2509.05670 (2025). https://arxiv.org/abs/2509.05670
License
Apache-2.0.
Metadata
Release files for segauge 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| segauge-0.1.0.tar.gz | 142.9 kB | Without provenance | Details for segauge-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| segauge-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for segauge-0.1.0-py3-none-any.whl |
Total release size: 168.1 kB
Release files / segauge-0.1.0.tar.gz
| Download URL | segauge-0.1.0.tar.gz |
|---|---|
| Size | 142.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c800f3909fc424875e92bec3d93c1cf9c70638e6c9ddf7792e72cd526db63631
|
|
BLAKE2b-256 checksum How to use checksums |
e30186eb02c337fea5ac79622cbd00544ea92ea207e9e377335f04ffde93042d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.10
|
Release files / segauge-0.1.0-py3-none-any.whl
| Download URL | segauge-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28b51f84572205c1765f33ffcdba65bb637e1294ecf3f60644bd424b210a36cb
|
|
BLAKE2b-256 checksum How to use checksums |
e260dcc69ee4fa17f46f9a179b5b987461f4d68a69b2f532d33bf2da643c54c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.10
|
Security for segauge 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.