Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NutriMorph
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DEBREUVE Eric
NutriMorph
Commits
6f64d820
Commit
6f64d820
authored
4 years ago
by
NADAL Morgane
Browse files
Options
Downloads
Patches
Plain Diff
solved bug: singular matrices in best fitting ellipsoid
parent
1e026ed9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
brick/processing/best_fit_ellipsoid.py
+2
-2
2 additions, 2 deletions
brick/processing/best_fit_ellipsoid.py
brick/processing/graph_feat_extraction.py
+24
-16
24 additions, 16 deletions
brick/processing/graph_feat_extraction.py
with
26 additions
and
18 deletions
brick/processing/best_fit_ellipsoid.py
+
2
−
2
View file @
6f64d820
...
...
@@ -56,7 +56,7 @@ def ls_ellipsoid(xx: array_t, yy: array_t, zz: array_t) -> array_t: # finds the
return
(
ellipsoid_coef
)
except
:
print
(
"
Singular matrix, cannot find the best fitting ellipsoid.
"
)
print
(
"
WARNING:
Singular matrix, cannot find the best fitting ellipsoid.
The soma will probably be deleted in the resulting table.
\n
"
)
return
(
np_
.
zeros
(
9
))
...
...
@@ -179,7 +179,7 @@ def FindBestFittingEllipsoid3D(soma: soma_t) -> tuple:
# # get ellipsoid polynomial coefficients
ellipsoid_coef
=
ls_ellipsoid
(
convex_hull
[
0
],
convex_hull
[
1
],
convex_hull
[
2
])
if
ellipsoid_coef
==
(
np_
.
zeros
(
9
))
:
if
ellipsoid_coef
.
all
()
==
0
:
return
ellipsoid_coef
,
"
NaN
"
,
"
NaN
"
,
"
NaN
"
,
"
NaN
"
,
"
NaN
"
,
"
NaN
"
else
:
...
...
This diff is collapsed.
Click to expand it.
brick/processing/graph_feat_extraction.py
+
24
−
16
View file @
6f64d820
...
...
@@ -293,22 +293,30 @@ def ExtractFeaturesInDF(name_file, somas, size_voxel_in_micron: list, bins_lengt
_
,
_
,
soma
.
axes_ellipsoid
,
_
,
spherical_coor
,
_
,
volume_convex_hull
=
bf_
.
FindBestFittingEllipsoid3D
(
soma
)
# This ratios give info about the shape of the soma. ex: rather flat, rather patatoide, rather spherical...
Coef_axes_ellips_b__a
=
soma
.
axes_ellipsoid
[
0
]
/
soma
.
axes_ellipsoid
[
2
]
Coef_axes_ellips_c__a
=
soma
.
axes_ellipsoid
[
1
]
/
soma
.
axes_ellipsoid
[
2
]
# Spherical angles give the orientation of the somas in the 3D volume
spherical_angles_eva
=
(
spherical_coor
[
0
][
1
],
spherical_coor
[
0
][
2
])
spherical_angles_evb
=
(
spherical_coor
[
1
][
1
],
spherical_coor
[
1
][
2
])
# Volume of the in micron**3
soma
.
volume_soma_micron
=
in_
.
ToMicron
(
len
(
soma
.
sites
[
0
]),
size_voxel_in_micron
,
dimension
=
(
0
,
1
,
2
),
decimals
=
2
)
# Calculates volume of soma's convex hull in voxel volume
# Take into account anisotropy of the 3D space ( volume = x * y * z with z > x=y)
volume_convex_hull
=
volume_convex_hull
*
size_voxel_in_micron
[
2
]
/
size_voxel_in_micron
[
0
]
# Volume of the soma / Volume of its convex hull gives the info about the convexity of the soma
# If close to 0, the soma has a lot of invaginations, if close to 1, it is smooth and convex
Coef_V_soma__V_convex_hull
=
len
(
soma
.
sites
[
0
])
/
round
(
volume_convex_hull
+
0.5
)
if
type
(
soma
.
axes_ellipsoid
[
0
])
is
str
:
Coef_axes_ellips_b__a
=
None
Coef_axes_ellips_c__a
=
None
spherical_angles_eva
=
None
spherical_angles_evb
=
None
soma
.
volume_soma_micron
=
None
Coef_V_soma__V_convex_hull
=
None
else
:
Coef_axes_ellips_b__a
=
soma
.
axes_ellipsoid
[
0
]
/
soma
.
axes_ellipsoid
[
2
]
Coef_axes_ellips_c__a
=
soma
.
axes_ellipsoid
[
1
]
/
soma
.
axes_ellipsoid
[
2
]
# Spherical angles give the orientation of the somas in the 3D volume
spherical_angles_eva
=
(
spherical_coor
[
0
][
1
],
spherical_coor
[
0
][
2
])
spherical_angles_evb
=
(
spherical_coor
[
1
][
1
],
spherical_coor
[
1
][
2
])
# Volume of the in micron**3
soma
.
volume_soma_micron
=
in_
.
ToMicron
(
len
(
soma
.
sites
[
0
]),
size_voxel_in_micron
,
dimension
=
(
0
,
1
,
2
),
decimals
=
2
)
# Calculates volume of soma's convex hull in voxel volume
# Take into account anisotropy of the 3D space ( volume = x * y * z with z > x=y)
volume_convex_hull
=
volume_convex_hull
*
size_voxel_in_micron
[
2
]
/
size_voxel_in_micron
[
0
]
# Volume of the soma / Volume of its convex hull gives the info about the convexity of the soma
# If close to 0, the soma has a lot of invaginations, if close to 1, it is smooth and convex
Coef_V_soma__V_convex_hull
=
len
(
soma
.
sites
[
0
])
/
round
(
volume_convex_hull
+
0.5
)
# -- Extension features
# Graph features
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment