Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IAH public
DeProj
Commits
06b7ea29
Commit
06b7ea29
authored
Jul 07, 2020
by
Jean-Yves TINEVEZ
Browse files
Integrate routine to plot ellipses in @deproj class.
parent
9d5a498d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/@deproj/add_ellipse_variable.m
0 → 100644
View file @
06b7ea29
function
hts
=
add_ellipse_variable
(
obj
,
values
,
ax
)
%ADD_ELLIPSE_VARIABLE Plots the ellipses, colored by the specified values.
epicells
=
obj
.
epicells
;
n_objects
=
numel
(
epicells
);
hts
=
NaN
(
n_objects
,
1
);
minv
=
min
(
values
);
maxv
=
max
(
values
);
colors
=
hsv
(
256
);
idx
=
@
(
v
)
1
+
round
(
(
v
-
minv
)/(
maxv
-
minv
)
*
(
size
(
colors
,
1
)
-
1
)
);
for
i
=
1
:
n_objects
o
=
epicells
(
i
);
h
=
o
.
plot_ellipse_3d
(
23
,
ax
);
hts
(
i
)
=
h
;
val
=
values
(
i
);
j
=
idx
(
val
);
set
(
h
,
...
'Color'
,
colors
(
j
,
:
),
...
'LineWidth'
,
2
)
end
end
src/@deproj/deproj.m
View file @
06b7ea29
...
...
@@ -46,6 +46,10 @@ classdef deproj
% Plots the boundaries as patches, colored by the specified values.
hts
=
add_plot_variable
(
obj
,
values
,
ax
)
%Plots the ellipses, colored by the specified values.
hts
=
add_ellipse_variable
(
obj
,
values
,
ax
)
end
%% Public static methods: builders.
...
...
src/@deproj/plot_fit_ellipse.m
View file @
06b7ea29
function
[
hf
,
hc
,
he
]
=
plot_fit_ellipse
(
obj
,
scale_bar_length
)
function
[
hf
,
he
]
=
plot_fit_ellipse
(
obj
,
scale_bar_length
)
%PLOT_FIT_ELLIPSE Plot the 2D ellipses on the tissue surface.
epicells
=
obj
.
epicells
;
if
nargin
<
2
scale_bar_length
=
10
;
end
...
...
@@ -10,51 +9,18 @@ function [ hf, hc, he ] = plot_fit_ellipse( obj, scale_bar_length )
hold
on
axis
equal
n_obj
=
numel
(
epicells
);
hc
=
NaN
(
n_obj
,
1
);
he
=
NaN
(
n_obj
,
1
);
for
i
=
1
:
n_obj
o
=
epicells
(
i
);
v
=
epicell
.
euleurZXZ2rot
(
o
.
euler_angles
);
% hc( i ) = o.plot_contour_3d;
he
(
i
)
=
epicell
.
plot_ellipse_3d
(
o
.
ellipse_fit
,
v
);
% TODO set colormap, pass it to colorbar and set caxis limits from
% values. And does this all automatically.
% Ellipse semi-major axis arrow.
x0
=
o
.
ellipse_fit
(
1
);
y0
=
o
.
ellipse_fit
(
2
);
z0
=
o
.
ellipse_fit
(
3
);
a
=
o
.
ellipse_fit
(
4
);
theta
=
o
.
ellipse_fit
(
6
);
% In ellipse referential.
arrow_x
=
[
-
a
;
a
];
arrow_y
=
[
0
;
0
];
Ar0
=
[
arrow_x
,
arrow_y
];
% In epicell plane referential.
R
=
[
cos
(
theta
)
sin
(
theta
)
;
-
sin
(
theta
)
cos
(
theta
)
]
;
Ar1
=
Ar0
*
R
;
values
=
rad2deg
(
[
obj
.
epicells
.
proj_direction
]
'
);
he
=
add_ellipse_variable
(
obj
,
values
,
gca
);
add_plot_scalebar
(
obj
,
scale_bar_length
,
gca
);
arrow_z
=
[
0
;
0
];
Ar1b
=
[
Ar1
arrow_z
];
% In main referential.
Ar2
=
Ar1b
*
v
'
;
line
(
...
Ar2
(:,
1
)
+
x0
,
...
Ar2
(:,
2
)
+
y0
,
...
Ar2
(:,
3
)
+
z0
,
...
'Marker'
,
'.'
,
...
'Color'
,
'k'
)
end
axis
(
gca
,
'off'
)
colorbar
(
gca
)
set
(
he
,
'Color'
,
'k'
)
add_plot_scalebar
(
obj
,
scale_bar_length
,
gca
)
;
title
(
gca
,
'Main orientation of cell (º)'
,
...
'FontWeight'
,
'normal'
)
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment