diff --git a/RunExample.m b/RunExample.m index 267bfe2c9ea0c4b883f44ae00ff1067f242c12ad..5eebb53c4588c0c92815e3fed17d08f5d9e271ea 100755 --- a/RunExample.m +++ b/RunExample.m @@ -71,8 +71,9 @@ dpr = deproj.from_heightmap( ... %% Plot morphological parameters. close all +plot_sizes( dpr ); % plot_fit_plane( dpr ); % plot_fit_ellipse( dpr ); -[ hf, ax1, ax2, ax3 ] = plot_curvatures( dpr ); +% plot_curvatures( dpr ); diff --git a/src/@deproj/add_plot_area.m b/src/@deproj/add_plot_area.m new file mode 100644 index 0000000000000000000000000000000000000000..e85c011211f80400698edd2ee9fe4d0c502af7f2 --- /dev/null +++ b/src/@deproj/add_plot_area.m @@ -0,0 +1,9 @@ +function hts = add_plot_area( obj, ax ) +%ADD_PLOT_AREA Add the tissue plot colored with the cell area. + + epicells = obj.epicells; + areas = vertcat( epicells.area ); + + hts = add_plot_variable( obj, areas, ax ); +end + diff --git a/src/@deproj/add_plot_perimeter.m b/src/@deproj/add_plot_perimeter.m new file mode 100644 index 0000000000000000000000000000000000000000..3f0434725193812737db3c6c296a209694cbeea4 --- /dev/null +++ b/src/@deproj/add_plot_perimeter.m @@ -0,0 +1,9 @@ +function hts = add_plot_perimeter( obj, ax ) +%ADD_PLOT_PERIMETER Add the tissue plot colored with the cell perimeter. + + epicells = obj.epicells; + perims = vertcat( epicells.perimeter ); + + hts = add_plot_variable( obj, perims, ax ); +end + diff --git a/src/@deproj/deproj.m b/src/@deproj/deproj.m index 5b0232025c416e21c9a2207abfe1306ff5f09a67..29c33a1c1f221b37ef1257663d648e1c43b477eb 100644 --- a/src/@deproj/deproj.m +++ b/src/@deproj/deproj.m @@ -34,6 +34,9 @@ classdef deproj % Figure with the local curvaure for a collection of epicells. [ hf, ax1, ax2, ax3 ] = plot_curvatures( obj, scale_bar_length ) + % Figure with the cells area and perimeter. + [ hf, ax1, ax2 ] = plot_sizes( obj, scale_bar_length ) + %% Helpers. % They are public in case of. @@ -69,6 +72,12 @@ classdef deproj % Add the tissue plot colored with the second principal curvature. hts = add_plot_curvature_k2( obj, ax ) + + % Add the tissue plot colored with the cell area. + hts = add_plot_area( obj, ax ) + + % Add the tissue plot colored with the cell perimeter. + hts = add_plot_perimeter( obj, ax ) end diff --git a/src/@deproj/plot_sizes.m b/src/@deproj/plot_sizes.m new file mode 100644 index 0000000000000000000000000000000000000000..61f80ad63169978ff775f2e3354f8769cb99b8fb --- /dev/null +++ b/src/@deproj/plot_sizes.m @@ -0,0 +1,36 @@ +function [ hf, ax1, ax2 ] = plot_sizes( obj, scale_bar_length ) +%PLOT_SIZES Figure with the cells area and perimeter. + + if nargin < 2 + scale_bar_length = 10; + end + + hf = figure( 'Position', [ 1204 20 600 650 ] ); + + ax1 = subplot( 2, 1, 1 ); + hold on + axis equal + add_plot_area( obj, ax1 ); + colorbar + + ax2 = subplot( 2, 1, 2 ); + hold on + axis equal + add_plot_perimeter( obj, ax2 ); + colorbar + + add_plot_scalebar( obj, scale_bar_length, ax2 ); + + axis( ax1, 'off' ) + axis( ax2, 'off' ) + + title( ax1, sprintf('Cell area (%s²)', obj.units), ... + 'FontWeight', 'normal', ... + 'Interpreter', 'none' ) + title( ax2, sprintf('Cell perimeter (%s)', obj.units), ... + 'FontWeight', 'normal', ... + 'Interpreter', 'none' ) + + linkaxes( [ ax2 ax1 ] ) +end +