Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f8daab34 authored by CERUTTI Guillaume's avatar CERUTTI Guillaume
Browse files

use image edge flip function

parent 45d47a83
No related branches found
No related tags found
No related merge requests found
Pipeline #928405 failed
......@@ -13,7 +13,7 @@ from copy import deepcopy
import numpy as np
from cellcomplex.property_topomesh.optimization import property_topomesh_edge_flip_optimization
from timagetk_geometry.image_surface.tissue_image_mesh import surface_tissue_mesh_image_edge_flip_optimization
# {# gnomon, plugin.class
......@@ -46,37 +46,12 @@ class surfaceCellMeshFlipOptimization(gnomon.core.gnomonAbstractMeshFilter):
# implement the run method
if self['iterations']>0:
vertex_cells = surface_topomesh.wisp_property('label', 0)
unique_cells = np.unique(vertex_cells.values())
cell_vertices = {c: [] for c in unique_cells}
for v, c in vertex_cells.items():
cell_vertices[c] += [v]
seg_img = self.seg_img[time]
image_cell_edges = np.array([w for w in seg_img.wall_ids()])
image_edges = []
for c1, c2 in image_cell_edges:
if c1 in cell_vertices and c2 in cell_vertices:
image_edges += [
(v1, v2)
for v1 in cell_vertices[c1] for v2 in cell_vertices[c2]
]
image_edges += [
(v2, v1)
for v1 in cell_vertices[c1] for v2 in cell_vertices[c2]
]
image_edges = np.array(image_edges)
omega_energies = {'image': 1}
if self['regularization'] > 0:
omega_energies.update({'regularization': self['regularization']})
property_topomesh_edge_flip_optimization(
surface_topomesh = surface_tissue_mesh_image_edge_flip_optimization(
surface_topomesh,
seg_img,
iterations=self['iterations'],
omega_energies=omega_energies,
simulated_annealing=False,
image_edges=image_edges
regularization_weight=self['regularization']
)
self.surface_topomesh[time] = surface_topomesh
......@@ -53,7 +53,9 @@ class surfaceMeshCellProjection(gnomon.core.gnomonAbstractMeshFilter):
method=self['method']
)
if self['remove_isolated_labels']:
surface_vertex_remove_isolated_labels(surface_topomesh)
surface_vertex_remove_isolated_labels(
surface_topomesh,
background_only=not self['remove_isolated_labels']
)
self.surface_topomesh[time] = surface_topomesh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment