Skip to content

Commit 920cf49

Browse files
Update csareader.py to fix style and add comments
1 parent 4a73b36 commit 920cf49

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nibabel/nicom/csareader.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ def get_csa_header(dcm_data, csa_type='image'):
6464
return None
6565
element_no = section_start + element_offset
6666
try:
67+
# The element could be missing due to anonymization
6768
tag = dcm_data[(0x29, element_no)]
69+
# Non-MRI Dicoms have string values in CSA tag
70+
# This will cause read to throw a CSAReadError
71+
# in most instances. If so, we return None
6872
return read(tag.value)
6973
except (KeyError, CSAReadError):
70-
# The element could be missing due to anonymization
71-
return None
74+
return None
7275

7376

7477
def read(csa_str):

0 commit comments

Comments
 (0)