Skip to main content

A set of utilities for handling NIfTI datasets, including slice extraction, volume manipulation, and preprocessing of medical imaging data.

Project description

NIfTI Dataset Management

PyPI version Downloads Python versions License

Comprehensive toolkit for NIfTI medical imaging datasets. Extract 2D slices from 3D volumes, validate data integrity (geometry, orientations, NaN), register and resample, compute statistics, generate visualizations, and build detection/segmentation pipelines—all with zero external ML dependencies.


Extract 2D slices (all views) and build datasets for ML. Preprocess with skull stripping, registration, resampling, MIP. Transform intensity (normalize, window, rescale) and geometry (resample, crop). Analyze (compare, statistics, splits). Visualize (overlays, montages). Validate data integrity (geometry, orientations, NaN, image↔mask coherence) via Python API or CLI (niqc). Run quick edits from the shell — rotate, flip, crop, rescale, DICOM↔NIfTI — via the nii CLI. No ML dependencies.

nii — quick operations from the terminal

Everyday NIfTI edits without opening Python, mirroring the package API (each command also works on a whole folder):

nii rotate scan.nii.gz out/ --k 1 --axes 0 1   # lossless 90° rotation
nii flip scans/ out/ --axis 0                  # mirror a whole folder
nii crop-content scan.nii.gz out/ --margin 2   # crop to the foreground box
nii rescale scan.nii.gz out/ --out-min 0 --out-max 255
nii to-dicom scan.nii.gz out/                  # NIfTI → DICOM series
nii from-dicom dicom/case_01/ out/             # DICOM series → NIfTI

Geometric ops update the affine in step with the data, so a flip or rotation never corrupts orientation. See the docs for the full reference.

⬇️ Installation and Import

Now, this code is available with PyPI here. The package can be installed with:

pip install nidataset

and can be imported as:

import nidataset as nid

📖 Documentation and Examples

Full documentation: https://giuliorusso.github.io/Ni-Dataset/

Complete example project: CT-manager (slice extraction, registration, QC validation, preprocessing pipeline)

🚨 Requirements

nibabel>=5.0.0
numpy>=1.24
opencv-python>=4.7
pandas>=1.5
Pillow>=9.4
scipy>=1.10
SimpleITK>=2.2
scikit-image>=0.19
tqdm>=4.64

Install the requirements with:

pip install -r requirements.txt

🤝 Contribution

👨‍💻 Ciro Russo, PhD

⚖️ License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nidataset-0.8.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nidataset-0.8.0-py3-none-any.whl (84.0 kB view details)

Uploaded Python 3

File details

Details for the file nidataset-0.8.0.tar.gz.

File metadata

  • Download URL: nidataset-0.8.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for nidataset-0.8.0.tar.gz
Algorithm Hash digest
SHA256 9b5a0331034f084606583d287913dc96a4111d87fa1847c3f5063cf9bc5c3b39
MD5 6a22804b4a90e43e2aa6f0747a211aab
BLAKE2b-256 87aae32ea41b42f1277c7c3878981f548350136f8b37ba764edda9ffe3e3426c

See more details on using hashes here.

File details

Details for the file nidataset-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: nidataset-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 84.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for nidataset-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66f857010ecd4a423769c2eb9ad9dbd25eb5021f727e0a656445deb36d16b387
MD5 ae903f2517e4d2fa17b93ddf49f07ab7
BLAKE2b-256 de6d91a459811a6c0cc6b48685468995dd5f1b7879c0ef9c1ea5ff38b790fc08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page