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
0aa2d768
Commit
0aa2d768
authored
5 years ago
by
NADAL Morgane
Browse files
Options
Downloads
Patches
Plain Diff
modif IntensityNormalizedImage()
parent
4321a9bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
brick/processing/input.py
+5
-16
5 additions, 16 deletions
brick/processing/input.py
with
5 additions
and
16 deletions
brick/processing/input.py
+
5
−
16
View file @
0aa2d768
...
...
@@ -61,7 +61,7 @@ def ImageVerification(image: array_t, channel: str) -> array_t:
raise
ValueError
(
'
The input image should not be constant.
'
)
return
image
else
:
raise
ValueError
(
'
The image has multiple color channels. Error in the value of the parameter channel.
'
)
...
...
@@ -69,25 +69,14 @@ def ImageVerification(image: array_t, channel: str) -> array_t:
raise
ValueError
(
f
'
The image dimensions are not correct:
{
image
.
ndim
}
, instead of 3 or 4.
'
)
# if channel != 'RGB' and image.ndim == 4:
# print('The image has multiple color channels. The channel', channel, 'was specified in the parameters.')
# for idx, color in enumerate('RGB'):
# if channel == color:
# image = image[:, :, :, idx]
# elif channel == 'RGB' and image.ndim == 3:
# print('WARNING. The 3 RGB color channels were selected in the parameters but the image has only one channel.')
def
IntensityNormalizedImage
(
image
:
array_t
)
->
array_t
:
#
print
(
'
Relative Intensity Normalization between 0 and 1 (Not a standardization). Need to reevaluate the parameters !!!
'
)
print
(
'
Relative Intensity Normalization between 0 and 1. Need to reevaluate the parameters !!!
'
)
value_max
=
image
.
astype
(
np_
.
float32
).
max
()
value_min
=
image
.
astype
(
np_
.
float32
).
min
()
value_max
=
image
.
max
()
value_min
=
image
.
min
()
result
=
(
image
.
astype
(
np_
.
float32
)
-
value_min
)
/
(
value_max
-
value_min
)
result
=
(
image
.
astype
(
np_
.
float32
)
-
value_min
)
/
float
(
value_max
-
value_min
)
return
result
...
...
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