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
87d5683e
Commit
87d5683e
authored
5 years ago
by
NADAL Morgane
Browse files
Options
Downloads
Patches
Plain Diff
corrected error in ToPixel
parent
78cca4dc
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/processing/input.py
+5
-7
5 additions, 7 deletions
brick/processing/input.py
nutrimorph.py
+7
-4
7 additions, 4 deletions
nutrimorph.py
parameters.ini
+2
-2
2 additions, 2 deletions
parameters.ini
parameters.py
+5
-5
5 additions, 5 deletions
parameters.py
with
19 additions
and
18 deletions
brick/processing/input.py
+
5
−
7
View file @
87d5683e
...
...
@@ -132,17 +132,15 @@ def FindVoxelDimensionInMicron(data_path: str) -> array_t:
print
(
'
/!\ Unable to find the voxel dimensions in micron in the metadata. Please specify it in the parameters.
'
)
def
ToPixel
(
micron
:
float
,
voxel_size_micron
:
array_t
)
->
int
:
# 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.
return
round
(
micron
/
voxel_size_micron
[
0
])
def
ToPixel
(
micron
:
float
,
voxel_size_micron
:
array_t
,
dimension
:
int
=
1
,
axis
:
int
=
0
)
->
int
:
# Conversion of pixels into micron.
return
round
(
micron
/
(
voxel_size_micron
[
axis
]
**
dimension
))
def
ToMicron
(
pixel
:
int
,
voxel_size_micron
:
array_t
)
->
float
:
def
ToMicron
(
pixel
:
int
,
voxel_size_micron
:
array_t
,
dimension
:
int
=
1
,
axis
:
int
=
0
)
->
float
:
# May not be used. if not used, delete.
# Conversion of micron into pixels.
# Assumes that the axes X and Y have the same ratio pixel:micron.
return
float
(
pixel
*
voxel_size_micron
[
0
])
return
float
(
pixel
*
(
voxel_size_micron
[
axis
])
**
dimension
)
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
+
7
−
4
View file @
87d5683e
...
...
@@ -90,16 +90,17 @@ start_time = tm_.time()
# --- Images
# Find the dimension of the image voxels in micron
size_voxel_in_micron
=
in_
.
FindVoxelDimensionInMicron
(
data_path
)
image
=
io_
.
imread
(
data_path
)
# Image size verification - simple version without user interface
image
=
in_
.
ImageVerification
(
image
,
channel
)
# iv_.image_verification(image, channel) # -> PySide2 interface # TODO: must return the modified image!
# /!\ conflicts between some versions of PySide2 and Python3
image
=
image
[:,
512
:,
512
:]
# 562
image
=
image
[:,
512
:,
512
:]
# 562
# Just for development
img_shape
=
image
.
shape
# pl_.matshow(image[image.shape[0] // 2, :, :])
# pl_.show()
...
...
@@ -129,7 +130,7 @@ axes = {}
# --- Somas
print
(
"
\n
--- Soma Detection
"
)
soma_min_area_c
=
in_
.
ToPixel
(
soma_min_area_c
,
size_voxel_in_micron
)
soma_min_area_c
=
in_
.
ToPixel
(
soma_min_area_c
,
size_voxel_in_micron
,
dimension
=
2
)
soma_selem_c
=
mp_
.
disk
(
in_
.
ToPixel
(
soma_selem_micron_c
,
size_voxel_in_micron
))
som_nfo
[
"
map
"
]
=
soma_t
.
Map
(
image_for_soma
,
soma_low_c
,
soma_high_c
,
soma_selem_c
)
...
...
@@ -155,7 +156,7 @@ if with_plot:
# -- Extentions
print
(
"
\n
--- Extension Detection
"
)
ext_min_area_c
=
in_
.
ToPixel
(
ext_min_area_c
,
size_voxel_in_micron
)
ext_min_area_c
=
in_
.
ToPixel
(
ext_min_area_c
,
size_voxel_in_micron
,
dimension
=
2
)
ext_selem_pixel_c
=
mp_
.
disk
(
in_
.
ToPixel
(
ext_selem_micron_c
,
size_voxel_in_micron
))
...
...
@@ -286,3 +287,5 @@ print(f"DONE: {tm_.strftime('%a, %b %d %Y @ %H:%M:%S')}")
if
with_plot
:
pl_
.
show
()
# graph = skl_graph_t.FromSkeleton(soma_map) # Travailler apd squelettes (soma pas sous fore de sk)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
parameters.ini
+
2
−
2
View file @
87d5683e
...
...
@@ -42,7 +42,7 @@ soma_low_c: 0.15
soma_high_c:
0.7126
soma_selem_micron_c:
0.24050024
*
2
# soma_selem_c = mp_.disk(2)
soma_min_area_c:
0.24050024
*
1000
soma_min_area_c:
(
0.24050024
**
2)
*
1000
;soma_min_area_c: 1000
[Extensions]
...
...
@@ -52,7 +52,7 @@ ext_high_c: 0.6
# 0.04 # 0.6 # high_ext = 8.0e-3
ext_selem_micron_c:
0.24050024
*
1
# ext_selem_c = mp_.disk(1)
ext_min_area_c:
0.24050024
*
100
ext_min_area_c:
(
0.24050024
**
2)
*
100
;ext_min_area_c: 100 # pixels
[Connexions]
...
...
This diff is collapsed.
Click to expand it.
parameters.py
+
5
−
5
View file @
87d5683e
...
...
@@ -37,19 +37,19 @@ with_plot = False
soma_low_c
=
0.15
soma_high_c
=
0.7126
ext_low_c
=
3
#1e-7 ##0.2 # 0.02 # 0.2 # ext_low_c = 9.0e-4
ext_high_c
=
1e-10
#1.2e-7 ##0.6 # 0.04 # 0.6 # high_ext = 8.0e-3
ext_low_c
=
0.2
#
3 #1e-7
##0.2 # 0.02 # 0.2 # ext_low_c = 9.0e-4
ext_high_c
=
0.6
#
1e-10 #1.2e-7
##0.6 # 0.04 # 0.6 # high_ext = 8.0e-3
# soma_selem_c = mp_.disk(2)
soma_selem_micron_c
=
0.24050024
*
2
# ext_selem_c = mp_.disk(1)
soma_selem_micron_c
=
0.24050024
*
2
ext_selem_micron_c
=
0.24050024
*
1
max_straight_sq_dist_c
=
(
30
**
2
)
*
0.24050024
max_weighted_length_c
=
20.0
*
0.24050024
soma_min_area_c
=
1000
*
0.24050024
ext_min_area_c
=
100
*
0.24050024
soma_min_area_c
=
1000
*
(
0.24050024
**
2
)
ext_min_area_c
=
100
*
(
0.24050024
**
2
)
# soma_min_area_c = 1000
# ext_min_area_c = 100
...
...
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