From 2a8ebe99da46ca920a724ff39c15fe0539eef18d Mon Sep 17 00:00:00 2001
From: Guillaume Cerutti <guillaume.cerutti@inria.fr>
Date: Sat, 10 Feb 2024 10:35:29 +0100
Subject: [PATCH] ensure contiguous element ids after decimation...

---
 .../meshFilter/surfaceCellMeshDecimation.py          | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/gnomon_package_tissueimagemesh/algorithm/meshFilter/surfaceCellMeshDecimation.py b/src/gnomon_package_tissueimagemesh/algorithm/meshFilter/surfaceCellMeshDecimation.py
index bd66fb3..3a6115e 100644
--- a/src/gnomon_package_tissueimagemesh/algorithm/meshFilter/surfaceCellMeshDecimation.py
+++ b/src/gnomon_package_tissueimagemesh/algorithm/meshFilter/surfaceCellMeshDecimation.py
@@ -11,6 +11,9 @@ from gnomon.utils.decorators import meshInput, meshOutput
 
 from timagetk_geometry.image_surface.tissue_image_mesh import surface_tissue_mesh_collapse_same_label_edges
 
+from cellcomplex.property_topomesh.analysis import compute_topomesh_property
+from cellcomplex.property_topomesh.extraction import contiguous_wisps_topomesh
+
 
 # {# gnomon, plugin.class
 # do not modify, any code after the gnomon tag will be overwritten
@@ -41,6 +44,15 @@ class surfaceCellMeshDecimation(gnomon.core.gnomonAbstractMeshFilter):
                 in_surface_topomesh
             )
 
+            surface_topomesh = contiguous_wisps_topomesh(surface_topomesh)
+
+            compute_topomesh_property(surface_topomesh, 'vertices', 1)
+            compute_topomesh_property(surface_topomesh, 'length', 1)
+            compute_topomesh_property(surface_topomesh, 'borders', 2)
+            compute_topomesh_property(surface_topomesh, 'vertices', 2)
+            compute_topomesh_property(surface_topomesh, 'oriented_vertices', 2)
+            compute_topomesh_property(surface_topomesh, 'oriented_borders', 3)
+
             print(surface_topomesh.nb_wisps(0))
             print(surface_topomesh.wisp_property('label', 0))
 
-- 
GitLab