Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions nibabel/nicom/csareader.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ def get_csa_header(dcm_data, csa_type='image'):
return None
element_no = section_start + element_offset
try:
tag = dcm_data[(0x29, element_no)]
except KeyError:
# The element could be missing due to anonymization
tag = dcm_data[(0x29, element_no)]
# Non-MRI Dicoms have string values in CSA tag
# This will cause read to throw a CSAReadError
# in most instances. If so, we return None
return read(tag.value)
except (KeyError, CSAReadError):
return None
return read(tag.value)


def read(csa_str):
Expand Down