normalize_image#
- omnipose.utils.normalize_image(im, mask, target=0.5, foreground=False, iterations=1, scale=1, channel_axis=0)[source]#
Normalize image by rescaling from 0 to 1 and then adjusting gamma to bring average background to specified value (0.5 by default).
- Parameters
im (ndarray, float) -- input image or volume
mask (ndarray, int or bool) -- input labels or foreground mask
target (float) -- target background/foreground value in the range 0-1
channel_axis (int) -- the axis that contains the channels
- Return type
gamma-normalized array with a minimum of 0 and maximum of 1