nnQC

Quality control for 3-D medical image segmentation. A latent diffusion model reconstructs the mask it believes is correct — its agreement with your candidate mask is the QC score.

CT + MRIprostate · cardiac · liver · spleen ground-truth-freeMCP server included

Try it on real cases

One case per organ. Drag the divider to wipe between the input segmentation (left) and the nnQC reconstruction (pGT, right). The QC score — Dice(input, pGT) — is computed entirely without ground truth.

How it works

A 2-D latent diffusion model, trained on corrupted-then-reconstructed masks, conditioned on the scan.

1

Corrupt & condition

During training, ground-truth masks are degraded with anatomically realistic corruptions. The model sees the corrupted mask together with UniMed-CLIP features of the scan slice and a slice-position embedding.

2

Reconstruct

At inference, the diffusion model denoises the candidate mask's latent into the mask it believes is correct — the pseudo ground truth (pGT) — a few DDIM steps per slice, no retraining per case.

3

Score

The Dice overlap between the candidate mask and the pGT is the QC score: a calibrated, ground-truth-free estimate of segmentation quality, per volume and per slice.

Quickstart

Pretrained weights for prostate, spleen, cardiac and liver download automatically on first use (Zenodo archive, also mirrored per-file on Hugging Face).

$ pip install git+https://github.com/robustml-eurecom/nnQC.git
$ nnqc download prostate
$ nnqc check --task prostate --image scan.nii.gz --mask candidate.nii.gz --save recon.nii.gz
>>> import nnqc
>>> result = nnqc.check("scan.nii.gz", "candidate.nii.gz", task="prostate")
>>> result.qc_score
0.91
>>> result.save("reconstruction.nii.gz")

MCP server

nnQC ships an MCP stdio server so AI assistants can run QC directly. Three tools: list_tasks, check_mask, explain_qc_score.

$ python -m nnqc.mcp_server
{
  "mcpServers": {
    "nnqc": {
      "command": "python",
      "args": ["-m", "nnqc.mcp_server"]
    }
  }
}

See the MCP demo walkthrough for real JSON-RPC exchanges.