optimap.activationΒΆ

Activation map computation module.

optimap.activation.compute_activation_map(video, threshold=0.5, inverted=False, fps=None, set_nan_for_inactive=True, show=True, cmap='jet')[source]ΒΆ

Computes an activation map (or isochrone map) from a given video based on pixel intensity thresholding.

For each pixel in the video, the function determines the time (or frame index) at which the pixel’s intensity first surpasses (or falls below, if inverted is set to True) the specified threshold.

If fps is specified, time is giving in milliseconds, otherwise, it is given in frames.

Parameters:
  • video (np.ndarray) – A 3D array representing the video, with dimensions {t (time or frames), x (width), y (height)}.

  • threshold (float, optional) – Intensity threshold at which a pixel is considered activated. Defaults to 0.5.

  • inverted (bool, optional) – If True, the function will compute the time/frame when pixel intensity falls below the threshold, rather than surpassing it. Defaults to False.

  • fps (float, optional) – If provided, the resulting activation map will represent times in milliseconds based on this frame rate, otherwise, it will be in frames.

  • set_nan_for_inactive (bool, optional) – If True, pixels that never reach the activation threshold will be set to NaN. Defaults to True.

  • show (bool, optional) – If True, the resulting activation map will be displayed. Defaults to True.

  • cmap (str, optional) – Colormap to use for displaying the activation map. Defaults to β€˜jet’.

Returns:

activation_map – 2D image

Return type:

ndarray