Skip to content

Commit

Permalink
Update csareader.py to fix style and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
parneshraniga authored Jan 4, 2017
1 parent 4a73b36 commit 920cf49
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 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:
# 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):
# The element could be missing due to anonymization
return None
return None


def read(csa_str):
Expand Down

0 comments on commit 920cf49

Please sign in to comment.