Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EEG and iEEG "electrodes" and "coordsystem" files accept more entities than they should #1198

Open
sappelhoff opened this issue Feb 24, 2021 · 3 comments

Comments

@sappelhoff
Copy link
Member

crossref:

According to the spec, electrodes and coordsystem files should accept:

  • sub
  • ses
  • acq
  • space

see https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/03-electroencephalography.html#electrodes-description-_electrodestsv

But they accept many more.

See here:

"eeg": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?eeg[\\/\\\\]\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_split-[0-9]+)?(?:_space-(@@@_eeg_space_@@@))?((_eeg\\.(@@@_eeg_type_@@@)|(@@@_eeg_ext_@@@))|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
"tokens": {
"@@@_eeg_space_@@@": [
"Other",
"CapTrak",
"CTF",
"ElektaNeuromag",
"4DBti",
"KitYokogawa",
"ChietiItab",
"ICBM452AirSpace",
"ICBM452Warp5Space",
"IXI549Space",
"fsaverage",
"fsaverageSym",
"fsLR",
"MNIColin27",
"MNI152Lin",
"MNI152NLin2009aSym",
"MNI152NLin2009bSym",
"MNI152NLin2009cSym",
"MNI152NLin2009aAsym",
"MNI152NLin2009bAsym",
"MNI152NLin2009cAsym",
"MNI152NLin6Sym",
"MNI152NLin6ASym",
"MNI305",
"NIHPD",
"OASIS30AntsOASISAnts",
"OASIS30Atropos",
"Talairach",
"UNCInfant",
"fsaverage3",
"fsaverage4",
"fsaverage5",
"fsaverage6",
"fsaveragesym",
"UNCInfant0V21",
"UNCInfant1V21",
"UNCInfant2V21",
"UNCInfant0V22",
"UNCInfant1V22",
"UNCInfant2V22",
"UNCInfant0V23",
"UNCInfant1V23",
"UNCInfant2V23"
],
"@@@_eeg_type_@@@": ["vhdr", "vmrk", "eeg", "edf", "bdf", "set", "fdt"],
"@@@_eeg_ext_@@@": [
"_events\\.json",
"_events\\.tsv",
"_electrodes\\.json",
"_electrodes\\.tsv",
"_channels\\.json",
"_channels\\.tsv",
"_eeg\\.json",
"_coordsystem\\.json",
"_photo\\.jpg"
],
"@@@_cont_ext_@@@": [
"_physio\\.tsv\\.gz",
"_stim\\.tsv\\.gz",
"_physio\\.json",
"_stim\\.json"
]
}
},
"ieeg": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?ieeg[\\/\\\\]\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_run-[0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_split-[0-9]+)?(?:_space-(@@@_ieeg_space_@@@))?((_ieeg\\.(@@@_ieeg_type_@@@)|(@@@_ieeg_ext_@@@))|(?:_recording-[a-zA-Z0-9]+)?(?:@@@_cont_ext_@@@))$",
"tokens": {
"@@@_ieeg_space_@@@": [
"Other",
"Pixels",
"ACPC",
"ICBM452AirSpace",
"ICBM452Warp5Space",
"IXI549Space",
"fsaverage",
"fsaverageSym",
"fsLR",
"MNIColin27",
"MNI152Lin",
"MNI152NLin2009aSym",
"MNI152NLin2009bSym",
"MNI152NLin2009cSym",
"MNI152NLin2009aAsym",
"MNI152NLin2009bAsym",
"MNI152NLin2009cAsym",
"MNI152NLin6Sym",
"MNI152NLin6ASym",
"MNI305",
"NIHPD",
"OASIS30AntsOASISAnts",
"OASIS30Atropos",
"Talairach",
"UNCInfant",
"fsaverage3",
"fsaverage4",
"fsaverage5",
"fsaverage6",
"fsaveragesym",
"UNCInfant0V21",
"UNCInfant1V21",
"UNCInfant2V21",
"UNCInfant0V22",
"UNCInfant1V22",
"UNCInfant2V22",
"UNCInfant0V23",
"UNCInfant1V23",
"UNCInfant2V23"
],
"@@@_ieeg_type_@@@": [
"edf",
"vhdr",
"vmrk",
"eeg",
"set",
"fdt",
"nwb",
"mefd[\\/\\\\].*"
],
"@@@_ieeg_ext_@@@": [
"_events\\.json",
"_events\\.tsv",
"_electrodes\\.json",
"_electrodes\\.tsv",
"_channels\\.json",
"_channels\\.tsv",
"_ieeg\\.json",
"_coordsystem\\.json",
"_photo\\.jpg"
],
"@@@_cont_ext_@@@": [
"_physio\\.tsv\\.gz",
"_stim\\.tsv\\.gz",
"_physio\\.json",
"_stim\\.json"
]
}
},

