Skip to content

Commit 410b810

Browse files
committed
FIX: str
1 parent 28a9639 commit 410b810

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

nibabel/nicom/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def find_private_section(dcm_data, group_no, creator):
1717
``tag``, ``VR``, ``value``
1818
group_no : int
1919
Group number in which to search
20-
creator : bytes or regex
20+
creator : str or regex
2121
Name of section - e.g. b'SIEMENS CSA HEADER' - or regex to search for
2222
section name. Regex used via ``creator.search(element_value)`` where
2323
``element_value`` is the decoded value of the data element.
@@ -29,8 +29,7 @@ def find_private_section(dcm_data, group_no, creator):
2929
"""
3030
if hasattr(creator, 'search'):
3131
match_func = creator.search
32-
else: # assume bytes
33-
creator = creator.decode('latin-1')
32+
else: # assume str
3433
match_func = creator.__eq__
3534
# Group elements assumed ordered by tag (groupno, elno)
3635
for element in dcm_data.group_dataset(group_no):
@@ -39,7 +38,7 @@ def find_private_section(dcm_data, group_no, creator):
3938
break
4039
if element.VR not in ('LO', 'OB'):
4140
continue
42-
val = element.value.decode('latin-1')
41+
val = element.value
4342
if match_func(val):
4443
return elno * 0x100
4544
return None

0 commit comments

Comments
 (0)