From 6b492c2572f686778a9fdd0201322db33ed39625 Mon Sep 17 00:00:00 2001 From: Nodar Gogoberidze Date: Thu, 5 Dec 2024 09:05:50 -0500 Subject: [PATCH] Remove scaling for numpy/matlab --- .../image/abstract_image/file/_file_image.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/subpackages/core/cellprofiler_core/image/abstract_image/file/_file_image.py b/src/subpackages/core/cellprofiler_core/image/abstract_image/file/_file_image.py index 4d66f172eb..8b1eb9c110 100644 --- a/src/subpackages/core/cellprofiler_core/image/abstract_image/file/_file_image.py +++ b/src/subpackages/core/cellprofiler_core/image/abstract_image/file/_file_image.py @@ -206,7 +206,7 @@ def normalize_to_float32(data, in_range=None, wants_inscale=False): In this case, it is simply cast to float32. 2. Floating point images which have values normalized inside the range -1-1. In this case, the data is renormalized to the range 0-1, and then cast to float32. - 2. Floating point values which *represent* signed/unsigned integers but stored as float + 3. Floating point values which *represent* signed/unsigned integers but stored as float e.g. ..., -65535.0, -255.0, -1.0, 0.0, 1.0, 65535.0, ... i.e. data that really should be an signed/unsigned integer type, but for whatever reason, are stored as float type. @@ -468,12 +468,12 @@ def __set_image(self): if is_matlab_file(self.__filename): img = load_data_file(self.get_full_name(), loadmat) - # TODO - 4955: should we be overwriting if not None? - self.rescale_range = (0.0, 1.0) + self.rescale_range = None + self.__scale = 1.0 elif is_numpy_file(self.__filename): img = load_data_file(self.get_full_name(), numpy.load) - # TODO - 4955: should we be overwriting if not None? - self.rescale_range = (0.0, 1.0) + self.rescale_range = None + self.__scale = 1.0 else: rdr = self.get_reader() if numpy.isscalar(self.index) or self.index is None: @@ -512,10 +512,10 @@ def __set_image(self): stack.append(img) img = numpy.dstack(stack) - if self.metadata_rescale: - img, self.__scale = FileImage.normalize_to_float32(img, in_range=self.rescale_range, wants_inscale=True) - else: - img, self.__scale = FileImage.normalize_to_float32(img, wants_inscale=True) + if self.metadata_rescale: + img, self.__scale = FileImage.normalize_to_float32(img, in_range=self.rescale_range, wants_inscale=True) + else: + img, self.__scale = FileImage.normalize_to_float32(img, wants_inscale=True) self.__image = Image( img,