Package: delaunay-watershed-2d
Delaunay-Watershed 2DDelaunay-Watershed-2Dis 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 forstorage, geometrical analysis, sharingandvisualisation 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 aHalf-Edgedata structure.Delaunay-Watershed was created by Sacha Ichbiah during his PhD inTurlier 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 forfoambryo2d, our 2D tension inference library.ExampleLoad an instance segmentation, reconstruct its multimaterial mesh, and extract its geometry:pipinstalldelaunay-watershed-2dfromdw2dimportgeometry_reconstruction_2d## Load the labelsimportskimage.ioasiolabels=io.imread("data/Net_images/Masks/mask_Cells_3.tif")## Reconstruct a multimaterial mesh from the labelsDW=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()Installationpip install delaunay-watershed-2dAPI and Documentation1 - Creating a multimaterial mesh:The first step is to convert your instance segmentation into a multimaterial meshgeometry_reconstruction_2d(labels,min_dist = 4 ,interpolation_points=10,expansion_labels = 0,original_image = None):
We infer tensions ratios by inverting junctional equilibrium relationsMeshis aDCEL_Dataobjectmean_tensionhas to be defined as we only infer ratio between tensionsmin_distdefines the minimal distance, in pixels, between two points used for the delaunay-triangulationinterpolation_pointsthe number of sampling points used to estimate the value of the euclidean-distance-transform on an edge during the construction of the graph.expansion_labelscan be used to expand the labels and make them touch each other.original_imagecan be used for visualization purposesreturn DW, an object containing visualization and export utilities2 - Visualize and export the meshOnce aDWobject is generated, we can use its methods the visualize and export the result:DW:self.simple_plot()offers a simple view of the segmentationself.extended_plot()offers more information, but need to provide the original imageself.return_mesh()return(Verts,Edges_multimaterial):Vertsis an V x 2 numpy array of vertex positionsEdges_multimaterialis 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 mediaself.return_dcel()return aDCEL_Dataobject, i.e a Half-edge implementation of the mesh3 - Analyze the geometryADCEL_Dataobject can be used to analyze the geometry:DCEL_Data:self.compute_lengths()returns a dictionnary with the values of the lengths of every interfacesself.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 cellsself.compute_compute_curvatures()returns a dictionnary with the values of the Menger curvature of all the interfacesBiological use-casesGeometrical reconstruction of C.Elegans EmbryoData fromcShaperGeometrical reconstruction of Cell NucleiData fromdsb2018Credits, contact, citationsIf 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 thatDelaunay-Watershedcould help biologists and physicists to shed light on the mechanical aspects of early development.LicenseThis work is licensed under aCreative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.