CoolFace
Apppublic

CedricConday/nifti-qc

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes
App README

nifti-qc

Catch silently-broken NIfTI geometry — qform/sform mismatch, non-orthonormal affines, misaligned inputs — before it propagates into your results.

Neuroimaging pipelines fail quietly. A volume whose qform and sform disagree loads without error in every standard reader; which one your tool happens to consult decides where the data lands in space. Two volumes that were never truly co-registered will still produce a voxel-wise comparison, and it will look fine. These are not crashes, they are wrong answers that pass review.

This Space runs the `nifti-qc` package interactively. Upload one or more .nii / .nii.gz files, or press Load a broken example to scan two synthetic volumes with faults deliberately built in.

Everything runs in your browser. The real nifti-qc package is installed into a WebAssembly Python runtime (Pyodide) on page load, so no volume you open here is ever uploaded anywhere — which matters for medical imaging, because you can point it at real patient data without it leaving your machine. First load takes about twenty seconds while the runtime and packages download; after that it is instant.

There is no server. This is a static page, so the results you see come from the same Python code you would get from pip install nifti-qc, not from a reimplementation.

Use it as a library

bash
pip install nifti-qc
python
from nifti_qc import scan

report = scan(["sub-01_T1w.nii.gz", "sub-01_FLAIR.nii.gz"])
for fr in report.files:
    for f in fr.findings:
        print(f.severity, f.code, f.message)

Or in CI:

bash
nifti-qc path/to/data/*.nii.gz

Checks

AreaWhat it catches
Affineqform/sform disagreement, translation and rotation drift
Geometrynon-orthonormal axes, extreme voxel anisotropy
Datadegenerate or implausible intensity distributions
Alignmentvolumes that are not in a shared space

How this Space is built

FileRole
index.htmlUI, and the JavaScript that boots Pyodide and hands files to Python
scan.pyRuns inside Pyodide — wraps nifti_qc.scan() and returns JSON
requirements.txtThe packages micropip installs in the browser

numpy is deliberately absent from the in-browser install because Pyodide ships it natively; asking micropip for it sends it to PyPI, where there is no pure-Python wheel.

Links

  • Source: <https://github.com/CedricConday/nifti-qc>
  • PyPI: <https://pypi.org/project/nifti-qc/>
  • Built on nibabel

MIT licensed.