Skip to main content

Geometrical reconstruction of cell assemblies from instance segmentations

Project description

Delaunay-Watershed 2D

CC BY-NC-SA 4.0

drawing

Delaunay-Watershed-2D is an algorithm designed to reconstruct a sparse representation of the geometry of tissues and cell nuclei from instance segmentations, in 2D. It accomplishes this by building multimaterial meshes from segmentation masks. These multimaterial meshes are perfectly suited for storage, geometrical analysis, sharing and visualisation of data. We provide high level APIs to extract geometrical features from the meshes, as well as visualisation tools based on matplotlib (2D). Our multimaterial mesh is implemented using a Half-Edge data structure.

Delaunay-Watershed was created by Sacha Ichbiah during his PhD in Turlier Lab, and is maintained by Sacha Ichbiah, Matthieu Perez and Hervé Turlier. For support, please open an issue. A preprint of the method will be published soon. If you use our library in your work please cite the paper.

Introductory notebooks with precise use case are provided. The algorithm takes as input segmentation masks and return multimaterial polygonal lines (2D). The original raw images can be inserted optionaly for visualisation but are not used for the reconstruction.

This method is used as a backend for foambryo2d, our 2D tension inference library.

Example

Load an instance segmentation, reconstruct its multimaterial mesh, and extract its geometry:

pip install delaunay-watershed-2d
from dw2d import geometry_reconstruction_2d

## Load the labels
import skimage.io as io
labels = io.imread("data/Net_images/Masks/mask_Cells_3.tif")

## Reconstruct a multimaterial mesh from the labels
DW = geometry_reconstruction_2d(labels,expansion_labels=0, min_dist=5,original_image=img)
DW.simple_plot()

## Use the mesh to analyze the geometry:
Mesh = DW.return_dcel()
Mesh.compute_lengths()
Mesh.compute_angles()
Mesh.compute_curvatures()

Installation

pip install delaunay-watershed-2d


API and Documentation

1 - Creating a multimaterial mesh:

The first step is to convert your instance segmentation into a multimaterial mesh

  • geometry_reconstruction_2d(labels,min_dist = 4 ,interpolation_points=10,expansion_labels = 0,original_image = None): We infer tensions ratios by inverting junctional equilibrium relations
    • Mesh is a DCEL_Data object
    • mean_tension has to be defined as we only infer ratio between tensions
    • min_dist defines the minimal distance, in pixels, between two points used for the delaunay-triangulation
    • interpolation_points the number of sampling points used to estimate the value of the euclidean-distance-transform on an edge during the construction of the graph.
    • expansion_labels can be used to expand the labels and make them touch each other.
    • original_image can be used for visualization purposes
    • return DW, an object containing visualization and export utilities

2 - Visualize and export the mesh

Once a DW object is generated, we can use its methods the visualize and export the result:

  • DW:
    • self.simple_plot() offers a simple view of the segmentation
    • self.extended_plot() offers more information, but need to provide the original image
    • self.return_mesh() return (Verts,Edges_multimaterial):
      • Verts is an V x 2 numpy array of vertex positions
      • Edges_multimaterial is an F x 4 numpy array of Edges and material indices, where at each row the 2 first indices refers to a vertex and the 2 last refer to a given material, 0 being the exterior media
    • self.return_dcel() return a DCEL_Data object, i.e a Half-edge implementation of the mesh

3 - Analyze the geometry

A DCEL_Data object can be used to analyze the geometry:

  • DCEL_Data:
    • self.compute_lengths() returns a dictionnary with the values of the lengths of every interfaces
    • self.compute_angles() returns a dictionnary with the values of every angles formed by the cells (in rad)
    • self.compute_area_faces() returns a dictionnary with the values of the area of all the cells
    • self.compute_compute_curvatures() returns a dictionnary with the values of the Menger curvature of all the interfaces

Biological use-cases

Geometrical reconstruction of C.Elegans Embryo

Data from cShaper

Geometrical reconstruction of Cell Nuclei

Data from dsb2018


Credits, contact, citations

If you use this tool, please cite the associated preprint: Do not hesitate to contact Sacha Ichbiah and Hervé Turlier for practical questions and applications. We hope that Delaunay-Watershed could help biologists and physicists to shed light on the mechanical aspects of early development.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

delaunay_watershed_2d-0.1.5.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

delaunay_watershed_2d-0.1.5-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file delaunay_watershed_2d-0.1.5.tar.gz.

File metadata

  • Download URL: delaunay_watershed_2d-0.1.5.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for delaunay_watershed_2d-0.1.5.tar.gz
Algorithm Hash digest
SHA256 a18797062eadfa4a8233947a10242c4e74e60a19f686d41e3699163f52686797
MD5 49fad06195e71f544fa344fca31e0b3a
BLAKE2b-256 bad2725426e73bfed54677e4f6686852ecec3ebca7f58f4900851dd0ba85b966

See more details on using hashes here.

File details

Details for the file delaunay_watershed_2d-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for delaunay_watershed_2d-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 16d5ce84844f52308ac3380202b5c50553450554dd0ef014300ea752b883b314
MD5 559b99d7c31d0237b858031e616297b2
BLAKE2b-256 a43f54507d71d706494e3bfbd1bd1851d80a6d8fca40e6179888517880462f4b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page