Skip to content

Commit 4a2af88

Browse files
committed
ENH: Raise exception if BIDS cleanup of SID resulted in an empty value
1 parent 4eff1a6 commit 4a2af88

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

heudiconv/bids.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ def convert_sid_bids(subject_id):
326326
"""
327327
cleaner = lambda y: ''.join([x for x in y if x.isalnum()])
328328
sid = cleaner(subject_id)
329+
if not sid:
330+
raise ValueError(
331+
"Subject ID became empty after cleanup. Please provide manually "
332+
"a suitable alphanumeric subject ID")
329333
lgr.warning('{0} contained nonalphanumeric character(s), subject '
330334
'ID was cleaned to be {1}'.format(subject_id, sid))
331335
return sid, subject_id

0 commit comments

Comments
 (0)