diff --git a/dcm2bids/participant.py b/dcm2bids/participant.py index 61f27f0b..2956f721 100644 --- a/dcm2bids/participant.py +++ b/dcm2bids/participant.py @@ -35,10 +35,13 @@ def name(self, name): """ Prepend 'sub-' if necessary""" if name.startswith("sub-"): self._name = name - else: self._name = "sub-" + name + if not self._name.replace('sub-', '').isalnum(): + raise NameError(f"Participant '{self._name.replace('sub-', '')}' " + "should contains only alphanumeric characters.") + @property def session(self): """