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:
niifor quick edits (nii flip scans/ out/ --axis 0) and config-driven pipelines (nii run),niqcfor QC.
📖 Documentation and examples
- Full documentation: giuliorusso.github.io/Ni-Dataset
- End-to-end CT pipeline:
examples/ct_pipeline/
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)
| File | Size | Uploaded | |
|---|---|---|---|
| nidataset-0.9.0.tar.gz | 3.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|