Skip to content

Commit

Permalink
ENH: Slightly simplify frame_indices array construction
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jan 12, 2025
1 parent f81f5a7 commit df638fd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nibabel/nicom/dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,13 @@ def image_shape(self):
return (rows, cols)
# Initialize array of frame indices
try:
frame_indices = np.array(
[frame.FrameContentSequence[0].DimensionIndexValues for frame in self.frames]
frame_indices = np.stack(
np.atleast_1d(
*(frame.FrameContentSequence[0].DimensionIndexValues for frame in self.frames)
)
)
except AttributeError:
raise WrapperError("Can't find frame 'DimensionIndexValues'")
if len(frame_indices.shape) == 1:
frame_indices = frame_indices.reshape(frame_indices.shape + (1,))
# Determine the shape and which indices to use
shape = [rows, cols]
curr_parts = n_frames
Expand Down

0 comments on commit df638fd

Please sign in to comment.