Skip to content

Commit ca1cfb8

Browse files
fix issue
Signed-off-by: Yiheng Wang <[email protected]>
1 parent 84d8cf3 commit ca1cfb8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

monai/data/image_reader.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ def read(self, data: Sequence[PathLike] | PathLike, **kwargs):
10691069
data: file name or a list of file names to read.
10701070
10711071
"""
1072-
img_: list[Nifti1Image] = []
1072+
img_ = []
10731073

10741074
filenames: Sequence[PathLike] = ensure_tuple(data)
10751075
kwargs_ = self.kwargs.copy()
@@ -1113,12 +1113,12 @@ def get_data(self, img):
11131113
# if self.squeeze_non_spatial_dims:
11141114
img_array.append(data)
11151115
if self.channel_dim is None: # default to "no_channel" or -1
1116-
header[MetaKeys.ORIGINAL_CHANNEL_DIM] = (
1117-
float("nan") if len(data.shape) == len(header[MetaKeys.SPATIAL_SHAPE]) else -1
1116+
meta[MetaKeys.ORIGINAL_CHANNEL_DIM] = (
1117+
float("nan") if len(data.shape) == len(meta[MetaKeys.SPATIAL_SHAPE]) else -1
11181118
)
11191119
else:
1120-
header[MetaKeys.ORIGINAL_CHANNEL_DIM] = self.channel_dim
1121-
_copy_compatible_dict(header, compatible_meta)
1120+
meta[MetaKeys.ORIGINAL_CHANNEL_DIM] = self.channel_dim
1121+
_copy_compatible_dict(meta, compatible_meta)
11221122

11231123
return self._stack_images(img_array, compatible_meta), compatible_meta
11241124

0 commit comments

Comments
 (0)