From 079601d262272a839101fbf50656327c70dbaf58 Mon Sep 17 00:00:00 2001 From: Jean-Yves TINEVEZ <jean-yves.tinevez@pasteur.fr> Date: Mon, 27 Jul 2020 09:27:12 +0200 Subject: [PATCH] plot_values_junction: plot the tissue using the junction graph. --- src/@deproj/deproj.m | 8 ++++++-- src/@deproj/plot_values_junction.m | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/@deproj/plot_values_junction.m diff --git a/src/@deproj/deproj.m b/src/@deproj/deproj.m index 5207220..87e451e 100644 --- a/src/@deproj/deproj.m +++ b/src/@deproj/deproj.m @@ -28,8 +28,8 @@ classdef deproj %% Conversion between MATLAB objects. - % Returns the faces and vertices of a deproj collection. - [ V, F ] = to_vertices_and_faces( obj ) + % Returns the faces and vertices of the junction graph of a instance. + [ V, F ] = graph_to_VF( obj ) % Returns the cells boundary polygons as 3 matrices padded by NaNs. [ X, Y, Z ] = to_matrices( obj ) @@ -65,6 +65,10 @@ classdef deproj % Plot the tissue with cells as ellipses, colored by the specified values. hts = plot_values_ellipse( obj, values, ax ) + + % Plot the tissue with the cell contour approximated by the junctions, colored by the specified values. + hts = plot_values_junction( obj, values, ax ) + end diff --git a/src/@deproj/plot_values_junction.m b/src/@deproj/plot_values_junction.m new file mode 100644 index 0000000..1423d83 --- /dev/null +++ b/src/@deproj/plot_values_junction.m @@ -0,0 +1,18 @@ +function hts = plot_values_junction( obj, values, ax ) +%PLOT_VALUES_JUNCTION Plot the tissue with the cell contour approximated by the junctions, colored by the specified values. + + [ V, F ] = obj.graph_to_VF(); + + n_objects = numel( obj.epicells ); + if n_objects > 1000, lw = 1; else, lw = 2; end + + hts = patch( ... + 'Faces', F, ... + 'Vertices', V, ... + 'FaceVertexCData', values, ... + 'FaceColor', 'flat', ... + 'LineWidth', lw, ... + 'Parent', ax ); + +end + -- GitLab