Normalize intensity values in 3D image stacks.
pip install intensipy
`
1. Intensify3D
Python implementation of the Intensify3D algorithm originally developed by Yoyan et al. There are some minor adjustments:
- Semi-quantile normalization is the only Z-normalization method currently implemented.
- Pixels that are quantile normalized are optionally smoothed using they Savitzky-Galoy method outlined in the original paper. In practice this was necessary to reduce artefact noise.
- Tissue detection is not currently supported.
- By default, contrast stretching is performed by
skimage.exposure.rescale_intensity()
. To perform contrast stretching as implemented by the original Intensify3D, setstretch_method='intensify3d'
- If no maximum background intensity threshold
t
is provided,t
will be estimated for each slice using Otsu's method.
import numpy as np
import matplotlib.pyplot as plt
from intensipy import Intensify
# decreasing average intensity as z increases.
img_stack = 1 / np.arange(1, 6)[:, np.newaxis, np.newaxis]\
* np.random.randint(0, 255, (5, 512, 512))
for each in img_stack:
plt.imshow(each, vmin=img_stack.min(), vmax=img_stack.max(), cmap='gray')
plt.show()
model = Intensify()
out = model.normalize(img_stack)
for each in out:
plt.imshow(each, vmin=out.min(), vmax=out.max(), cmap='gray')
plt.show()
1.Yayon, N. et al. Intensify3D: Normalizing signal intensity in large heterogenic image stacks. Scientific Reports 8, 4311 (2018).