{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# SarcGraphTools - Visualization\n", "\n", "All demos are availble on GitHub at https://github.com/Sarc-Graph/sarcgraph/tree/main/tutorials.\n", "\n", "To run demos with `jupyter notebook` check [Installation Guide](https://sarc-graph.readthedocs.io/en/latest/installation.html).\n", "\n", "SarcGraph includes the tools for visualization of recovered sarcomere characteristics.\n", "\n", "In this notebook we provide a tutorial on how to use the SarcGraph package using demos and examples. The focus is on the ``SarcGraphTools.Visualization`` class in the ``sg_tools`` module." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Initialization" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Run [SarcGraphTools - Analysis Tutorial](https://sarc-graph.readthedocs.io/en/latest/tutorial/analysis.html) or [t3-analysis.ipynb](https://github.com/Sarc-Graph/sarcgraph/blob/main/tutorials/t3-analysis.ipynb) Before running this notebook. This will generate the following files in the directory specified by ``output_dir`` in the tutorial file:\n", "\n", "- ``raw_frames.npy``\n", "- ``contours.npy``\n", "- ``sarcomeres_gpr.csv``\n", "- ``recovered_F.npy``\n", "- ``recovered_J.npy``\n", "- ``recovered_OOP.npy``\n", "- ``recovered_OOP_vector.npy``\n", "- ``recovered_metrics.json``\n", "- ``spatial-graph.pkl``\n", "- ``spatial-graph-pos.pkl``\n", "- ``time_series_params.csv``" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Create an instance of the ``sg_tools.SarcGraphTools`` class and set ``input_dir`` to the same directory that contains the above files:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from sarcgraph.sg_tools import SarcGraphTools\n", "\n", "# Increase the quality to get better looking graphs\n", "sg_tools = SarcGraphTools(input_dir='../tutorial-results', quality=50)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Visualization of Recovered Information" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Here is a list of available functions in the ``SarcGraphTools.Visualization`` class:\n", "\n", "- ``zdiscs_and_sarcs()``: Visualizes detected z-discs and sarcomeres in one frame\n", "\n", "- ``contraction()``: Visualizes all detected sarcomeres in every frame saved as a gif file\n", "\n", "- ``normalized_sarcs_length()``: Plots normalized length of all sarcomeres versus frame number\n", "\n", "- ``OOP()``: Plots the recovered Orientational Order Parameter\n", "\n", "- ``F()``: Plots the recovered deformation gradient\n", "\n", "- ``J()``: Plots the recovered deformation gradient determinant\n", "\n", "- ``F_eigenval_animation()``: Visualizes the eigenvalues of U over all frames\n", "\n", "- ``timeseries_params()``: Visualizes timeseries parameters\n", "\n", "- ``dendrogram()``: Clusters timeseries and plots as a dendrogram of clusters\n", "\n", "- ``spatial_graph()``: Visualizes the spatial graph\n", "\n", "- ``tracked_vs_untracked()``: Visualizes some metrics to compare sarcomere detection with and without tracking\n", "\n", "**Note**\n", "\n", "Check the reference api for [SarcGraphTools](https://sarc-graph.readthedocs.io/en/latest/reference/sg_tools.html)\n", "\n", "" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "