hyphen/underscores in task names

284 views
Skip to first unread message

Bertrand Thirion

unread,
Jul 19, 2016, 1:46:04 PM7/19/16
to The Brain Imaging Data Structure (BIDS) discussion
    Hi BIDS,

    I am currently reorganizing different datasets to comply BIDS and one of the conventions I dislike is to fobid hyphens and underscores in fMRI task names. For instance, this gives names like 
"sub-01_ses-00_task-hcpsocial_acq-ap_bold.nii.gz", or "sub-01_ses-00_task-anticlockwedge_acq-ap_bold.nii.gz" which are really hard to parse (something like "task-hcp-social" or "task-anti-clock-wedge" would be so much better).
    Any chance to change this ?
    Best,

Bertrand

Tibor Auer

unread,
Jul 19, 2016, 1:50:06 PM7/19/16
to Bertrand Thirion, The Brain Imaging Data Structure (BIDS) discussion

Hi Bertrand,

 

Hyphens and underscores has special meaning in BIDS format (splitting fields and keys from labels), so I do not think it would be advisable to allow then within labels.

May camelcase be of any help for you? E.g.:

sub-01_ses-00_task-HcpSocial_acq-ap_bold.nii.gz

sub-01_ses-00_task-AntiClockWedge_acq-ap_bold.nii.gz

 

Vale,

Tibor

 

Auer, Tibor M.D. Ph.D.

MRC Cognition and Brain Sciences Unit
15 Chaucer Road
Cambridge
CB2 7EF

United Kingdom

Phone/Work: +44-(0)1223-273613

Mail: Tibor...@mrc-cbu.cam.ac.uk

--
You received this message because you are subscribed to the Google Groups "The Brain Imaging Data Structure (BIDS) discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bids-discussi...@googlegroups.com.
To post to this group, send email to bids-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bids-discussion/fa815154-dcd1-4430-b327-a2434f92d952%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Gorgolewski

unread,
Jul 19, 2016, 2:28:16 PM7/19/16
to Tibor Auer, Bertrand Thirion, The Brain Imaging Data Structure (BIDS) discussion
Indeed the only characters allowed in labels are letters and numbers ([a-zA-Z0-9]+). Not allowing hyphens and underscores was intended to make it easier to parse the filenames. Underscores are used to separate key/value pairs and hyphens are used to link keys with values. This way it's easy to get all of the key/value pairs by splitting the filename with the underscore character.

I like Tibors suggestions to use CamelCase to make multiword labels more readable.

Best,
Chris

Bertrand Thirion

unread,
Jul 20, 2016, 2:57:52 AM7/20/16
to The Brain Imaging Data Structure (BIDS) discussion
    Hi Tibor, Chris,

Thanks for the feedback and for your patience. Sorry for insisting, but I'm afraid this will become a recurrent issue (*) if we don't fix it early enough... 
There is a redundancy between the use of reserved keywords and  separators in the naming conventions: the syntax used currently is so constrained that it would still work to use hyphens within tasks names: _xxx-yyy-zzz-ttt_ can unambiguously be parsed as the key 'xxx' associated with value 'yyy-zzz-ttt'
HTH

B

(*) I mean: in the camel case vs underscore debate, there is one consensus point: the two should not be mixed. Enforcing this as an implicit convention is thus a bad idea imho.

Tibor Auer

unread,
Jul 20, 2016, 4:27:45 AM7/20/16
to Bertrand Thirion, The Brain Imaging Data Structure (BIDS) discussion

Hi all,

 

I think the issue of mixing camelcase with hyphen is not a real one here, because we would not  mix them within one field (i.e. label) but to separate the fields.

Moreover, hyphens may have an other role we are recently discussing: to separate multiple labels for the same key. So your example _xxx-yyy-zzz-ttt_ could be parsed as key ‘xxx’ associated with labels ‘yyy’, ‘zzz’ and ‘ttt’.

 

Vale,

Tibor

 

Auer, Tibor M.D. Ph.D.

MRC Cognition and Brain Sciences Unit
15 Chaucer Road
Cambridge
CB2 7EF

United Kingdom

Phone/Work: +44-(0)1223-273613

Mail: Tibor...@mrc-cbu.cam.ac.uk

 

From: bids-di...@googlegroups.com [mailto:bids-di...@googlegroups.com] On Behalf Of Bertrand Thirion


