|
| 1 | +# functions description |
| 2 | + |
| 3 | +<!-- vscode-markdown-toc --> |
| 4 | +* 1. [userInputs](#userInputs) |
| 5 | +* 2. [createFilename](#createFilename) |
| 6 | +* 3. [saveEventsFile](#saveEventsFile) |
| 7 | +* 4. [checkCFG](#checkCFG) |
| 8 | +* 5. [CFG content](#CFGcontent) |
| 9 | +* 6. [createBoldJson](#createBoldJson) |
| 10 | + |
| 11 | +<!-- vscode-markdown-toc-config |
| 12 | + numbering=true |
| 13 | + autoSave=true |
| 14 | + /vscode-markdown-toc-config --> |
| 15 | +<!-- /vscode-markdown-toc --> |
| 16 | + |
| 17 | +## 1. <a name='userInputs'></a>userInputs |
| 18 | + |
| 19 | +Get subject, run and session number and make sure they are positive integer values. |
| 20 | + |
| 21 | +By default this will return `cfg.subject.session = 1` even if you asked it to omit enquiring about sessions. This means |
| 22 | +that the folder tree will always include a session folder. |
| 23 | + |
| 24 | +```matlab |
| 25 | +[cfg] = userInputs(cfg) |
| 26 | +``` |
| 27 | + |
| 28 | +If you use it with `cfg.subject.askGrpSess = [0 0]`, it won't ask you about group or session. |
| 29 | + |
| 30 | +If you use it with `cfg.subject.askGrpSess = [1]`, it will only ask you about group |
| 31 | + |
| 32 | +If you use it with `cfg.subject.askGrpSess = [0 1]`, it will only ask you about session |
| 33 | + |
| 34 | +If you use it with `cfg.subject.askGrpSess = [1 1]`, it will ask you about both. This is the default behavior. |
| 35 | + |
| 36 | + |
| 37 | +## 2. <a name='createFilename'></a>createFilename |
| 38 | + |
| 39 | +Create the BIDS compliant directories and filenames (but not the files) for the behavioral output for this subject / session / run. |
| 40 | + |
| 41 | +The folder tree will always include a session folder. |
| 42 | + |
| 43 | +It will also create the right filename for the eye-tracking data file if you ask it. |
| 44 | + |
| 45 | +For the moment the date of acquisition is appended to the filename |
| 46 | +- can work for behavioral experiment if `cfg.testingDevice` is set to `pc`, |
| 47 | +- can work for fMRI experiment if `cfg.testingDevice` is set to `mri`, |
| 48 | +- can work for simple eyetracking data if `cfg.eyeTracker.do` is set to 1. |
| 49 | + |
| 50 | +## 3. <a name='saveEventsFile'></a>saveEventsFile |
| 51 | + |
| 52 | +Function to save output files for events that will be BIDS compliant. |
| 53 | + |
| 54 | +If the user DOES NOT provide `onset`, `trial_type`, this events will be skipped. `duration` will be set to `n/a` if no value is provided. |
| 55 | + |
| 56 | +## 4. <a name='checkCFG'></a>checkCFG |
| 57 | + |
| 58 | +Check that we have all the fields that we need in the experiment parameters. |
| 59 | + |
| 60 | +## 5. <a name='CFGcontent'></a>CFG content |
| 61 | + |
| 62 | +```matlab |
| 63 | +% The following can be modified by users but their effect might |
| 64 | +% only be effective after running checkCFG |
| 65 | +
|
| 66 | +cfg.verbose = 0; |
| 67 | +
|
| 68 | +cfg.subject.subjectGrp = ''; |
| 69 | +cfg.subject.sessionNb = 1; |
| 70 | +cfg.subject.askGrpSess = [true true]; |
| 71 | +
|
| 72 | +% BOLD MRI details |
| 73 | +% some of those will be transferred to the correct fields in cfg.bids by checkCFG |
| 74 | +cfg.mri.repetitionTime = []; |
| 75 | +cfg.mri.contrastEnhancement = []; |
| 76 | +cfg.mri.phaseEncodingDirection = []; |
| 77 | +cfg.mri.reconstruction = []; |
| 78 | +cfg.mri.echo = []; |
| 79 | +cfg.mri.acquisition = []; |
| 80 | +
|
| 81 | +cfg.fileName.task = ''; |
| 82 | +cfg.fileName.zeroPadding = 3; % amount of 0 padding the subject, session, run number |
| 83 | +
|
| 84 | +cfg.eyeTracker.do = false; |
| 85 | +
|
| 86 | +% content of the json side-car file for bold data |
| 87 | +cfg.bids.mri.RepetitionTime = []; |
| 88 | +cfg.bids.mri.SliceTiming = ''; |
| 89 | +cfg.bids.mri.TaskName = ''; |
| 90 | +cfg.bids.mri.Instructions = ''; |
| 91 | +cfg.bids.mri.TaskDescription = ''; |
| 92 | +
|
| 93 | +% content of the json side-car file for MEG |
| 94 | +cfg.bids.meg.TaskName = ''; |
| 95 | +cfg.bids.meg.SamplingFrequency = []; |
| 96 | +cfg.bids.meg.PowerLineFrequency = []; |
| 97 | +cfg.bids.meg.DewarPosition = []; |
| 98 | +cfg.bids.meg.SoftwareFilters = []; |
| 99 | +cfg.bids.meg.DigitizedLandmarks = []; |
| 100 | +cfg.bids.meg.DigitizedHeadPoints = []; |
| 101 | +
|
| 102 | +% content of the datasetDescription.json file |
| 103 | +cfg.bids.datasetDescription.Name = ''; |
| 104 | +cfg.bids.datasetDescription.BIDSVersion = ''; |
| 105 | +cfg.bids.datasetDescription.License = ''; |
| 106 | +cfg.bids.datasetDescription.Authors = {''}; |
| 107 | +cfg.bids.datasetDescription.Acknowledgements = ''; |
| 108 | +cfg.bids.datasetDescription.HowToAcknowledge = ''; |
| 109 | +cfg.bids.datasetDescription.Funding = {''}; |
| 110 | +cfg.bids.datasetDescription.ReferencesAndLinks = {''}; |
| 111 | +cfg.bids.datasetDescription.DatasetDOI = ''; |
| 112 | +
|
| 113 | +
|
| 114 | +%% Should not be modified by users |
| 115 | +% many of those fields are set up by checkCFG and you might get output that is not BIDS valid if you touch those |
| 116 | +cfg.fileName.dateFormat = 'yyyymmddHHMM'; % actual date of the experiment that is appended to the filename |
| 117 | +cfg.fileName.modality |
| 118 | +cgf.fileName.suffix.mri |
| 119 | +cgf.fileName.suffix.meg |
| 120 | +cfg.fileName.stim |
| 121 | +cfg.fileName.events |
| 122 | +cfg.fileName.datasetDescription |
| 123 | +
|
| 124 | +``` |
| 125 | + |
| 126 | +## 6. <a name='createBoldJson'></a>createBoldJson |
| 127 | + |
| 128 | +``` |
| 129 | +createBoldJson(cfg) |
| 130 | +``` |
| 131 | + |
| 132 | +This function creates a very light-weight version of the side-car JSON file for a BOLD functional run. |
| 133 | + |
| 134 | +This will only contain the minimum BIDS requirement and will likely be less complete than the info you could from DICOM conversion. |
| 135 | + |
| 136 | +If you put the following line at the end of your experiment script, it will dump the content of the `extraInfo` structure in the json file. |
| 137 | + |
| 138 | +``` |
| 139 | +createBoldJson(cfg, extraInfo) |
| 140 | +``` |
| 141 | + |
| 142 | +This allows to add all the parameters that you used to run your experiment in a human readable format: so that when you write your methods sections 2 years later ("the reviewer asked me for the size of my fixation cross... FML"), the info you used WHEN you ran the experiment is saved in an easily accessible text format. For the love of the flying spaghetti monster do not save all your parameters in a `.mat` file: think of the case when you won't have matlab or octave installed on a computer (plus not everyone uses those). |
| 143 | + |
| 144 | +Also to reading your experiment parameters, you won't have to read it from the `setParameters.m` file and wonder if those might have been modified when running the experiment and you did not commit and tagged that change with git. |
0 commit comments