Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
Signed-off-by: Yiheng Wang <[email protected]>
  • Loading branch information
yiheng-wang-nv committed Nov 2, 2024
1 parent 84d8cf3 commit ca1cfb8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions monai/data/image_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ def read(self, data: Sequence[PathLike] | PathLike, **kwargs):
data: file name or a list of file names to read.
"""
img_: list[Nifti1Image] = []
img_ = []

filenames: Sequence[PathLike] = ensure_tuple(data)
kwargs_ = self.kwargs.copy()
Expand Down Expand Up @@ -1113,12 +1113,12 @@ def get_data(self, img):
# if self.squeeze_non_spatial_dims:
img_array.append(data)
if self.channel_dim is None: # default to "no_channel" or -1
header[MetaKeys.ORIGINAL_CHANNEL_DIM] = (
float("nan") if len(data.shape) == len(header[MetaKeys.SPATIAL_SHAPE]) else -1
meta[MetaKeys.ORIGINAL_CHANNEL_DIM] = (
float("nan") if len(data.shape) == len(meta[MetaKeys.SPATIAL_SHAPE]) else -1
)
else:
header[MetaKeys.ORIGINAL_CHANNEL_DIM] = self.channel_dim
_copy_compatible_dict(header, compatible_meta)
meta[MetaKeys.ORIGINAL_CHANNEL_DIM] = self.channel_dim
_copy_compatible_dict(meta, compatible_meta)

return self._stack_images(img_array, compatible_meta), compatible_meta

Expand Down

0 comments on commit ca1cfb8

Please sign in to comment.