Skip to content
GitLab
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
3f686dc3
Commit
3f686dc3
authored
Jul 26, 2020
by
Jean-Yves TINEVEZ
Browse files
Include curvature computation in the from_bellaiche import.
parent
6ca0ca5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/@deproj/from_bellaiche.m
View file @
3f686dc3
...
...
@@ -18,11 +18,26 @@ function obj = from_bellaiche( ...
fprintf
(
'Loading and processing the tissue mesh file.\n'
)
tic
V
=
deproj
.
ply_read
(
mesh_file_path
);
[
V
,
F
]
=
deproj
.
ply_read
(
mesh_file_path
);
si
=
scatteredInterpolant
(
V
(:,
1
),
V
(:,
2
),
V
(:,
3
),
'linear'
,
'nearest'
);
fprintf
(
'Loaded %d vertices in %.1f seconds.\n'
,
size
(
V
,
1
),
toc
)
%% Compute local curvature from the height-map.
tic
fprintf
(
'Computing tissue local curvature.\n'
)
[
H
,
min_y
,
min_x
]
=
deproj
.
mesh_to_heightmap
(
V
,
pixel_size
);
% We need to compute a smoothing scale for H, lest the curvature values
% will have strong discontinuities along the edges of the mesh.
med_area
=
median
(
face_areas
(
V
,
F
)
);
% um^2
faces_scale
=
2
*
sqrt
(
med_area
)/
pi
*
pixel_size
;
% pixel units
[
curvMean
,
curvGauss
,
curvK1
,
curvK2
]
=
deproj
.
compute_curvatures
(
...
H
,
...
faces_scale
,
...
pixel_size
);
fprintf
(
'Done in %.1f seconds.\n'
,
toc
)
%% Build the junction graph.
...
...
@@ -66,6 +81,7 @@ function obj = from_bellaiche( ...
P
=
double
(
[
x
y
]
);
P
=
deproj
.
find_countour
(
P
);
P
=
P
*
pixel_size
;
center
=
mean
(
P
);
% Get Z from the mesh.
z
=
si
(
P
);
...
...
@@ -74,8 +90,13 @@ function obj = from_bellaiche( ...
% Get the junction ids.
junction_ids
=
cells
.
vertices
{
i
};
% Get center position with respect to crvature image.
xc
=
round
(
center
(
1
)
/
pixel_size
)
-
min_x
;
yc
=
round
(
center
(
2
)
/
pixel_size
)
-
min_y
;
curvatures
=
[
curvMean
(
yc
,
xc
),
curvGauss
(
yc
,
xc
),
curvK1
(
yc
,
xc
),
curvK2
(
yc
,
xc
)
];
id
=
cells
.
numbers
(
i
);
epicells
(
i
-
1
)
=
epicell
(
boundary
,
junction_ids
,
id
);
epicells
(
i
-
1
)
=
epicell
(
boundary
,
junction_ids
,
id
,
curvatures
);
end
...
...
@@ -85,5 +106,14 @@ function obj = from_bellaiche( ...
obj
=
deproj
(
epicells
,
junction_graph
,
units
);
function
areas
=
face_areas
(
V
,
F
)
vec_a
=
V
(
F
(:,
2
),
:)
-
V
(
F
(:,
1
),
:);
vec_b
=
V
(
F
(:,
3
),
:)
-
V
(
F
(:,
1
),
:);
vec_c
=
cross
(
vec_a
,
vec_b
,
2
);
areas
=
1
/
2
*
sum
(
sqrt
(
sum
(
vec_c
.*
vec_c
,
2
)
)
);
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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