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
NADAL Morgane
NutriMorph
Commits
222db8a0
Commit
222db8a0
authored
5 years ago
by
DEBREUVE Eric
Browse files
Options
Downloads
Patches
Plain Diff
some refactoring
parent
8e25ca73
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
connection.py
+1
-1
1 addition, 1 deletion
connection.py
main.py
+2
-2
2 additions, 2 deletions
main.py
soma.py
+15
-54
15 additions, 54 deletions
soma.py
with
18 additions
and
57 deletions
connection.py
+
1
−
1
View file @
222db8a0
...
...
@@ -32,7 +32,7 @@ def CandidateConnections(
return
candidate_conn_nfo
def
ShortestPathTo
(
def
ShortestPath
From
To
N
(
point
:
site_h
,
costs
:
array_t
,
candidate_points_fct
:
Callable
,
...
...
This diff is collapsed.
Click to expand it.
main.py
+
2
−
2
View file @
222db8a0
...
...
@@ -100,7 +100,7 @@ candidate_conn_nfo = cn_.CandidateConnections(
for
ep_idx
,
soma
,
extension
,
end_point
in
candidate_conn_nfo
:
if
extension
.
is_unconnected
:
print
(
f
"
Soma.
{
soma
.
uid
}
<-?-> Ext.
{
extension
.
uid
}
(
{
ep_idx
}
)
"
,
end
=
""
)
path
,
length
=
cn_
.
ShortestPathTo
(
path
,
length
=
cn_
.
ShortestPath
From
To
N
(
end_point
,
costs
,
soma
.
ContourPointsCloseTo
,
...
...
@@ -142,7 +142,7 @@ while should_look_for_connections:
for
ep_idx
,
soma
,
extension
,
end_point
in
candidate_conn_nfo
:
if
extension
.
is_unconnected
:
print
(
f
"
Soma.
{
soma
.
uid
}
<-?-> Ext.
{
extension
.
uid
}
(
{
ep_idx
}
)
"
,
end
=
""
)
path
,
length
=
cn_
.
ShortestPathTo
(
path
,
length
=
cn_
.
ShortestPath
From
To
N
(
end_point
,
costs
,
soma
.
ExtensionPointsCloseTo
,
...
...
This diff is collapsed.
Click to expand it.
soma.py
+
15
−
54
View file @
222db8a0
...
...
@@ -73,13 +73,7 @@ class soma_t(glial_cmp_t):
if
(
np_
.
subtract
(
point
,
contour_point
)
**
2
).
sum
()
<=
max_distance
)
if
points
.
__len__
()
>
0
:
points_as_picker
=
tuple
(
zip
(
*
points
))
else
:
points
=
None
points_as_picker
=
None
return
points
,
points_as_picker
return
__PointsCloseTo__
(
points
)
def
ExtensionPointsCloseTo
(
self
,
point
:
site_h
,
max_distance
:
float
...
...
@@ -96,54 +90,8 @@ class soma_t(glial_cmp_t):
for
ext_point
in
ext_sites
if
(
np_
.
subtract
(
point
,
ext_point
)
**
2
).
sum
()
<=
max_distance
)
points
=
tuple
(
points
)
if
points
.
__len__
()
>
0
:
points_as_picker
=
tuple
(
zip
(
*
points
))
else
:
points
=
None
points_as_picker
=
None
return
points
,
points_as_picker
# def Extend(
# self, extensions: Sequence[extension_t], dist_to_soma: array_t, costs: array_t
# ) -> None:
# #
# candidate_ext_nfo = [] # eps=end points
# for extension in extensions:
# new_candidates = extension.EndPointsForSoma(self.uid)
# candidate_ext_nfo.extend(
# (end_point, extension) for end_point in new_candidates
# )
# candidate_ext_nfo.sort(key=lambda elm: dist_to_soma[elm[0]])
# unconnected_candidates = list(
# filter(lambda elm: elm[1].soma_uid is None, candidate_ext_nfo)
# )
#
# should_look_for_connections = True
# while should_look_for_connections:
# som_ext_path_nfos = []
# for ep_idx, (ext_end_point, extension) in enumerate(unconnected_candidates):
# path, length = self.ShortestPathTo(
# extension.uid, ext_end_point, ep_idx, costs
# )
# if length <= max_weighted_dist:
# som_ext_path_nfos.append(
# som_ext_path_t(
# extension=extension, length=length, path=path, idx=ep_idx
# )
# )
# if path.__len__() == 2:
# break
#
# if som_ext_path_nfos.__len__() > 0:
# som_ext_path_nfos.sort(key=lambda nfo: nfo.length)
# shorest_path = som_ext_path_nfos[0]
# self.ExtendWith(shorest_path.extension, shorest_path.path, costs)
# del unconnected_candidates[shorest_path.idx]
# else:
# should_look_for_connections = False
return
__PointsCloseTo__
(
tuple
(
points
))
def
BackReferenceSoma
(
self
,
glial_cmp
:
glial_cmp_t
)
->
None
:
#
...
...
@@ -252,6 +200,19 @@ class soma_t(glial_cmp_t):
return
result
def
__PointsCloseTo__
(
points
:
Tuple
[
site_h
,
...]
)
->
Tuple
[
Optional
[
Tuple
[
site_h
,
...]],
Optional
[
py_array_picker_h
]]:
#
if
points
.
__len__
()
>
0
:
points_as_picker
=
tuple
(
zip
(
*
points
))
else
:
points
=
None
points_as_picker
=
None
return
points
,
points_as_picker
def
NormalizedImage
(
image
:
array_t
)
->
array_t
:
#
nonextreme_values
=
image
[
np_
.
logical_and
(
image
>
0.0
,
image
<
image
.
max
())]
...
...
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