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