55
66A set of function for matlab and octave to create [ BIDS-compatible] ( https://bids-specification.readthedocs.io/en/stable/ ) folder structure and filenames for the output of behavioral, EEG, fMRI, eyetracking studies.
77
8- Here are the naming templates used.
9-
10- - BOLD
11-
12- ` sub-<label>[_ses-<label>]_task-<label>[_acq-<label>][_ce-<label>][_dir-<label>][_rec-<label>][_run-<index>][_echo-<index>]_<contrast_label>.nii[.gz] `
13-
14- - iEEG
15-
16- ` sub-<label>[_ses-<label>]_task-<task_label>[_run-<index>]_ieeg.json `
17-
18- - EEG
19-
20- ` sub-<label>[_ses-<label>]_task-<label>[_run-<index>]_eeg.<manufacturer_specific_extension> `
21-
22- - Eyetracker
8+ ## Usage
239
24- ` sub-<participant_label>[_ses-<label>][_acq-<label>]_task-<task_label>_eyetrack.<manufacturer_specific_extension> `
10+ ``` matlab
2511
26- ## Contributing
12+ % define the folder where the data will be saved
13+ expParameters.outputDir = fullfile(pwd, '..', 'output');
2714
28- Feel free to open issues to report a bug and ask for improvements.
15+ % define the name of the task
16+ expParameters.task = 'testtask';
2917
30- ### Guidestyle
18+ % can use the userInputs function to collect subject info
19+ % expParameters = userInputs;
3120
32- - We use camelCase.
33- - We keep the McCabe complexity as reported by the [ check_my_code function] ( https://github.com/Remi-Gau/matlab_checkcode ) below 15.
21+ % or declare it directly
22+ expParameters.subjectGrp = '';
23+ expParameters.subjectNb = 1;
24+ expParameters.sessionNb = 1;
25+ expParameters.runNb = 1;
3426
35- ## How to install
27+ % Use the verbose switch to know where your data is being saved
28+ expParameters.verbose = true;
3629
37- ### Use the matlab package manager
30+ % In case you are using en eyetracker
31+ cfg.eyeTracker = false;
3832
39- This repository can be added as a dependencies by listing it in a [ mpm-requirements.txt file] ( .mpm-requirements.txt )
40- as follows:
33+ % if the device is set to 'PC' then the data will be saved
34+ % in the `beh` folder
35+ cfg.device = 'PC';
4136
42- ```
43- CPP_BIDS -u https://github.com/cpp-lln-lab/CPP_BIDS.git
44- ```
37+ % if the device is set to 'scanner' then the data will be saved
38+ % in the `func` folder
39+ % cfg.device = 'scanner';
4540
46- You can then use the [ matlab package manager] ( https://github.com/mobeets/mpm ) , to simply download the appropriate version of those dependencies and add them to your path by running a ` getDependencies ` function like the one below where you just need to replace ` YOUR_EXPERIMENT_NAME ` by the name of your experiment.
41+ % check that cfg and exparameters have all the necessary information
42+ % and fill in any missing field
43+ expParameters = checkCFG(cfg, expParameters);
4744
45+ % create the filenames
46+ expParameters = createFilename(cfg, expParameters);
4847
49- ``` matlab
50- function getDependencies(action)
51- % Will install on your computer the matlab dependencies specified in the mpm-requirements.txt
52- % and add them to the matlab path. The path is never saved so you need to run getDependencies() when
53- % you start matlab.
54- %
55- % getDependencies('update') will force the update and overwrite previous version of the dependencies.
56- %
57- % getDependencies() If you only already have the appropriate version but just want to add them to the matlab path.
48+ % initialize the events files with the typical BIDS
49+ % columns (onsets, duration, trial_type)
50+ % and add some more in this case (Speed and is_Fixation)
51+ logFile = saveEventsFile('open', expParameters, [], 'Speed', 'is_Fixation');
5852
59- experimentName = YOUR_EXPERIMENT_NAME;
53+ % create the information about 2 events that we want to save
54+ logFile(1,1).onset = 2;
55+ logFile(1,1).trial_type = 'motion_up';
56+ logFile(1,1).duration = 1;
57+ logFile(1,1).speed = 2;
58+ logFile(1,1).is_fixation = true;
6059
61- if nargin<1
62- action = '';
63- end
60+ logFile(2,1).onset = 3;
61+ logFile(2,1).trial_type = 'static';
62+ logFile(2,1).duration = 4;
63+ logFile(2,1).is_fixation = 3;
6464
65- switch action
66- case 'update'
67- % install dependencies
68- mpm install -i mpm-requirements.txt -f -c YOUR_EXPERIMENT_NAME
69- end
65+ % add those 2 events to the events.tsv file
66+ saveEventsFile('save', expParameters, logFile, 'speed', 'is_fixation');
7067
71- % adds them to the path
72- mpm_folder = fileparts(which('mpm'));
73- addpath(genpath(fullfile(mpm_folder, 'mpm-packages', 'mpm-collections', experimentName)));
68+ % close the file
69+ saveEventsFile('close', expParameters, logFile);
7470
75- end
7671```
7772
7873## Functions descriptions
8176
8277Get subject, run and session number and make sure they are positive integer values.
8378
84-
8579### createFilename
8680
87- Create the BIDS compliant directories and filenames (but not the files) for the behavioral output for this subject /
88- session / run.
81+ Create the BIDS compliant directories and filenames (but not the files) for the behavioral
82+ output for this subject / session / run.
8983
9084Will also create the right filename for the eye-tracking data file.
9185
@@ -98,89 +92,79 @@ For the moment the date of acquisition is appended to the filename
9892
9993Function to save output files for events that will be BIDS compliant.
10094
101-
10295### checkCFG
10396Check that we have all the fields that we need in the experiment parameters.
10497
98+ ## How to install
10599
106- ## Usage
100+ ### Use the matlab package manager
107101
108- ``` matlab
102+ This repository can be added as a dependencies by listing it in a
103+ [ mpm-requirements.txt file] ( .mpm-requirements.txt ) as follows:
109104
110- % define the folder where the data will be saved
111- expParameters.outputDir = fullfile(pwd, '..', 'output');
105+ ```
106+ CPP_BIDS -u https://github.com/cpp-lln-lab/CPP_BIDS.git
107+ ```
112108
113- % define the name of the task
114- expParameters.task = 'testtask';
109+ You can then use the [ matlab package manager] ( https://github.com/mobeets/mpm ) , to simply download
110+ the appropriate version of those dependencies and add them to your path by running a
111+ ` getDependencies ` function like the one below where you just need to replace
112+ ` YOUR_EXPERIMENT_NAME ` by the name of your experiment.
115113
116- % can use the userInputs function to collect subject info
117- % expParameters = userInputs;
114+ ``` matlab
115+ function getDependencies(action)
116+ % Will install on your computer the matlab dependencies specified in the mpm-requirements.txt
117+ % and add them to the matlab path. The path is never saved so you need to run getDependencies() when
118+ % you start matlab.
119+ %
120+ % getDependencies('update') will force the update and overwrite previous version of the dependencies.
121+ %
122+ % getDependencies() If you only already have the appropriate version but just want to add them to the matlab path.
118123
119- % or declare it directly
120- expParameters.subjectGrp = '';
121- expParameters.subjectNb = 1;
122- expParameters.sessionNb = 1;
123- expParameters.runNb = 1;
124+ experimentName = YOUR_EXPERIMENT_NAME;
124125
125- % Use the verbose switch to know where your data is being saved
126- expParameters.verbose = true;
126+ if nargin<1
127+ action = '';
128+ end
127129
128- % In case you are using en eyetracker
129- cfg.eyeTracker = false;
130+ switch action
131+ case 'update'
132+ % install dependencies
133+ mpm install -i mpm-requirements.txt -f -c YOUR_EXPERIMENT_NAME
134+ end
130135
131- % if the device is set to 'PC' then the data will be saved in the `beh` folder
132- cfg.device = 'PC';
136+ % adds them to the path
137+ mpm_folder = fileparts(which('mpm'));
138+ addpath(genpath(fullfile(mpm_folder, 'mpm-packages', 'mpm-collections', experimentName)));
133139
134- % if the device is set to 'scanner' then the data will be saved in the `func` folder
135- % cfg.device = 'scanner';
140+ end
141+ ```
136142
137- % check that cfg and exparameters have all the necessary information and fill in any missing field
138- expParameters = checkCFG(cfg, expParameters);
143+ ## Contributing
139144
140- % create the filenames
141- expParameters = createFilename(cfg, expParameters);
145+ Feel free to open issues to report a bug and ask for improvements.
142146
143- % initialize the events files with the typical BIDS columns (onsets, duration, trial_type)
144- % and add some more in this case (Speed and is_Fixation)
145- logFile = saveEventsFile('open', expParameters, [], 'Speed', 'is_Fixation');
147+ ### Guidestyle
146148
147- % create the information about 2 events that we want to save
148- logFile(1,1).onset = 2;
149- logFile(1,1).trial_type = 'motion_up';
150- logFile(1,1).duration = 1;
151- logFile(1,1).speed = 2;
152- logFile(1,1).is_fixation = true;
149+ - We use camelCase.
150+ - We keep the McCabe complexity as reported by the [ check_my_code function] ( https://github.com/Remi-Gau/matlab_checkcode ) below 15.
153151
154- logFile(2,1).onset = 3;
155- logFile(2,1).trial_type = 'static';
156- logFile(2,1).duration = 4;
157- logFile(2,1).is_fixation = 3;
152+ ### BIDS naming convention
158153
159- % add those 2 events to the events.tsv file
160- saveEventsFile('save', expParameters, logFile, 'speed', 'is_fixation');
154+ Here are the naming templates used.
161155
162- % close the file
163- saveEventsFile('close', expParameters, logFile);
156+ - BOLD
164157
165- ```
158+ ` sub-<label>[_ses-<label>]_task-<label>[_acq-<label>][_ce-<label>][_dir-<label>][_rec-<label>][_run-<index>][_echo-<index>]_<contrast_label>.nii[.gz] `
159+
160+ - iEEG
166161
167- ## Contributors ✨
162+ ` sub-<label>[_ses-<label>]_task-<task_label>[_run-<index>]_ieeg.json `
168163
169- Thanks goes to these wonderful people ( [ emoji key ] ( https://allcontributors.org/docs/en/emoji-key ) ):
164+ - EEG
170165
171- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
172- <!-- prettier-ignore-start -->
173- <!-- markdownlint-disable -->
174- <table >
175- <tr >
176- <td align="center"><a href="https://github.com/CerenB"><img src="https://avatars1.githubusercontent.com/u/10451654?v=4" width="100px;" alt=""/><br /><sub><b>CerenB</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS/commits?author=CerenB" title="Code">💻</a> <a href="#design-CerenB" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_BIDS/commits?author=CerenB" title="Documentation">📖</a></td>
177- <td align="center"><a href="https://github.com/marcobarilari"><img src="https://avatars3.githubusercontent.com/u/38101692?v=4" width="100px;" alt=""/><br /><sub><b>marcobarilari</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS/commits?author=marcobarilari" title="Code">💻</a> <a href="#design-marcobarilari" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_BIDS/commits?author=marcobarilari" title="Documentation">📖</a></td>
178- <td align="center"><a href="https://remi-gau.github.io/"><img src="https://avatars3.githubusercontent.com/u/6961185?v=4" width="100px;" alt=""/><br /><sub><b>Remi Gau</b></sub></a><br /><a href="https://github.com/cpp-lln-lab/CPP_BIDS/commits?author=Remi-Gau" title="Code">💻</a> <a href="#design-Remi-Gau" title="Design">🎨</a> <a href="https://github.com/cpp-lln-lab/CPP_BIDS/commits?author=Remi-Gau" title="Documentation">📖</a></td>
179- </tr >
180- </table >
166+ ` sub-<label>[_ses-<label>]_task-<label>[_run-<index>]_eeg.<manufacturer_specific_extension> `
181167
182- <!-- markdownlint-enable -->
183- <!-- prettier-ignore-end -->
184- <!-- ALL-CONTRIBUTORS-LIST:END -->
168+ - Eyetracker
185169
186- This project follows the [ all-contributors ] ( https://github.com/all-contributors/all-contributors ) specification. Contributions of any kind welcome!
170+ ` sub-<participant_label>[_ses-<label>][_acq-<label>]_task-<task_label>_eyetrack.<manufacturer_specific_extension> `
0 commit comments