sarcgraph.sg.SarcGraph.sarcomere_detection
- SarcGraph.sarcomere_detection(file_path=None, raw_frames=None, segmented_zdiscs=None, tracked_zdiscs=None, sigma=1.0, min_length=8, tp_depth=4.0, full_track_ratio=0.75, skip_merging=False, c_avg_length=1, c_angle=1, c_diff_length=1, l_avg=12.0, score_threshold=0.01, angle_threshold=1.2, save_output=True)[source]
Detect sarcomeres in a video/image. The input could be the address to the video/image sample (
file_path), raw frames as a numpy array (raw_frames), segmented zdiscs information in a pandas dataframe (segmented_zdiscs), or a dataframe of tracked zdiscs (tracked_zdiscs).- Parameters:
file_path (str) – The address of an image or a video file to be loaded
raw_frames (np.ndarray, shape=(frames, dim_1, dim_2, channels)) – Raw input image or video given as a 4 dimensional array
segmented_zdiscs (pd.DataFrame) – Information of all detected zdiscs in every frame.
tracked_zdiscs (pd.DataFrame) – Information of tracked zdiscs
sigma (float) – Standard deviation for Gaussian kernel, by default
1.0min_length (int) – Minimum length for zdisc contours measured in pixels, by default
8tp_depth (float, optional) – the maximum distance features can move between frames, by default
4.0full_track_ratio (float, optional) – Frame ratio to seperate partially tracked vs fully tracked sarcomeres, by default
0.75skip_merging (bool, optional) – skipping the merging step will result in fewer fully tracked zdiscs, by default
Falsec_avg_length (float, optional) – comparison of the length of a connection with
l_avgaffects the connection score,c_avg_lengthsets the relative effect of this score metric compared to the other two, by default1.0c_angle (float, optional) – the angle between a connection and its neighboring connections affects the connection score,
c_anglesets the relative effect of this score metric compared to the other two, by default1.0c_length_diff (float, optional) – comparison of the length of a connection with the length of all neighboring connections affects the score,
c_length_diffsets the relative effect of this score metric compared to the other two, by default1.0l_avg (float, optional) – an initial guess for the average length of sarcomeres in pixels, by default
15.0score_threshold (float) – any connection with a score less than the threshold will be removed, by default
0.1angle_threshold (float) – if a zdisc has two valid connection the angle between must be higher than the theshold, otherwise the connection with a lower score will be removed, by default
1.2(in radians)save_output (bool) – by default
True
- Returns:
pd.DataFrame – Detected sarcomeres information. Columns are
'frame'(frame number),'sarc_id'(sarcomere id),'zdiscs'(particle id of the two zdiscs forming a sarcomere),'x'and'y'(sarcomere center position),'length','width', and'angle'(sarcomere length, width, and angle).List[nx.Graph] – A list of graphs each indicating connected sarcomeres (myofibrils)
Notes
For a detailed description of the Trackpy package check: http://soft-matter.github.io/trackpy/v0.5.0/tutorial.html
For a detailed description of the OPTICS algorithm check: https://scikit-learn.org/stable/modules/generated/sklearn.cluster.OPTICS.html