"eeg_ses": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_space-(@@@_eeg_space_@@@))?(@@@_eeg_ses_type_@@@)$",
"tokens": {
"@@@_eeg_ses_type_@@@": [
"_events.tsv",
"_channels.tsv",
"_channels.json",
"_electrodes.tsv",
"_electrodes.json",
"_eeg.json",
"_coordsystem.json",
"_photo.jpg"
],
"@@@_eeg_space_@@@": [
"Other",
"CapTrak",
"CTF",
"ElektaNeuromag",
"4DBti",
"KitYokogawa",
"ChietiItab",
"ICBM452AirSpace",
"ICBM452Warp5Space",
"IXI549Space",
"fsaverage",
"fsaverageSym",
"fsLR",
"MNIColin27",
"MNI152Lin",
"MNI152NLin2009aSym",
"MNI152NLin2009bSym",
"MNI152NLin2009cSym",
"MNI152NLin2009aAsym",
"MNI152NLin2009bAsym",
"MNI152NLin2009cAsym",
"MNI152NLin6Sym",
"MNI152NLin6ASym",
"MNI305",
"NIHPD",
"OASIS30AntsOASISAnts",
"OASIS30Atropos",
"Talairach",
"UNCInfant",
"fsaverage3",
"fsaverage4",
"fsaverage5",
"fsaverage6",
"fsaveragesym",
"UNCInfant0V21",
"UNCInfant1V21",
"UNCInfant2V21",
"UNCInfant0V22",
"UNCInfant1V22",
"UNCInfant2V22",
"UNCInfant0V23",
"UNCInfant1V23",
"UNCInfant2V23"
]
}
},
"ieeg_ses": {
"regexp": "^[\\/\\\\](sub-[a-zA-Z0-9]+)[\\/\\\\](?:(ses-[a-zA-Z0-9]+)[\\/\\\\])?\\1(_\\2)?(?:_task-[a-zA-Z0-9]+)?(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:_space-(@@@_ieeg_space_@@@))?(@@@_ieeg_ses_type_@@@)$",
"tokens": {
"@@@_ieeg_ses_type_@@@": [
"_events.tsv",
"_channels.tsv",
"_channels.json",
"_electrodes.tsv",
"_electrodes.json",
"_ieeg.json",
"_coordsystem.json",
"_photo.jpg"
],
"@@@_ieeg_space_@@@": [
"Other",
"Pixels",
"ACPC",
"ICBM452AirSpace",
"ICBM452Warp5Space",
"IXI549Space",
"fsaverage",
"fsaverageSym",
"fsLR",
"MNIColin27",
"MNI152Lin",
"MNI152NLin2009aSym",
"MNI152NLin2009bSym",
"MNI152NLin2009cSym",
"MNI152NLin2009aAsym",
"MNI152NLin2009bAsym",
"MNI152NLin2009cAsym",
"MNI152NLin6Sym",
"MNI152NLin6ASym",
"MNI305",
"NIHPD",
"OASIS30AntsOASISAnts",
"OASIS30Atropos",
"Talairach",
"UNCInfant",
"fsaverage3",
"fsaverage4",
"fsaverage5",
"fsaverage6",
"fsaveragesym",
"UNCInfant0V21",
"UNCInfant1V21",
"UNCInfant2V21",
"UNCInfant0V22",
"UNCInfant1V22",
"UNCInfant2V22",
"UNCInfant0V23",
"UNCInfant1V23",
"UNCInfant2V23"
]
}
}
}

"eeg_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:@@@_eeg_top_ext_@@@)$",
"tokens": {
"@@@_eeg_top_ext_@@@": [
"_eeg\\.json",
"_channels\\.tsv",
"_channels\\.json",
"_electrodes\\.tsv",
"_electrodes\\.json",
"_photo\\.jpg",
"_coordsystem\\.json"
]
}
},
"ieeg_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:@@@_ieeg_top_ext_@@@)$",
"tokens": {
"@@@_ieeg_top_ext_@@@": [
"_ieeg\\.json",
"_channels\\.tsv",
"_channels\\.json",
"_electrodes\\.tsv",
"_electrodes\\.json",
"_photo\\.jpg",
"_coordsystem\\.json"
]
}
},
"meg_top": {
"regexp": "^[\\/\\\\](?:ses-[a-zA-Z0-9]+_)?task-[a-zA-Z0-9]+(?:_acq-[a-zA-Z0-9]+)?(?:_proc-[a-zA-Z0-9]+)?(?:@@@_meg_top_ext_@@@)$",
"tokens": {
"@@@_meg_top_ext_@@@": [
"_meg\\.json",
"_channels\\.tsv",
"_channels\\.json",
"_photo\\.jpg",
"_coordsystem\\.json"
]
}
},

Overall the regexps are getting unwieldy ... we should move towards building the regexps from the BIDS schema

@Remi-Gau
Copy link
Contributor

Remi-Gau commented May 1, 2023

Landed on this while investigating an issue from bids matlab bids-standard/bids-matlab#542

Just to know: is it worth putting effort into creating regex that match the schema or wait for the validator to directly use the schema.

@sappelhoff
Copy link
Member Author

Just to know: is it worth putting effort into creating regex that match the schema or wait for the validator to directly use the schema.

I think at this point we should wait for the schema based validator to take over and invest our time in effort in more urgent issues. However if you want to dive into this, it'd still be helpful.

@Remi-Gau
Copy link
Contributor

Remi-Gau commented May 2, 2023

if you want to dive into this

irony: on

oh yes!!!! I love writing complex regex to parse file names!!!

irony: off

OK let's wait then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants