Commit d0cd038e authored by Jean-Yves TINEVEZ's avatar Jean-Yves TINEVEZ
Browse files

Plot tissue local curvature with a nice colormap.

parent f915ca9a
......@@ -68,8 +68,11 @@ dpr = deproj.from_heightmap( ...
inpaint_zeros, ...
prune_zeros );
%% Plot euler angles.
%% Plot morphological parameters.
close all
plot_fit_plane( dpr );
% plot_fit_plane( dpr );
% plot_fit_ellipse( dpr );
[ hf, ax1, ax2, ax3 ] = plot_curvatures( dpr );
function hts = add_plot_curvature_gauss( obj, ax )
%ADD_PLOT_CURVATURE_GAUSS Add the tissue plot colored with the Gaussian curvature.
epicells = obj.epicells;
curvs = vertcat( epicells.curvatures );
gauss_curv = curvs( :, 2 );
hts = add_plot_variable( obj, gauss_curv, ax );
end
function hts = add_plot_curvature_k1( obj, ax )
%ADD_PLOT_CURVATURE_K1 Add the tissue plot colored with the first principal curvature.
epicells = obj.epicells;
curvs = vertcat( epicells.curvatures );
k1_curv = curvs( :, 3 );
hts = add_plot_variable( obj, k1_curv, ax );
end
function hts = add_plot_curvature_k2( obj, ax )
%ADD_PLOT_CURVATURE_K2 Add the tissue plot colored with the first principal curvature.
epicells = obj.epicells;
curvs = vertcat( epicells.curvatures );
k2_curv = curvs( :, 4 );
hts = add_plot_variable( obj, k2_curv, ax );
end
function hts = add_plot_curvature_mean( obj, ax )
%ADD_PLOT_CURVATURE_MEAN Add the tissue plot colored with the mean curvature.
epicells = obj.epicells;
curvs = vertcat( epicells.curvatures );
mean_curv = curvs( :, 1 );
hts = add_plot_variable( obj, mean_curv, ax );
end
function cmap = cmap_seismic()
%CMAP_SEISMIC Returns the seismic colormap.
cmap = [
0 0 0.4980
0 0 0.5142
0 0 0.5304
0 0 0.5466
0 0 0.5628
0 0 0.5790
0 0 0.5952
0 0 0.6114
0 0 0.6276
0 0 0.6438
0 0 0.6600
0 0 0.6762
0 0 0.6923
0 0 0.7085
0 0 0.7247
0 0 0.7409
0 0 0.7571
0 0 0.7733
0 0 0.7895
0 0 0.8057
0 0 0.8219
0 0 0.8381
0 0 0.8543
0 0 0.8705
0 0 0.8867
0 0 0.9028
0 0 0.9190
0 0 0.9352
0 0 0.9514
0 0 0.9676
0 0 0.9838
0 0 1.0000
0.0104 0.0104 1.0000
0.0208 0.0208 1.0000
0.0312 0.0312 1.0000
0.0417 0.0417 1.0000
0.0521 0.0521 1.0000
0.0625 0.0625 1.0000
0.0729 0.0729 1.0000
0.0833 0.0833 1.0000
0.0938 0.0938 1.0000
0.1042 0.1042 1.0000
0.1146 0.1146 1.0000
0.1250 0.1250 1.0000
0.1354 0.1354 1.0000
0.1458 0.1458 1.0000
0.1562 0.1562 1.0000
0.1667 0.1667 1.0000
0.1771 0.1771 1.0000
0.1875 0.1875 1.0000
0.1979 0.1979 1.0000
0.2083 0.2083 1.0000
0.2188 0.2188 1.0000
0.2292 0.2292 1.0000
0.2396 0.2396 1.0000
0.2500 0.2500 1.0000
0.2604 0.2604 1.0000
0.2708 0.2708 1.0000
0.2812 0.2812 1.0000
0.2917 0.2917 1.0000
0.3021 0.3021 1.0000
0.3125 0.3125 1.0000
0.3229 0.3229 1.0000
0.3333 0.3333 1.0000
0.3438 0.3438 1.0000
0.3542 0.3542 1.0000
0.3646 0.3646 1.0000
0.3750 0.3750 1.0000
0.3854 0.3854 1.0000
0.3958 0.3958 1.0000
0.4062 0.4062 1.0000
0.4167 0.4167 1.0000
0.4271 0.4271 1.0000
0.4375 0.4375 1.0000
0.4479 0.4479 1.0000
0.4583 0.4583 1.0000
0.4688 0.4688 1.0000
0.4792 0.4792 1.0000
0.4896 0.4896 1.0000
0.5000 0.5000 1.0000
0.5104 0.5104 1.0000
0.5208 0.5208 1.0000
0.5312 0.5312 1.0000
0.5417 0.5417 1.0000
0.5521 0.5521 1.0000
0.5625 0.5625 1.0000
0.5729 0.5729 1.0000
0.5833 0.5833 1.0000
0.5938 0.5938 1.0000
0.6042 0.6042 1.0000
0.6146 0.6146 1.0000
0.6250 0.6250 1.0000
0.6354 0.6354 1.0000
0.6458 0.6458 1.0000
0.6562 0.6562 1.0000
0.6667 0.6667 1.0000
0.6771 0.6771 1.0000
0.6875 0.6875 1.0000
0.6979 0.6979 1.0000
0.7083 0.7083 1.0000
0.7188 0.7188 1.0000
0.7292 0.7292 1.0000
0.7396 0.7396 1.0000
0.7500 0.7500 1.0000
0.7604 0.7604 1.0000
0.7708 0.7708 1.0000
0.7812 0.7812 1.0000
0.7917 0.7917 1.0000
0.8021 0.8021 1.0000
0.8125 0.8125 1.0000
0.8229 0.8229 1.0000
0.8333 0.8333 1.0000
0.8438 0.8438 1.0000
0.8542 0.8542 1.0000
0.8646 0.8646 1.0000
0.8750 0.8750 1.0000
0.8854 0.8854 1.0000
0.8958 0.8958 1.0000
0.9062 0.9062 1.0000
0.9167 0.9167 1.0000
0.9271 0.9271 1.0000
0.9375 0.9375 1.0000
0.9479 0.9479 1.0000
0.9583 0.9583 1.0000
0.9688 0.9688 1.0000
0.9792 0.9792 1.0000
0.9896 0.9896 1.0000
1.0000 1.0000 1.0000
1.0000 0.9922 0.9922
1.0000 0.9844 0.9844
1.0000 0.9766 0.9766
1.0000 0.9688 0.9688
1.0000 0.9609 0.9609
1.0000 0.9531 0.9531
1.0000 0.9453 0.9453
1.0000 0.9375 0.9375
1.0000 0.9297 0.9297
1.0000 0.9219 0.9219
1.0000 0.9141 0.9141
1.0000 0.9062 0.9062
1.0000 0.8984 0.8984
1.0000 0.8906 0.8906
1.0000 0.8828 0.8828
1.0000 0.8750 0.8750
1.0000 0.8672 0.8672
1.0000 0.8594 0.8594
1.0000 0.8516 0.8516
1.0000 0.8438 0.8438
1.0000 0.8359 0.8359
1.0000 0.8281 0.8281
1.0000 0.8203 0.8203
1.0000 0.8125 0.8125
1.0000 0.8047 0.8047
1.0000 0.7969 0.7969
1.0000 0.7891 0.7891
1.0000 0.7812 0.7812
1.0000 0.7734 0.7734
1.0000 0.7656 0.7656
1.0000 0.7578 0.7578
1.0000 0.7500 0.7500
1.0000 0.7422 0.7422
1.0000 0.7344 0.7344
1.0000 0.7266 0.7266
1.0000 0.7188 0.7188
1.0000 0.7109 0.7109
1.0000 0.7031 0.7031
1.0000 0.6953 0.6953
1.0000 0.6875 0.6875
1.0000 0.6797 0.6797
1.0000 0.6719 0.6719
1.0000 0.6641 0.6641
1.0000 0.6562 0.6562
1.0000 0.6484 0.6484
1.0000 0.6406 0.6406
1.0000 0.6328 0.6328
1.0000 0.6250 0.6250
1.0000 0.6172 0.6172
1.0000 0.6094 0.6094
1.0000 0.6016 0.6016
1.0000 0.5938 0.5938
1.0000 0.5859 0.5859
1.0000 0.5781 0.5781
1.0000 0.5703 0.5703
1.0000 0.5625 0.5625
1.0000 0.5547 0.5547
1.0000 0.5469 0.5469
1.0000 0.5391 0.5391
1.0000 0.5312 0.5312
1.0000 0.5234 0.5234
1.0000 0.5156 0.5156
1.0000 0.5078 0.5078
1.0000 0.5000 0.5000
1.0000 0.4922 0.4922
1.0000 0.4844 0.4844
1.0000 0.4766 0.4766
1.0000 0.4688 0.4688
1.0000 0.4609 0.4609
1.0000 0.4531 0.4531
1.0000 0.4453 0.4453
1.0000 0.4375 0.4375
1.0000 0.4297 0.4297
1.0000 0.4219 0.4219
1.0000 0.4141 0.4141
1.0000 0.4062 0.4062
1.0000 0.3984 0.3984
1.0000 0.3906 0.3906
1.0000 0.3828 0.3828
1.0000 0.3750 0.3750
1.0000 0.3672 0.3672
1.0000 0.3594 0.3594
1.0000 0.3516 0.3516
1.0000 0.3438 0.3438
1.0000 0.3359 0.3359
1.0000 0.3281 0.3281
1.0000 0.3203 0.3203
1.0000 0.3125 0.3125
1.0000 0.3047 0.3047
1.0000 0.2969 0.2969
1.0000 0.2891 0.2891
1.0000 0.2812 0.2812
1.0000 0.2734 0.2734
1.0000 0.2656 0.2656
1.0000 0.2578 0.2578
1.0000 0 0
0.9844 0 0
0.9689 0 0
0.9533 0 0
0.9377 0 0
0.9222 0 0
0.9066 0 0
0.8911 0 0
0.8755 0 0
0.8599 0 0
0.8444 0 0
0.8288 0 0
0.8132 0 0
0.7977 0 0
0.7821 0 0
0.7665 0 0
0.7510 0 0
0.7354 0 0
0.7199 0 0
0.7043 0 0
0.6887 0 0
0.6732 0 0
0.6576 0 0
0.6420 0 0
0.6265 0 0
0.6109 0 0
0.5953 0 0
0.5798 0 0
0.5642 0 0
0.5487 0 0
0.5331 0 0
0.5175 0 0
0.5020 0 0];
end
......@@ -72,7 +72,7 @@ classdef deproj
end
%% Public static methods: builders.
%% Public static methods: builders & util.
methods ( Access = public, Hidden = false, Static = true )
% Returns the Z position of points taken from a height-map.
......@@ -84,6 +84,9 @@ classdef deproj
invert_z, ...
inpaint_zeros, ...
prune_zeros );
% Returns the seismic colormap.
cmap = cmap_seismic();
end
%% Private static methods: utilities.
......
function [ hf, ax1, ax2, ax3 ] = plot_curvatures( obj, scale_bar_length )
%PLOT_CURVATURES Figure with the local curvaure for a collection of epicells.
if nargin < 2
scale_bar_length = 10;
end
hf = figure( 'Position', [ 1204 20 600 1000 ] );
ax1 = subplot( 3, 1, 1 );
hold on
axis equal
add_plot_curvature_mean( obj, ax1 );
ax2 = subplot( 3, 1, 2 );
hold on
axis equal
add_plot_curvature_k1( obj, ax2 );
ax3 = subplot( 3, 1, 3 );
hold on
axis equal
add_plot_curvature_k2( obj, ax3 );
% Collect min & max.
cl1 = get( ax1, 'CLim' );
cl2 = get( ax2, 'CLim' );
cl3 = get( ax3, 'CLim' );
min1 = cl1( 1 );
max1 = cl1( 2 );
min2 = cl2( 1 );
max2 = cl2( 2 );
min3 = cl3( 1 );
max3 = cl3( 2 );
minc = max( abs( [ min1, min2, min3 ] ) );
maxc = max( abs( [ max1, max2, max3 ] ) );
ml = max( [ minc, maxc ] );
set( ax1, 'CLim', [ -ml, ml ] )
set( ax2, 'CLim', [ -ml, ml ] )
set( ax3, 'CLim', [ -ml, ml ] )
cmap = deproj.cmap_seismic();
colormap( ax1, cmap )
colormap( ax2, cmap )
colormap( ax3, cmap )
colorbar(ax3, 'Location', 'EastOutside' )
add_plot_scalebar( obj, scale_bar_length, ax3 );
axis( ax1, 'off' )
axis( ax2, 'off' )
axis( ax3, 'off' )
title( ax1, 'Local mean curvature', ...
'FontWeight', 'normal' )
title( ax2, 'First principal curvature' , ...
'FontWeight', 'normal' )
title( ax3, 'Second principal curvature' , ...
'FontWeight', 'normal' )
linkaxes( [ ax3 ax2 ax1 ] )
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment