Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0aa2d768 authored by NADAL Morgane's avatar NADAL Morgane
Browse files

modif IntensityNormalizedImage()

parent 4321a9bd
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment