sarcgraph.sg_tools.SarcGraphTools.Analysis

class SarcGraphTools.Analysis(sg_tools)[source]

Provides tools for post processing analysis of detected sarcomeres.

Methods

compute_F_J([adjust_reference])

Compute the average deformation gradient (F) and its jacobian (J) for the whole movie.

compute_OOP()

Computes Orientation Order Parameter (OOP) for the whole movie.

compute_metrics([frame])

This function computes the following metrics as defind in the paper: {OOP, C_iso, C_OOP, s_til, s_avg}.

compute_ts_params()

Compute and save timeseries time constants (contraction time, relaxation time, flat time, period, offset, etc.).

create_spatial_graph([file_path, tracked_zdiscs])

Generates and saves a spatial graph of tracked zdiscs where edges indicate sarcomeres and edge weights indicates the ratio of the frames in which that sarcomere is detected

compute_F_J(adjust_reference=False)[source]

Compute the average deformation gradient (F) and its jacobian (J) for the whole movie.

Parameters:

adjust_reference (bool, by default False) – The refrence frame by default is the first frame of the movie, if this variable is set to True the function will run twice and the refrence frame on the second run will be the most contracted frame

Returns:

The average deformation gradient (F), shape=(num_frames, 2, 2) The jacobian of F, shape=(num_frames)

Return type:

Tuple(np.ndarray, np.ndarray)

compute_OOP()[source]

Computes Orientation Order Parameter (OOP) for the whole movie.

Returns:

OOP for all frames, shape=(num_frames) OOP vector for all frames, shape=(num_frames, 2)

Return type:

Tuple[np.ndarray, np.ndarray]

compute_metrics(frame=None)[source]

This function computes the following metrics as defind in the paper: {OOP, C_iso, C_OOP, s_til, s_avg}.

Parameters:

frame (int, optional) – By default is set to the frame with maximum contraction

Notes

See the paper for more information: https://arxiv.org/abs/2102.02412

Return type:

dict

compute_ts_params()[source]

Compute and save timeseries time constants (contraction time, relaxation time, flat time, period, offset, etc.).

Return type:

pd.DataFrame

create_spatial_graph(file_path=None, tracked_zdiscs=None)[source]

Generates and saves a spatial graph of tracked zdiscs where edges indicate sarcomeres and edge weights indicates the ratio of the frames in which that sarcomere is detected

Parameters:
  • file_path (str) – The address of an image or a video file to be loaded

  • tracked_zdiscs (pd.DataFrame) – Information of all detected and tracked zdiscs in every frame.