Sent: Wednesday, July 20, 2016 7:58 AM
To: The Brain Imaging Data Structure (BIDS) discussion <bids-di...@googlegroups.com>

--

You received this message because you are subscribed to the Google Groups "The Brain Imaging Data Structure (BIDS) discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bids-discussi...@googlegroups.com.
To post to this group, send email to bids-di...@googlegroups.com.

Bertrand Thirion

unread,
Jul 20, 2016, 11:22:19 AM7/20/16
to The Brain Imaging Data Structure (BIDS) discussion
Obviously, I can use "simple(r) task names", but I think that more generally this "feature" of the specification goes against human-readability of the file names. As you told me offline, there is a valid sue case for multiple parameters, such as --precisely-- multi-parametric MRI. 
The only solution I can think of atm is to introduce an exception in hyphenation rules, which is to allow hyphens in tasks.
?

Thanks,

B

Chris Gorgolewski

unread,
Jul 20, 2016, 11:42:27 AM7/20/16
to Bertrand Thirion, The Brain Imaging Data Structure (BIDS) discussion
Hi Bertrand,
You are raising a very valid point. Of course you are right, allowing hyphens in key values would still yield unambiguous parsing of filenames. My biggest concern is that BIDS compatible software out there relies on the unique role of the hyphen as the key value joiner. By introducing the proposed extension (or using hyphen for separating multiple key values) we will break such software.

BIDS has reached version 1.0.0 and I think we should be very careful introducing changes that are not backward compatible and could potentially break existing software. If we start doing this developers will get discouraged and be less likely to adopt the standard.

I don't want this suggestion to get forgotten though. I started a new document for storing suggestions that are not backward compatible so when it comes to BIDS 2.0 we would not miss any of them. You can find it here: https://docs.google.com/document/d/1LEgsMiisGDe1Gv-hBp1EcLmoz7AlKj6VYULUgDD3Zdw/edit?usp=sharing

One suggestions that might help you is using an abbreviated short task name and introducing "LongName" field in the corresponding JSON file (this would have to be added to the spec, but it should not be a problem). It's not ideal, but at least the file name is short.

Best,
Chris



--
You received this message because you are subscribed to the Google Groups "The Brain Imaging Data Structure (BIDS) discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bids-discussi...@googlegroups.com.
To post to this group, send email to bids-di...@googlegroups.com.

Bertrand Thirion

unread,
Jul 20, 2016, 11:57:49 AM7/20/16
to The Brain Imaging Data Structure (BIDS) discussion
Fair enough, thx again for you patience.

B

Bertrand Thirion

unread,
Jul 21, 2016, 10:06:03 AM7/21/16
to The Brain Imaging Data Structure (BIDS) discussion
Oops, I'm not the first one to hit this issue ;-)
ds110/sub-06/func/sub-06_task-IncidentalencodingtaskusingPosnercueingparadigmwithobjectvgreeblejudgment_run-07_bold.nii.gz

B

Tibor Auer

unread,
Jul 21, 2016, 10:09:06 AM7/21/16
to Bertrand Thirion, The Brain Imaging Data Structure (BIDS) discussion

I do not think that hyphenation could make it any better: J

ds110/sub-06/func/sub-06_task-Incidental-encoding-task-using-Posner-cueing-paradigm-with-object-v-greeble-judgment_run-07_bold.nii.gz

 

Vale,

Tibor

 

Auer, Tibor M.D. Ph.D.

MRC Cognition and Brain Sciences Unit
15 Chaucer Road
Cambridge
CB2 7EF

United Kingdom

Phone/Work: +44-(0)1223-273613

Mail: Tibor...@mrc-cbu.cam.ac.uk

 

From: bids-di...@googlegroups.com [mailto:bids-di...@googlegroups.com] On Behalf Of Bertrand Thirion
Sent: Thursday, July 21, 2016 3:06 PM
To: The Brain Imaging Data Structure (BIDS) discussion <bids-di...@googlegroups.com>
Subject: Re: hyphen/underscores in task names

 

Oops, I'm not the first one to hit this issue ;-)

ds110/sub-06/func/sub-06_task-IncidentalencodingtaskusingPosnercueingparadigmwithobjectvgreeblejudgment_run-07_bold.nii.gz

B

--

You received this message because you are subscribed to the Google Groups "The Brain Imaging Data Structure (BIDS) discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bids-discussi...@googlegroups.com.
To post to this group, send email to bids-di...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages