intensity-normalization
Normalize the intensities of magnetic resonance (MR) images — T1-w, T2-w, FLAIR, PD-w — across scanners, sites, and sessions.
MR images have no consistent intensity scale; the inconsistency is an acquisition artifact that breaks downstream processing (especially ML). This package implements the standard fixes:
- Individual methods —
zscore,fcm,kde,whitestripe: plain functions of one image. - Population methods —
nyul,lsq,ravel: learn a transform from a set of images; save it, apply it to new scans. - Tools — tissue membership maps, histogram plotting (validation), N4 preprocessing, co-registration (ANTs).
Install
pip install intensity-normalization # or: uv add intensity-normalization
pip install "intensity-normalization[ants]" # ravel registration, preprocess, coregister
pip install "intensity-normalization[plot]" # histogram plotting
The CLI also runs without installing: uvx intensity-normalize --help.
Quickstart
import intensity_normalization as inorm
normed = inorm.whitestripe(t1w_image, mask=brain_mask) # numpy or nibabel in → same type out
tx = inorm.nyul.fit(train_images, masks=train_masks) # population: fit once...
tx.save("nyul.npz")
normed_new = tx(new_image) # ...apply to new scans
intensity-normalize fcm t1w.nii.gz -m brain_mask.nii.gz -p
intensity-normalize nyul images/ -m masks/ -o normalized/ --save-state nyul.npz
Documentation — quickstart, how-to guides, choosing a method, algorithms, CLI, API, migrating to v4.
Reference
If you use this package, please cite the accompanying pre-print:
@article{reinhold2019evaluating,
title={Evaluating the impact of intensity normalization on MR image synthesis},
author={Reinhold, Jacob C and Dewey, Blake E and Carass, Aaron and Prince, Jerry L},
journal={Medical Imaging 2019: Image Processing},
year={2019}
}
License
MIT
Metadata
Release files for intensity-normalization 4.0.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 | |
|---|---|---|---|
| intensity_normalization-4.0.0.tar.gz | 535.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| intensity_normalization-4.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 582.6 kB
Release files / intensity_normalization-4.0.0.tar.gz
| Download URL | intensity_normalization-4.0.0.tar.gz |
|---|---|
| Size | 535.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68a3b25b97f1364b074d0babac29491a8c2eab87280d3203da6f4a01023b6484
|
|
BLAKE2b-256 checksum How to use checksums |
65d96f7034b2e9dbe231b10a20eeb7e9e7e698c4c8f878c4e7c705741a86941c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / intensity_normalization-4.0.0-py3-none-any.whl
| Download URL | intensity_normalization-4.0.0-py3-none-any.whl |
|---|---|
| Size | 47.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8604060b93078b7105e13645a34ad1d4c9dcf3c83b4bb8fb361593221d2a4bc2
|
|
BLAKE2b-256 checksum How to use checksums |
85bd2ef49ee424dc3fa5493fcf6d1b3d5de68e150a45acba63350ea39a9d8f39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency log