neuralib.imaging.widefield.svd

class neuralib.imaging.widefield.svd.SequenceSingularVector[source]

A NamedTuple that represents a singular value decomposition result from image sequences

Dimension parameters:

W = image width

H = image height

F = number of image frame (sequence)

C = number of components after SVD reduction

svd: TruncatedSVD

Dimensionality reduction using truncated SVD

right_vector: ndarray

Temporal structure (right singular vectors). Array[float, [F, C]]

static __new__(_cls, svd, right_vector, left_vector)

Create new instance of SequenceSingularVector(svd, right_vector, left_vector)

Parameters:
  • svd (TruncatedSVD)

  • right_vector (ndarray)

  • left_vector (ndarray)

left_vector: ndarray

Spatial structure (left singular vectors). Array[float, [W * H, C]]

property singular_value: ndarray

The singular values corresponding to each of the selected components, represent the strength/energy of each component. Array[float, C]

neuralib.imaging.widefield.svd.compute_singular_vector(sequences, n_components=128, **kwargs)[source]

Performs truncated singular value decomposition (SVD) on a sequence of image frames to extract dominant spatial and temporal components.

Parameters:
  • sequences (ndarray) – A numpy array representing a collection of image frames in a sequence. It has a shape of (n_frames, width, height) where ‘n_frames’ is the number of frames, and ‘width’ and ‘height’ are the dimensions of each frame.

  • n_components (int) – An integer representing the number of components for Truncated SVD. The default value is 128.

  • kwargs – Keyword arguments passed to TruncatedSVD().

Returns:

A SequenceSingularVector object containing the singular values, the transformed components, and the left singular vectors.

Return type:

SequenceSingularVector