Skip to content

Latest commit

 

History

101 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

Packages

Used by

Contributors

Languages