You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
monai.transforms.intensity.array.NormalizeIntensity bug when __call__ with channel_wise=True #8267
Describe the bug
In the __call__ method of monai.transforms.intensity.array.NormalizeIntensity class, the conversion into torch.float32 performed in self._normalize line 911, is not taken into account when channel_wise = True. The following code does not define a new variable img with the right type but it keeps the type of the original img variable. Therefore, if the original image was filled with int, the normalization will be performed on int and the normalization will fail.
for i, d in enumerate(img):
img[i] = self._normalize( # type: ignore
d,
sub=self.subtrahend[i] if self.subtrahend is not None else None,
div=self.divisor[i] if self.divisor is not None else None,
)
To Reproduce
Steps to reproduce the behavior:
Run commands
Activity
advcu987 commentedon Dec 27, 2024
@Elferodie did you fix it? otherwise, can I take a look at it?
Elferodie commentedon Dec 27, 2024
No I didn’t fix it, you can take a look, thank you !
Fixes Project-MONAI#8267 .
Revert " Fixes Project-MONAI#8267 ."
Fixes Project-MONAI#8267 .
8267 fix normalize intensity (#8286)
8267 fix normalize intensity (Project-MONAI#8286)
8267 fix normalize intensity (Project-MONAI#8286)