Skip to main content

NIfTI Dataset Management

PyPI version Python versions CI Coverage (CI gate) License Downloads


NIfTI dataset toolkit for CT/MRI deep-learning pipelines: slice extraction, registration, QC, preprocessing — no ML dependencies.

pip install nidataset            # add [yaml] for YAML pipeline / QC configs
import nidataset as nid

print(nid.qc.check_dataset("scans/").status)  # orientation, spacing, NaN, ... before anything else
nid.resampling_dataset("scans/", "resampled/", desired_volume=(224, 224, 128), saving_mode="folder")
nid.extract_slices_dataset("resampled/", "slices/", view="axial", saving_mode="view")
nid.extract_annotations_dataset("labels/", "annotations/", view="axial", saving_mode="view")

Or chain the same steps in one config and run it from the shell (example):

cd examples/ct_pipeline
python make_synthetic.py         # tiny synthetic dataset, no patient data
nii run pipeline.yaml            # QC -> slices -> registration -> ... + run_manifest.json

✨ What's inside

  • Slices for ML: extract 2D slices and matching annotations (center / box / radius) from 3D volumes, in any view, with optional padding.
  • Preprocessing: skull stripping (FSL), registration to a template and propagation of the transform to masks and annotations, resampling, MIP.
  • Transforms: intensity normalization, CT windowing presets, rescaling, resample-to-reference, DICOM ↔ NIfTI.
  • Geometry: rotate, flip, crop, crop-to-content, crop-and-pad — all keep the affine in step with the data (tested on world coordinates).
  • QC: geometry, orientations, NaN/Inf, empty slices, image ↔ mask ↔ annotation coherence, via Python or niqc.
  • Analysis and visualization: volume comparison (Dice, Hausdorff, …), statistics, dataset splits, overlays, montages.
  • CLIs: nii for quick edits (nii flip scans/ out/ --axis 0) and config-driven pipelines (nii run), niqc for QC.

📖 Documentation and examples

Dependencies are declared in pyproject.toml. Skull stripping additionally needs a local FSL installation.

📚 Used in

If you use nidataset in your research, please cite it (CITATION.cff).

🤝 Contributing

See CONTRIBUTING.md and the CHANGELOG.md.

Authors: Giulio Russo, Ciro Russo, PhD

⚖️ License

MIT License

Metadata

Release files for nidataset 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nidataset 0.9.1
File Size Uploaded
nidataset-0.9.1.tar.gz 3.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for nidataset 0.9.1
File Interpreter ABI Platform
nidataset-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 3.9 MB

Release files / nidataset-0.9.1.tar.gz

Download URL nidataset-0.9.1.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
370e00e353907c322f91e321304fd4316fa048e856c0e8e1759ae196d320ea99
BLAKE2b-256 checksum
How to use checksums
f16c088f4dbe1ee7336f55f2ca563d6a6c96f5c064aca6f3ed834cc87a5bfc39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / nidataset-0.9.1-py3-none-any.whl

Download URL nidataset-0.9.1-py3-none-any.whl
Size 92.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25bb1a5a421b91cec946573fb316c60a1102fb284476e20fa116386b9f8288f5
BLAKE2b-256 checksum
How to use checksums
24b25f8406b1f82addf9d0b678910005016815f53b36dbc06fb1e32f3ac1e03f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page