From 1ed4f94ba3ab84cd5b7c14c840f1cf8b9269e266 Mon Sep 17 00:00:00 2001 From: KumoLiu Date: Tue, 5 Sep 2023 21:47:29 +0800 Subject: [PATCH] fix #6945 Signed-off-by: KumoLiu --- monai/data/image_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/data/image_reader.py b/monai/data/image_reader.py index e5ddbf8f33..936d24cced 100644 --- a/monai/data/image_reader.py +++ b/monai/data/image_reader.py @@ -663,7 +663,7 @@ def _get_affine(self, metadata: dict, lps_to_ras: bool = True): # "00200032" is the tag of `ImagePositionPatient` sx, sy, sz = metadata["00200032"]["Value"] # "00280030" is the tag of `PixelSpacing` - spacing = metadata["00280030"]["Value"] + spacing = metadata["00280030"]["Value"] if "00280030" in metadata else (1.0, 1.0) dr, dc = metadata.get("spacing", spacing)[:2] affine[0, 0] = cx * dr affine[0, 1] = rx * dc