From 0aa2d768699c5b6ea99d74108c7f6d2ff38e5cdb Mon Sep 17 00:00:00 2001
From: monadal <morgane.nadal@inria.fr>
Date: Fri, 13 Mar 2020 10:19:47 +0100
Subject: [PATCH] modif IntensityNormalizedImage()

---
 brick/processing/input.py | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/brick/processing/input.py b/brick/processing/input.py
index 2e3d367..8e41b59 100644
--- a/brick/processing/input.py
+++ b/brick/processing/input.py
@@ -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
 
-- 
GitLab