Skip to content

Commit 6ec7b0a

Browse files
committed
fix: skip if frame does not have get attribute
1 parent b7ef629 commit 6ec7b0a

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

nibabel/nicom/dicomwrappers.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,18 @@ def __init__(self, dcm_data):
466466
self.frames[0]
467467
except TypeError:
468468
raise WrapperError("PerFrameFunctionalGroupsSequence is empty.")
469-
# DWI image where derived isotropic, ADC or trace volume was appended to the series
470-
if self.frames[0] and self.frames[0].get([0x18, 0x9117], None):
471-
self.frames = Sequence(
472-
frame for frame in self.frames if
473-
frame.get([0x18, 0x9117])[0].get([0x18, 0x9075]).value
474-
!= 'ISOTROPIC'
475-
)
476-
self._nframes = len(self.frames)
469+
try:
470+
# DWI image where derived isotropic, ADC or trace volume
471+
# was appended to the series
472+
if self.frames[0].get([0x18, 0x9117], None):
473+
self.frames = Sequence(
474+
frame for frame in self.frames if
475+
frame.get([0x18, 0x9117])[0].get([0x18, 0x9075]).value
476+
!= 'ISOTROPIC'
477+
)
478+
self._nframes = len(self.frames)
479+
except AttributeError:
480+
pass
477481
try:
478482
self.shared = dcm_data.get('SharedFunctionalGroupsSequence')[0]
479483
except TypeError:

0 commit comments

Comments
 (0)