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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intensity_normalization-4.0.0.tar.gz.
File metadata
- Download URL: intensity_normalization-4.0.0.tar.gz
- Upload date:
- Size: 535.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68a3b25b97f1364b074d0babac29491a8c2eab87280d3203da6f4a01023b6484
|
|
| MD5 |
cf951c590f21d8b70407bf52cdd233f7
|
|
| BLAKE2b-256 |
65d96f7034b2e9dbe231b10a20eeb7e9e7e698c4c8f878c4e7c705741a86941c
|
Provenance
The following attestation bundles were made for intensity_normalization-4.0.0.tar.gz:
Publisher:
publish.yml on jcreinhold/intensity-normalization
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intensity_normalization-4.0.0.tar.gz -
Subject digest:
68a3b25b97f1364b074d0babac29491a8c2eab87280d3203da6f4a01023b6484 - Sigstore transparency entry: 2335685407
- Sigstore integration time:
-
Permalink:
jcreinhold/intensity-normalization@50531a3f03bfcdd63bd6d83310e63bbd58262dc8 -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/jcreinhold
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@50531a3f03bfcdd63bd6d83310e63bbd58262dc8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file intensity_normalization-4.0.0-py3-none-any.whl.
File metadata
- Download URL: intensity_normalization-4.0.0-py3-none-any.whl
- Upload date:
- Size: 47.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8604060b93078b7105e13645a34ad1d4c9dcf3c83b4bb8fb361593221d2a4bc2
|
|
| MD5 |
5241a7d135d1a2b1282468945263d857
|
|
| BLAKE2b-256 |
85bd2ef49ee424dc3fa5493fcf6d1b3d5de68e150a45acba63350ea39a9d8f39
|
Provenance
The following attestation bundles were made for intensity_normalization-4.0.0-py3-none-any.whl:
Publisher:
publish.yml on jcreinhold/intensity-normalization
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intensity_normalization-4.0.0-py3-none-any.whl -
Subject digest:
8604060b93078b7105e13645a34ad1d4c9dcf3c83b4bb8fb361593221d2a4bc2 - Sigstore transparency entry: 2335685418
- Sigstore integration time:
-
Permalink:
jcreinhold/intensity-normalization@50531a3f03bfcdd63bd6d83310e63bbd58262dc8 -
Branch / Tag:
refs/tags/v4.0.0 - Owner: https://github.com/jcreinhold
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@50531a3f03bfcdd63bd6d83310e63bbd58262dc8 -
Trigger Event:
release
-
Statement type: