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
3ff4cecf
Commit
3ff4cecf
authored
5 years ago
by
NADAL Morgane
Browse files
Options
Downloads
Patches
Plain Diff
changed label into relabel + max - modified Filtered Maps
parent
7745e79b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
brick/__init__.py
+0
-0
0 additions, 0 deletions
brick/__init__.py
brick/component/extension.py
+2
-1
2 additions, 1 deletion
brick/component/extension.py
brick/component/soma.py
+2
-1
2 additions, 1 deletion
brick/component/soma.py
nutrimorph.py
+13
-15
13 additions, 15 deletions
nutrimorph.py
with
17 additions
and
17 deletions
brick/__init__.py
deleted
100644 → 0
+
0
−
0
View file @
7745e79b
This diff is collapsed.
Click to expand it.
brick/component/extension.py
+
2
−
1
View file @
3ff4cecf
...
...
@@ -191,8 +191,9 @@ class extension_t(glial_cmp_t):
if
region
.
area
<=
min_area_c
:
region_sites
=
(
lmp
==
region
.
label
).
nonzero
()
result
[
region_sites
]
=
0
lmp
[
region_sites
]
=
0
return
result
return
result
,
lmp
@staticmethod
def
FineMapFromCoarseMap
(
coarse_map
:
array_t
)
->
array_t
:
...
...
This diff is collapsed.
Click to expand it.
brick/component/soma.py
+
2
−
1
View file @
3ff4cecf
...
...
@@ -169,8 +169,9 @@ class soma_t(glial_cmp_t):
if
region
.
area
<=
min_area
:
region_sites
=
(
lmp
==
region
.
label
).
nonzero
()
result
[
region_sites
]
=
0
lmp
[
region_sites
]
=
0
return
result
return
result
,
lmp
@staticmethod
def
ContourMap
(
map_
:
array_t
)
->
array_t
:
...
...
This diff is collapsed.
Click to expand it.
nutrimorph.py
+
13
−
15
View file @
3ff4cecf
...
...
@@ -53,6 +53,7 @@ import matplotlib.pyplot as pl_
import
numpy
as
np_
import
skimage.io
as
io_
import
skimage.measure
as
ms_
from
skimage.segmentation
import
relabel_sequential
print
(
sy_
.
argv
,
sy_
.
argv
.
__len__
())
...
...
@@ -81,7 +82,6 @@ exec(open(sy_.argv[1]).read())
soma_t
=
sm_
.
soma_t
extension_t
=
xt_
.
extension_t
print
(
f
"
STARTED:
{
tm_
.
strftime
(
'
%a, %b %d %Y @ %H
:
%
M
:
%
S
'
)
}
"
)
start_time
=
tm_
.
time
()
...
...
@@ -93,12 +93,12 @@ image = io_.imread(data_path)
# Image size verification - simple version without user interface
image
=
in_
.
ImageVerification
(
image
,
channel
)
# TODO make a user friendly interface (PySide2) BUT bug with the importation of Shiboken2 on Windows8.1
# TODO make a user friendly interface (PySide2) BUT bug with the importation of Shiboken2 on Windows8.1
.
image
=
image
[:,
512
:,
512
:]
# 562
img_shape
=
image
.
shape
pl_
.
matshow
(
image
[
image
.
shape
[
0
]
//
2
,:,:])
pl_
.
show
()
#
pl_.matshow(image[image.shape[0] // 2,
:,
:])
#
pl_.show()
#
# max_img = image.max()
# image.fill(image.min())
...
...
@@ -110,7 +110,6 @@ image_for_soma = in_.NormalizedImage(image)
image_for_ext
=
in_
.
NormalizedImage
(
image
)
print
(
f
"
NRM-IMG: t.
{
image_for_soma
.
dtype
}
m.
{
image_for_soma
.
min
()
:
.
2
f
}
M.
{
image_for_soma
.
max
()
:
.
2
f
}
"
)
# --- Initialization
som_nfo
=
{}
ext_nfo
=
{}
...
...
@@ -126,9 +125,11 @@ axes = {}
print
(
"
\n
--- Soma Detection
"
)
som_nfo
[
"
map
"
]
=
soma_t
.
Map
(
image_for_soma
,
soma_low_c
,
soma_high_c
,
soma_selem_c
)
som_nfo
[
"
map
"
]
=
soma_t
.
FilteredMap
(
som_nfo
[
"
map
"
],
min_area_c
)
#TODO: change label into relabel + max
som_nfo
[
"
lmp
"
],
n_somas
=
ms_
.
label
(
som_nfo
[
"
map
"
],
return_num
=
True
)
som_nfo
[
"
map
"
],
som_lmp
=
soma_t
.
FilteredMap
(
som_nfo
[
"
map
"
],
min_area_c
)
# som_nfo["lmp"], n_somas= ms_.label(som_nfo["map"], return_num=True)
som_nfo
[
"
lmp
"
]
=
relabel_sequential
(
som_lmp
)[
0
]
# Use relabel instead of label to optimize the algorithm.
n_somas
=
som_nfo
[
"
lmp
"
].
max
()
som_nfo
[
"
dist_to_closest
"
],
som_nfo
[
"
influence_map
"
]
=
soma_t
.
InfluenceMaps
(
som_nfo
[
"
lmp
"
]
)
...
...
@@ -143,16 +144,17 @@ print(f"\nElapsed Time={tm_.strftime('%Hh %Mm %Ss', elapsed_time)}")
if
with_plot
:
fb_
.
PlotSomas
(
somas
,
som_nfo
,
axes
)
# -- Extentions
print
(
"
\n
--- Extension Detection
"
)
enhanced_ext
,
ext_scales
=
extension_t
.
EnhancedForDetection
(
image_for_ext
,
in_parallel
=
in_parallel
)
ext_nfo
[
"
coarse_map
"
]
=
extension_t
.
CoarseMap
(
enhanced_ext
,
ext_low_c
,
ext_high_c
)
ext_nfo
[
"
coarse_map
"
]
=
extension_t
.
FilteredCoarseMap
(
ext_nfo
[
"
coarse_map
"
])
ext_nfo
[
"
coarse_map
"
]
,
ext_lmp
=
extension_t
.
FilteredCoarseMap
(
ext_nfo
[
"
coarse_map
"
])
ext_nfo
[
"
map
"
]
=
extension_t
.
FineMapFromCoarseMap
(
ext_nfo
[
"
coarse_map
"
])
ext_nfo
[
"
map
"
][
som_nfo
[
"
map
"
]
>
0
]
=
0
ext_nfo
[
"
lmp
"
],
n_extensions
=
ms_
.
label
(
ext_nfo
[
"
map
"
],
return_num
=
True
)
# ext_nfo["lmp"], n_extensions = ms_.label(ext_nfo["map"], return_num=True)
ext_nfo
[
"
lmp
"
]
=
relabel_sequential
(
ext_lmp
)[
0
]
# Use relabel instead of label to optimize the algorithm.
n_extensions
=
ext_nfo
[
"
lmp
"
].
max
()
extensions
=
tuple
(
extension_t
().
FromMap
(
ext_nfo
[
"
lmp
"
],
ext_scales
,
uid
)
...
...
@@ -165,11 +167,9 @@ print(f"\nElapsed Time={tm_.strftime('%Hh %Mm %Ss', elapsed_time)}")
if
with_plot
:
fb_
.
PlotExtensions
(
extensions
,
ext_nfo
,
img_shape
)
# -- Preparation for Connections
dijkstra_costs
=
in_
.
DijkstraCosts
(
image
,
som_nfo
[
"
map
"
],
ext_nfo
[
"
map
"
])
# -- Soma-Extention
print
(
"
\n
--- Soma <-> Extension
"
)
...
...
@@ -205,7 +205,6 @@ print(f"\nElapsed Time={tm_.strftime('%Hh %Mm %Ss', elapsed_time)}")
if
with_plot
:
fb_
.
PlotSomasWithExtensions
(
somas
,
som_nfo
,
"
all
"
)
# -- Extention-Extention
print
(
"
\n
--- Extension <-> Extension
"
)
...
...
@@ -248,7 +247,6 @@ print(f"\nElapsed Time={tm_.strftime('%Hh %Mm %Ss', elapsed_time)}")
if
with_plot
:
fb_
.
PlotSomasWithExtensions
(
somas
,
som_nfo
,
"
with_ext_of_ext
"
)
# -- Summary
print
(
"
\n
"
)
for
soma
in
somas
:
...
...
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