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

Unsuccessfully optimize text method.

I tried to group all the texts in one single graphic object, but it
does not work. 'text' create one text object per position whatever
you do.
So the text plotting routines are still slow.
parent 9ba652e2
function hts = add_plot_ids( obj, ax )
%ADD_PLOT_IDS Add the epicell ids to the specified plot axes.
epicells = obj.epicells;
n_objects = numel( epicells );
hts = NaN( n_objects, 1 );
for i = 1 : n_objects
o = epicells( i );
center = double( o.center );
hts(i ) = text( ax, ...
center(1), center(2), center(3) + 0.5, ...
num2str( o.id ), ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle', ...
'Clipping', 'on' );
end
texts = num2cell( vertcat( obj.epicells.id ) );
hts = obj.plot_text( texts, ax );
end
......@@ -72,7 +72,9 @@ classdef deproj
% Plot the tissue with the cell contour approximated by the junctions, colored by the specified values.
hts = plot_values_junction( obj, values, ax )
% Plot text at cell centers.
hts = plot_text( obj, texts, ax )
end
%% Public static methods: builders & util.
......
function hts = plot_text( obj, texts, ax )
%PLOT_TEXT Plot text at cell centers.
C = double( vertcat( obj.epicells.center ) );
X = C( :, 1 );
Y = C( :, 2 );
Z = C( :, 3 ) + 0.5;
hts = text( ax, X, Y, Z, texts, ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle', ...
'Clipping', 'on', ...
'Interpreter', 'none', ...
'FontSize', 9 );
end
Markdown is supported
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