diff --git a/monai/transforms/intensity/array.py b/monai/transforms/intensity/array.py index aefe5697b8..20000c52c4 100644 --- a/monai/transforms/intensity/array.py +++ b/monai/transforms/intensity/array.py @@ -907,8 +907,6 @@ def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor: if self.divisor is not None and len(self.divisor) != len(img): raise ValueError(f"img has {len(img)} channels, but divisor has {len(self.divisor)} components.") - img, *_ = convert_data_type(img, dtype=torch.float32) - for i, d in enumerate(img): img[i] = self._normalize( # type: ignore d, diff --git a/tests/test_normalize_intensity.py b/tests/test_normalize_intensity.py index 7efd0d83e5..72ebf579e1 100644 --- a/tests/test_normalize_intensity.py +++ b/tests/test_normalize_intensity.py @@ -108,27 +108,6 @@ def test_channel_wise(self, im_type): normalized = normalizer(input_data) assert_allclose(normalized, im_type(expected), type_test="tensor") - @parameterized.expand([[p] for p in TEST_NDARRAYS]) - def test_channel_wise_int(self, im_type): - normalizer = NormalizeIntensity(nonzero=True, channel_wise=True) - input_data = im_type(torch.arange(1, 25).reshape(2, 3, 4)) - expected = np.array( - [ - [ - [-1.593255, -1.3035723, -1.0138896, -0.7242068], - [-0.4345241, -0.1448414, 0.1448414, 0.4345241], - [0.7242068, 1.0138896, 1.3035723, 1.593255], - ], - [ - [-1.593255, -1.3035723, -1.0138896, -0.7242068], - [-0.4345241, -0.1448414, 0.1448414, 0.4345241], - [0.7242068, 1.0138896, 1.3035723, 1.593255], - ], - ] - ) - normalized = normalizer(input_data) - assert_allclose(normalized, im_type(expected), type_test="tensor", rtol=1e-7, atol=1e-7) # tolerance - @parameterized.expand([[p] for p in TEST_NDARRAYS]) def test_value_errors(self, im_type): input_data = im_type(np.array([[0.0, 3.0, 0.0, 4.0], [0.0, 4.0, 0.0, 5.0]]))