Skip to main content

intensity-normalization

PyPI Docs

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 methodszscore, fcm, kde, whitestripe: plain functions of one image.
  • Population methodsnyul, 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

Documentationquickstart, 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

intensity_normalization-4.0.0.tar.gz (535.1 kB view details)

Uploaded Source

Built Distribution

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

intensity_normalization-4.0.0-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

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

Hashes for intensity_normalization-4.0.0.tar.gz
Algorithm Hash digest
SHA256 68a3b25b97f1364b074d0babac29491a8c2eab87280d3203da6f4a01023b6484
MD5 cf951c590f21d8b70407bf52cdd233f7
BLAKE2b-256 65d96f7034b2e9dbe231b10a20eeb7e9e7e698c4c8f878c4e7c705741a86941c

See more details on using hashes here.

Provenance

The following attestation bundles were made for intensity_normalization-4.0.0.tar.gz:

Publisher: publish.yml on jcreinhold/intensity-normalization

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file intensity_normalization-4.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for intensity_normalization-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8604060b93078b7105e13645a34ad1d4c9dcf3c83b4bb8fb361593221d2a4bc2
MD5 5241a7d135d1a2b1282468945263d857
BLAKE2b-256 85bd2ef49ee424dc3fa5493fcf6d1b3d5de68e150a45acba63350ea39a9d8f39

See more details on using hashes here.

Provenance

The following attestation bundles were made for intensity_normalization-4.0.0-py3-none-any.whl:

Publisher: publish.yml on jcreinhold/intensity-normalization

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 files

3.0.1

2 files

3.0.0

2 files

2.2.4

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.4

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.4.5

2 files

1.4.4

2 files

0.3.1

2 files

0.3.0

2 files

Supported by

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