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.1
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.1.tar.gz | 3.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|