I would like to use bidsmapper
to create an initial bidsmap.yaml
that maps my sourcedata to rawdata. My sourcedata folder structure looks like:
./sourcedata/
├── NMAR09_2
├── NMAR19_2
├── NMAR27_2
├── NMHO04_3
├── NMHO15_2
├── NMHO17_3
├── NMHO23_2
├── NMHO27_1
└── NMKS09_1
where everything before the underscore defines the subject id and the number behind the underscore defines the session id. Is it possible to pass regular expression to bidsmapper ./sourcedata ./rawdata --subprefix ... --sesprefix ...
so that I can instruct bidscoin on how to interpret the folder names?
Hi Johannes,
I guess (haven’t tested it) that the following participant/session values may perhaps work?
participant:
participant_id: &participant_id
value: <<filepath:/(.*?)_.*?/>>
session_id: &session_id
value: <<filepath:/.*?_(.*?)/>>
The above is how the raw bidsmap looks like, in the GUI you can just edit the values to filepath:/(.*?)_.*?/
and filepath:/.*?_(.*?)/
If your path underspecified, you can add part of the leading names, e.g. filepath:/sourcedata/(.*?)_.*?/
etc
@Marcel_Zwiers : It is not possible to implement this logic directly in the bidsmapper
command right? It worked though! I followed your suggestion and first ran:
bidsmapper ./sourcedata ./rawdata --subprefix "*" --sesprefix "*"
using both the asterisks for the subject and session as :
Use ‘*’ when your subject folders do not have a prefix. Default: the value of the study/template bidsmap, e.g. ‘sub-’
Use ‘*’ when your session folders do not have a prefix. Default: the value of the study/template bidsmap, e.g. ‘ses-’
Then I used the GUI of the bidseditor and set participant id and session id to:
participant_id <<filepath:/sourcedata/(.*?)_.*?/>>
session_id <<filepath:/sourcedata/.*?_(.*?)/>>
Correct, you need to enter the participant/session labels either directly in the template bidsmap (e.g. very useful if you have multiple studies that use the same naming scheme), or in the study bidsmap, i.e. using the GUI. Good to hear that it works!