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
56c71b36
Commit
56c71b36
authored
5 years ago
by
NADAL Morgane
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
parent
3b79f558
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
brick/component/extension.py
+3
-3
3 additions, 3 deletions
brick/component/extension.py
brick/processing/input.py
+12
-12
12 additions, 12 deletions
brick/processing/input.py
nutrimorph.py
+3
-3
3 additions, 3 deletions
nutrimorph.py
parameters.py
+2
-2
2 additions, 2 deletions
parameters.py
with
20 additions
and
20 deletions
brick/component/extension.py
+
3
−
3
View file @
56c71b36
...
@@ -47,7 +47,7 @@ from scipy import ndimage as im_
...
@@ -47,7 +47,7 @@ from scipy import ndimage as im_
ext_min_area_c
=
100
ext_min_area_c
=
100
ext_selem_micron
s
_c
=
0.24050024
ext_selem_micron_c
=
0.24050024
class
extension_t
(
glial_cmp_t
):
class
extension_t
(
glial_cmp_t
):
...
@@ -176,11 +176,11 @@ class extension_t(glial_cmp_t):
...
@@ -176,11 +176,11 @@ class extension_t(glial_cmp_t):
return
enhanced_img
,
scale_map
return
enhanced_img
,
scale_map
@staticmethod
@staticmethod
def
CoarseMap
(
image
:
array_t
,
low
:
float
,
high
:
float
,
voxel_micron
:
array_t
,
ext_selem_micron
s
=
ext_selem_micron
s
_c
)
->
array_t
:
def
CoarseMap
(
image
:
array_t
,
low
:
float
,
high
:
float
,
voxel_micron
:
array_t
,
ext_selem_micron
=
ext_selem_micron_c
)
->
array_t
:
#
#
result
=
__HysterisisImage__
(
image
,
low
,
high
)
result
=
__HysterisisImage__
(
image
,
low
,
high
)
selem
=
mp_
.
disk
(
in_
.
ToPixel
s
(
ext_selem_micron
s
,
voxel_micron
))
selem
=
mp_
.
disk
(
in_
.
ToPixel
(
ext_selem_micron
,
voxel_micron
))
result
=
__MorphologicalCleaning__
(
result
,
selem
)
result
=
__MorphologicalCleaning__
(
result
,
selem
)
return
result
return
result
...
...
This diff is collapsed.
Click to expand it.
brick/processing/input.py
+
12
−
12
View file @
56c71b36
...
@@ -101,7 +101,7 @@ def IntensityNormalizedImage(image: array_t) -> array_t:
...
@@ -101,7 +101,7 @@ def IntensityNormalizedImage(image: array_t) -> array_t:
# return result
# return result
def
FindVoxelDimensionInMicron
s
(
data_path
:
str
)
->
array_t
:
def
FindVoxelDimensionInMicron
(
data_path
:
str
)
->
array_t
:
#
#
if
size_voxel_in_micron
is
not
None
:
if
size_voxel_in_micron
is
not
None
:
return
np_
.
array
(
size_voxel_in_micron
)
return
np_
.
array
(
size_voxel_in_micron
)
...
@@ -124,25 +124,25 @@ def FindVoxelDimensionInMicrons(data_path: str) -> array_t:
...
@@ -124,25 +124,25 @@ def FindVoxelDimensionInMicrons(data_path: str) -> array_t:
voxel_size
.
append
(
re
.
findall
(
pattern
,
metadata
)[
0
])
voxel_size
.
append
(
re
.
findall
(
pattern
,
metadata
)[
0
])
voxel_size
=
np_
.
array
(
list
(
map
(
float
,
voxel_size
)))
voxel_size
=
np_
.
array
(
list
(
map
(
float
,
voxel_size
)))
voxel_size_micron
s
=
1.0e6
*
voxel_size
voxel_size_micron
=
1.0e6
*
voxel_size
print
(
'
Voxel dimension in the image is [X Y Z] =
'
,
voxel_size_micron
s
,
'
in micron
s
.
'
)
print
(
'
Voxel dimension in the image is [X Y Z] =
'
,
voxel_size_micron
,
'
in micron.
'
)
return
voxel_size_micron
s
return
voxel_size_micron
except
:
except
:
print
(
'
Unable to find the voxel dimensions in micron in the metadata. Please specify it in the parameters.
'
)
print
(
'
Unable to find the voxel dimensions in micron in the metadata. Please specify it in the parameters.
'
)
def
ToPixel
s
(
micron
:
float
,
voxel_size_micron
s
:
array_t
)
->
int
:
def
ToPixel
(
micron
:
float
,
voxel_size_micron
:
array_t
)
->
int
:
# Conversion of pixels into micron
s
. Used in morphomath (disk structuring element mp_.disk(n_pixel)).
# Conversion of pixels into micron. Used in morphomath (disk structuring element mp_.disk(n_pixel)).
# Assumes that the axes X and Y have the same ratio pixel:micron
s
.
# Assumes that the axes X and Y have the same ratio pixel:micron.
return
round
(
micron
/
voxel_size_micron
s
[
0
])
return
round
(
micron
/
voxel_size_micron
[
0
])
def
ToMicron
s
(
pixel
:
int
,
voxel_size_micron
s
:
array_t
)
->
float
:
def
ToMicron
(
pixel
:
int
,
voxel_size_micron
:
array_t
)
->
float
:
# May not be used. if not used, delete.
# May not be used. if not used, delete.
# Conversion of micron
s
into pixels.
# Conversion of micron into pixels.
# Assumes that the axes X and Y have the same ratio pixel:micron
s
.
# Assumes that the axes X and Y have the same ratio pixel:micron.
return
float
(
pixel
*
voxel_size_micron
s
[
0
])
return
float
(
pixel
*
voxel_size_micron
[
0
])
def
DijkstraCosts
(
image
:
array_t
,
som_map
:
array_t
,
ext_map
:
array_t
)
->
array_t
:
def
DijkstraCosts
(
image
:
array_t
,
som_map
:
array_t
,
ext_map
:
array_t
)
->
array_t
:
...
...
This diff is collapsed.
Click to expand it.
nutrimorph.py
+
3
−
3
View file @
56c71b36
...
@@ -71,7 +71,7 @@ soma_low_c = None
...
@@ -71,7 +71,7 @@ soma_low_c = None
soma_high_c
=
None
soma_high_c
=
None
ext_low_c
=
None
ext_low_c
=
None
ext_high_c
=
None
ext_high_c
=
None
soma_selem_micron
s
_c
=
None
soma_selem_micron_c
=
None
max_straight_sq_dist_c
=
None
max_straight_sq_dist_c
=
None
max_weighted_length_c
=
None
max_weighted_length_c
=
None
soma_min_area_c
=
None
soma_min_area_c
=
None
...
@@ -89,7 +89,7 @@ start_time = tm_.time()
...
@@ -89,7 +89,7 @@ start_time = tm_.time()
# --- Images
# --- Images
voxel_micron
=
in_
.
FindVoxelDimensionInMicron
s
(
data_path
)
voxel_micron
=
in_
.
FindVoxelDimensionInMicron
(
data_path
)
image
=
io_
.
imread
(
data_path
)
image
=
io_
.
imread
(
data_path
)
...
@@ -128,7 +128,7 @@ axes = {}
...
@@ -128,7 +128,7 @@ axes = {}
# --- Somas
# --- Somas
print
(
"
\n
--- Soma Detection
"
)
print
(
"
\n
--- Soma Detection
"
)
soma_selem_c
=
mp_
.
disk
(
in_
.
ToPixel
s
(
soma_selem_micron
s
_c
,
voxel_micron
))
soma_selem_c
=
mp_
.
disk
(
in_
.
ToPixel
(
soma_selem_micron_c
,
voxel_micron
))
som_nfo
[
"
map
"
]
=
soma_t
.
Map
(
image_for_soma
,
soma_low_c
,
soma_high_c
,
soma_selem_c
)
som_nfo
[
"
map
"
]
=
soma_t
.
Map
(
image_for_soma
,
soma_low_c
,
soma_high_c
,
soma_selem_c
)
som_nfo
[
"
map
"
],
som_lmp
=
soma_t
.
FilteredMap
(
som_nfo
[
"
map
"
],
soma_min_area_c
)
som_nfo
[
"
map
"
],
som_lmp
=
soma_t
.
FilteredMap
(
som_nfo
[
"
map
"
],
soma_min_area_c
)
...
...
This diff is collapsed.
Click to expand it.
parameters.py
+
2
−
2
View file @
56c71b36
...
@@ -41,9 +41,9 @@ ext_low_c = 0.2 # 0.02 # 0.2 # ext_low_c = 9.0e-4
...
@@ -41,9 +41,9 @@ ext_low_c = 0.2 # 0.02 # 0.2 # ext_low_c = 9.0e-4
ext_high_c
=
0.6
# 0.04 # 0.6 # high_ext = 8.0e-3
ext_high_c
=
0.6
# 0.04 # 0.6 # high_ext = 8.0e-3
# soma_selem_c = mp_.disk(2)
# soma_selem_c = mp_.disk(2)
soma_selem_micron
s
_c
=
0.48100048
soma_selem_micron_c
=
0.48100048
# ext_selem_c = mp_.disk(1)
# ext_selem_c = mp_.disk(1)
ext_selem_micron
s
_c
=
0.24050024
# /!\ Not directly used in brick/component #TODO direct use of param ?
ext_selem_micron_c
=
0.24050024
# /!\ Not directly used in brick/component #TODO direct use of param ?
max_straight_sq_dist_c
=
30
**
2
max_straight_sq_dist_c
=
30
**
2
max_weighted_length_c
=
20.0
max_weighted_length_c
=
20.0
...
...
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