Skip to content

Commit 093b51a

Browse files
committed
FIX: Conditionally drop isotropic frames
1 parent 706de72 commit 093b51a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nibabel/nicom/dicomwrappers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,14 @@ def image_shape(self):
509509
if hasattr(first_frame, 'get') and first_frame.get([0x18, 0x9117]):
510510
# DWI image may include derived isotropic, ADC or trace volume
511511
try:
512-
self.frames = pydicom.Sequence(
512+
anisotropic = pydicom.Sequence(
513513
frame
514514
for frame in self.frames
515515
if frame.MRDiffusionSequence[0].DiffusionDirectionality != 'ISOTROPIC'
516516
)
517+
# Image contains DWI volumes followed by derived images; remove derived images
518+
if len(anisotropic) != 0:
519+
self.frames = anisotropic
517520
except IndexError:
518521
# Sequence tag is found but missing items!
519522
raise WrapperError('Diffusion file missing information')

0 commit comments

Comments
 (0)