Skip to content

Commit 7569219

Browse files
committed
Make "Calculated shape" more "correct" (do show shape) and informative
1 parent a35e2ac commit 7569219

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nibabel/nicom/dicomwrappers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,11 @@ def image_shape(self):
565565
ns_unique = [len(np.unique(row)) for row in self._frame_indices.T]
566566
shape = (rows, cols) + tuple(ns_unique)
567567
n_vols = np.prod(shape[3:])
568-
if n_frames != n_vols * shape[2]:
569-
raise WrapperError('Calculated shape does not match number of frames.')
568+
n_frames_calc = n_vols * shape[2]
569+
if n_frames != n_frames_calc:
570+
raise WrapperError(
571+
f'Calculated # of frames ({n_frames_calc}={n_vols}*{shape[2]}) of shape {shape} does not '
572+
f'match NumberOfFrames {n_frames}.')
570573
return tuple(shape)
571574

572575
@one_time

0 commit comments

Comments
 (0)