Skip to content

Commit

Permalink
FIX: Conditionally drop isotropic frames
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Feb 23, 2024
1 parent bc227ec commit 3f81a96
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nibabel/nicom/dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,14 @@ def image_shape(self):
if hasattr(first_frame, 'get') and first_frame.get([0x18, 0x9117]):
# DWI image may include derived isotropic, ADC or trace volume
try:
self.frames = pydicom.Sequence(
anisotropic = pydicom.Sequence(
frame
for frame in self.frames
if frame.MRDiffusionSequence[0].DiffusionDirectionality != 'ISOTROPIC'
)
# Image contains DWI volumes followed by derived images; remove derived images
if len(anisotropic) != 0:
self.frames = anisotropic
except IndexError:
# Sequence tag is found but missing items!
raise WrapperError('Diffusion file missing information')
Expand Down

0 comments on commit 3f81a96

Please sign in to comment.