Skip to content

Commit

Permalink
Update monai/transforms/intensity/array.py
Browse files Browse the repository at this point in the history
Thanks eric for the suggestion

Co-authored-by: Eric Kerfoot <[email protected]>
Signed-off-by: advcu <[email protected]>
  • Loading branch information
advcu987 and ericspod authored Jan 14, 2025
1 parent 3656b99 commit 3c58135
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion monai/transforms/intensity/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,8 @@ 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)
if not img.dtype.is_floating_point:
img, *_ = convert_data_type(img, dtype=torch.float32)

for i, d in enumerate(img):
img[i] = self._normalize( # type: ignore
Expand Down

0 comments on commit 3c58135

Please sign in to comment.