# optiflow
<img src="Images/optiflow_logo.png" alt="drawing" width="500"/>
**optiflow** is an algorithm designed to reconstruct **velocity fields** from **kymographs** with **optimal transport**. Indeed, optimal transport computes the velocity field of minimal work, which is relevant under a wide array of situations and does not necessitates hard physical assumptions, except for the conservation of the physical quantity that we are measuring across time.
This software is designed to offer cell biologists a simple method to obtain flow fields around a membrane contour (taking into account boundary conditions) for free, offering a quantitative measurement for a flow that can only be observed visually otherwise.
---
## Example
<img src="Images/optiflow_example.png" alt="drawing" width="500"/>
Load an instance segmentation, reconstruct its multimaterial mesh, and extract its geometry:
```shell
pip install optiflow`
```
```py
from optiflow import define_matrices, compute_displacements_from_kymograph,plot_vector_field
## Load the kymograph
import numpy as np
K = np.load("Kymograph_example.npy")
nt = len(K)
#Define the distance matrices (we use circular boundary condition) and compute the displacements
C,D = define_matrices(npoints = nt,plot=True)
V = compute_displacements_from_kymograph(K,C,D)
#Visualize
import matplotlib.pyplot as plt
vmin = min(np.abs(V.min()),V.max())
plt.imshow(V.clip(-vmin,vmin),plt.cm.bwr,extent = (0,1,0,1))
plot_vector_field(V,t=7,pool_size = 25)
```
---
### API and Documentation
#### The kymograph K
By convention, the kymograph `K` is a `nb * nt` matrix, where nb is the number of bins used to discretize the space, and nt is the number of time points.
- `define_matrices(npoints, plot=False)` computes the distance and cost matrices according to the kymograph.
- `return C,D`, where `C` is the cost matrix and `D` is the distance matrix
#### Computation of displacement fields from kymographs
- `compute_displacements_from_kymograph(K,C,D)` compute the displacement field using optimal transport
- `return V`, a `nb * (nt-1)` matrix of the velocity fields inferred.
---
**optiflow** was created by Sacha Ichbiah during his PhD in [Turlier Lab](https://www.turlierlab.com), and originated from a collaboration with Henry de Belly, with the labs of [Orion Weiner](https://weinerlab.com) and [Carlos Bustamante](https://bustamante.berkeley.edu). It is maintained by Sacha Ichbiah and Hervé Turlier. For support, please open an issue.
A preprint of the paper using this method is available on [BiorXiv](https://www.biorxiv.org/content/10.1101/2022.09.07.507005v1). The data used in the paper are available in [this repo](https://github.com/VirtualEmbryo/membrane-cortex-tension). If you use our library in your work please cite the paper :
```
@article {De Belly2022.09.07.507005,
author = {De Belly, Henry and Yan, Shannon and Borja da Rocha, Hudson and Ichbiah, Sacha and Town, Jason P and Turlier, Herv{\'e} and Bustamante, Carlos J and Weiner, Orion D},
title = {Actin-driven protrusions generate rapid long-range membrane tension propagation in cells},
elocation-id = {2022.09.07.507005},
year = {2022},
doi = {10.1101/2022.09.07.507005},
publisher = {Cold Spring Harbor Laboratory},
abstract = {Membrane tension is thought to be a long-range integrator of cell physiology. This role necessitates effective tension transmission across the cell. However, the field remains strongly divided as to whether cell membranes support or resist tension propagation, in part due to a lack of adequate tools for locally manipulating membrane tension. We overcome these limitations by leveraging optogenetics to generate localized actin-based protrusions while concurrently monitoring the propagation of membrane tension using dual-trap optical tweezers. Surprisingly, actin-driven protrusions elicit rapid global membrane tension propagation with little to no attenuation, while forces applied to the cell membrane only do not. We present a simple unifying mechanical model in which mechanical forces that act on both the membrane and actin cortex drive rapid, robust membrane tension propagation.Competing Interest StatementThe authors have declared no competing interest.},
URL = {https://www.biorxiv.org/content/early/2022/09/08/2022.09.07.507005},
eprint = {https://www.biorxiv.org/content/early/2022/09/08/2022.09.07.507005.full.pdf},
journal = {bioRxiv}}
Raw data
{
"_id": null,
"home_page": "https://github.com/sacha-ichbiah/optiflow",
"name": "optiflow",
"maintainer": "",
"docs_url": null,
"requires_python": "<3.10,>=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Sacha Ichbiah",
"author_email": "sacha.ichbiah@college-de-france.fr",
"download_url": "https://files.pythonhosted.org/packages/3c/ef/565b89adbecfaaeb86dfce27dd0fded1c026912e1480ad049573eeb122fc/optiflow-1.1.0.tar.gz",
"platform": null,
"description": "# optiflow\n<img src=\"Images/optiflow_logo.png\" alt=\"drawing\" width=\"500\"/>\n\n**optiflow** is an algorithm designed to reconstruct **velocity fields** from **kymographs** with **optimal transport**. Indeed, optimal transport computes the velocity field of minimal work, which is relevant under a wide array of situations and does not necessitates hard physical assumptions, except for the conservation of the physical quantity that we are measuring across time.\nThis software is designed to offer cell biologists a simple method to obtain flow fields around a membrane contour (taking into account boundary conditions) for free, offering a quantitative measurement for a flow that can only be observed visually otherwise.\n\n\n---\n## Example\n<img src=\"Images/optiflow_example.png\" alt=\"drawing\" width=\"500\"/>\n\n\nLoad an instance segmentation, reconstruct its multimaterial mesh, and extract its geometry:\n\n```shell\npip install optiflow`\n\n```\n\n```py\nfrom optiflow import define_matrices, compute_displacements_from_kymograph,plot_vector_field\n\n## Load the kymograph\nimport numpy as np \nK = np.load(\"Kymograph_example.npy\")\nnt = len(K)\n\n#Define the distance matrices (we use circular boundary condition) and compute the displacements\nC,D = define_matrices(npoints = nt,plot=True)\nV = compute_displacements_from_kymograph(K,C,D)\n\n#Visualize \nimport matplotlib.pyplot as plt\nvmin = min(np.abs(V.min()),V.max())\nplt.imshow(V.clip(-vmin,vmin),plt.cm.bwr,extent = (0,1,0,1))\nplot_vector_field(V,t=7,pool_size = 25)\n\n```\n---\n\n### API and Documentation\n\n#### The kymograph K \nBy convention, the kymograph `K` is a `nb * nt` matrix, where nb is the number of bins used to discretize the space, and nt is the number of time points. \n\n\n- `define_matrices(npoints, plot=False)` computes the distance and cost matrices according to the kymograph. \n - `return C,D`, where `C` is the cost matrix and `D` is the distance matrix\n\n\n#### Computation of displacement fields from kymographs\n- `compute_displacements_from_kymograph(K,C,D)` compute the displacement field using optimal transport\n\t- `return V`, a `nb * (nt-1)` matrix of the velocity fields inferred. \n\n---\n\n**optiflow** was created by Sacha Ichbiah during his PhD in [Turlier Lab](https://www.turlierlab.com), and originated from a collaboration with Henry de Belly, with the labs of [Orion Weiner](https://weinerlab.com) and [Carlos Bustamante](https://bustamante.berkeley.edu). It is maintained by Sacha Ichbiah and Herv\u00e9 Turlier. For support, please open an issue.\nA preprint of the paper using this method is available on [BiorXiv](https://www.biorxiv.org/content/10.1101/2022.09.07.507005v1). The data used in the paper are available in [this repo](https://github.com/VirtualEmbryo/membrane-cortex-tension). If you use our library in your work please cite the paper : \n\n```\n@article {De Belly2022.09.07.507005,\n\tauthor = {De Belly, Henry and Yan, Shannon and Borja da Rocha, Hudson and Ichbiah, Sacha and Town, Jason P and Turlier, Herv{\\'e} and Bustamante, Carlos J and Weiner, Orion D},\n\ttitle = {Actin-driven protrusions generate rapid long-range membrane tension propagation in cells},\n\telocation-id = {2022.09.07.507005},\n\tyear = {2022},\n\tdoi = {10.1101/2022.09.07.507005},\n\tpublisher = {Cold Spring Harbor Laboratory},\n\tabstract = {Membrane tension is thought to be a long-range integrator of cell physiology. This role necessitates effective tension transmission across the cell. However, the field remains strongly divided as to whether cell membranes support or resist tension propagation, in part due to a lack of adequate tools for locally manipulating membrane tension. We overcome these limitations by leveraging optogenetics to generate localized actin-based protrusions while concurrently monitoring the propagation of membrane tension using dual-trap optical tweezers. Surprisingly, actin-driven protrusions elicit rapid global membrane tension propagation with little to no attenuation, while forces applied to the cell membrane only do not. We present a simple unifying mechanical model in which mechanical forces that act on both the membrane and actin cortex drive rapid, robust membrane tension propagation.Competing Interest StatementThe authors have declared no competing interest.},\n\tURL = {https://www.biorxiv.org/content/early/2022/09/08/2022.09.07.507005},\n\teprint = {https://www.biorxiv.org/content/early/2022/09/08/2022.09.07.507005.full.pdf},\n\tjournal = {bioRxiv}}\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Reconstruction of flows from kymographs with optimal transport",
"version": "1.1.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "796fc55a81afa0f3ab964b4a4fcf3bb1e07cabbd014f65299af78d599ad6d2e5",
"md5": "ee5be1c555882848247a79ac72846114",
"sha256": "b03f6400d0b4fa85efd75bb35ee3856e89da8ca9fc4c4ee72d3bcb3c2f622e42"
},
"downloads": -1,
"filename": "optiflow-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ee5be1c555882848247a79ac72846114",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.10,>=3.6",
"size": 5023,
"upload_time": "2023-01-27T13:25:11",
"upload_time_iso_8601": "2023-01-27T13:25:11.170223Z",
"url": "https://files.pythonhosted.org/packages/79/6f/c55a81afa0f3ab964b4a4fcf3bb1e07cabbd014f65299af78d599ad6d2e5/optiflow-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3cef565b89adbecfaaeb86dfce27dd0fded1c026912e1480ad049573eeb122fc",
"md5": "1c44bb1b7980bff6572436100bccd496",
"sha256": "b02edf7eb469bf4cf8b4b151e93579bd0b352eb450269324f972065c4537a730"
},
"downloads": -1,
"filename": "optiflow-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "1c44bb1b7980bff6572436100bccd496",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.10,>=3.6",
"size": 5019,
"upload_time": "2023-01-27T13:25:12",
"upload_time_iso_8601": "2023-01-27T13:25:12.977529Z",
"url": "https://files.pythonhosted.org/packages/3c/ef/565b89adbecfaaeb86dfce27dd0fded1c026912e1480ad049573eeb122fc/optiflow-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-27 13:25:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "sacha-ichbiah",
"github_project": "optiflow",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "optiflow"
}