Z-score normalize

normalizeZScore - Z-score normalization


Normalizes the image time series as z-scores.

Description


This function normalizes image series to have zero mean and unit standard deviation over the time domain. This function has no parameters.

Input


This function accepts image time series with dimensions Y, X and T, or image time series split by events with dimensions Y, X, T and E, either as a numeric array or as a .dat file. UMT structs and .umt files are not supported.

When the input is a .dat file, it is streamed in slabs (Low-RAM mode), so the recording is never loaded whole.

The algorithm


For each pixel, the z-score is calculated as the pixel value minus it's time average divided by the standard deviation. For event-split data, the statistics are computed separately for every event instance (E slice), so each trial is normalized over its own frames.

Give the signal S(i,t), for each pixel i, the z-score is calculated as:

zScoreNormalize_eq1

where Si(t) is the pixel value for a given time t, zScoreNormalize_inline_var is the time average of the signal while the SD is the temporal standard deviation. The time average is calculated as:

zScoreNormalize_eq2

and the standard deviation as:

zScoreNormalize_eq3

Output


Image time series data with temporal mean equal to zero and unit standard deviation, with the same axes and sizes as the input. The output has the same representation as the input: a numeric array for an array input, or the normZ.dat file (saved in the save folder) for a .dat input.

Note
NaN values are ignored when computing the mean and standard deviation. For a constant time trace, the standard deviation is set to 1 to avoid a division by zero. Every E slice is normalized, including ignored event instances, so the E axis of the output still matches events.mat.


Back to top

Copyright © LabeoTech 2026. This work is licensed under the GNU General Public License, Version 3.0.