Skip to content

Commit 8e2bd08

Browse files
mgxdeffigies
authored andcommitted
rf: condense frame checking try block
1 parent 1040c51 commit 8e2bd08

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

nibabel/nicom/dicomwrappers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,16 +517,17 @@ def image_shape(self):
517517
frame.MRDiffusionSequence[0].DiffusionDirectionality
518518
!= 'ISOTROPIC'
519519
)
520-
if n_frames != len(self.frames):
521-
warnings.warn("Derived images found and removed")
522-
n_frames = len(self.frames)
523-
has_derived = True
524520
except IndexError:
525521
# Sequence tag is found but missing items!
526522
raise WrapperError("Diffusion file missing information")
527523
except AttributeError:
528524
# DiffusionDirectionality tag is not required
529525
pass
526+
else:
527+
if n_frames != len(self.frames):
528+
warnings.warn("Derived images found and removed")
529+
n_frames = len(self.frames)
530+
has_derived = True
530531

531532
assert len(self.frames) == n_frames
532533
frame_indices = np.array(

0 commit comments

Comments
 (0)