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.0

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.0
File Size Uploaded
nidataset-0.9.0.tar.gz 3.8 MB Details

Built distribution (wheel)

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

Total release size: 3.9 MB

Release files / nidataset-0.9.0.tar.gz

Download URL nidataset-0.9.0.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
a0a95fee87d8bf9a1023f1f3b4f6a11ed6300aec3d83434f053ad589590bcb3c
BLAKE2b-256 checksum
How to use checksums
8da80baa4653541084e568d0f7227f3cfcaa4c697a2cb3061837b777055b9db1
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.0-py3-none-any.whl

Download URL nidataset-0.9.0-py3-none-any.whl
Size 92.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e2aa48ed5f74e0de589cad0fe510a53fed11bd4c7c649aae901c3c81cab2a1c
BLAKE2b-256 checksum
How to use checksums
cb6a6345b36ee9c9096d83189e9e585846a3300644b6814a23832e4b8b888ef2
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.0 This release

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