Skip to content

Commit 435eb3d

Browse files
authored
Merge pull request #136 from cpp-lln-lab/doc
[WIP] general update of the documentation
2 parents 28dac87 + 21c840d commit 435eb3d

36 files changed

+514
-455
lines changed

README.md

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,11 @@ A set of function for matlab and octave to create
4848
structure and filenames for the output of behavioral, EEG, fMRI, eyetracking
4949
studies.
5050

51-
## Output format
52-
53-
### Modality agnostic aspect
54-
55-
Subjects, session and run number labels will be numbers with zero padding up to
56-
3 values (e.g subject 1 will become `sub-001`).
57-
58-
A session folder will ALWAYS be created even if not requested (default will be
59-
`ses-001`).
60-
61-
Task labels will be printed in camelCase in the filenames.
62-
63-
Time stamps are added directly in the filename by adding a suffix
64-
`_date-YYYYMMDDHHMM` which makes the file name non-BIDS compliant. This was
65-
added to prevent overwriting files in case a certain run needs to be done a
66-
second time because of a crash (Some of us are paranoid about keeping even
67-
cancelled runs during my experiments). This suffix should be removed to make the
68-
data set BIDS compliant. See `convertSourceToRaw.m` for more details.
69-
70-
For example:
71-
72-
```bash
73-
sub-090/ses-003/sub-090_ses-003_task-auditoryTask_run-023_events_date-202007291536.tsv
74-
```
75-
7651
## Documentation
7752

7853
- [Installation](./docs/installation.md)
7954
- [How to use it: jupyter notebooks](./notebooks)
80-
- [Functions description](./docs/functions-description.md)
55+
- [General documentation](https://cpp-bids.readthedocs.io/en/dev/index.html)
8156

8257
## Contributing
8358

@@ -90,7 +65,7 @@ or you get stuck: it is more likely we did not do good enough a job at
9065
explaining things. So do not hesitate to open an issue, just to ask for
9166
clarification.
9267

93-
### Guidestyle
68+
### Style guide
9469

9570
- We use camelCase.
9671

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```bash
66
virtualenv -p python3 cpp_bids
7-
source cpp_spm/bin/activate
7+
source cpp_bids/bin/activate
88

99
pip install -r requirements.txt
1010
```

docs/functions-description.md

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,14 @@
55
<!-- TOC -->
66

77
- [functions description](#functions-description)
8-
- [userInputs](#userinputs)
98
- [createFilename](#createfilename)
109
- [saveEventsFile](#saveeventsfile)
11-
- [checkCFG](#checkcfg)
12-
- [CFG content](#cfg-content)
1310
- [createBoldJson](#createboldjson)
1411

1512
<!-- /TOC -->
1613

1714
<!-- lint enable -->
1815

19-
## userInputs
20-
21-
Get subject, run and session number and make sure they are positive integer
22-
values.
23-
24-
By default this will return `cfg.subject.session = 1` even if you asked it to
25-
omit enquiring about sessions. This means that the folder tree will always
26-
include a session folder.
27-
28-
```matlab
29-
[cfg] = userInputs(cfg)
30-
```
31-
32-
If you use it with `cfg.subject.askGrpSess = [0 0]`, it won't ask you about
33-
group or session.
34-
35-
If you use it with `cfg.subject.askGrpSess = [1]`, it will only ask you about
36-
group
37-
38-
If you use it with `cfg.subject.askGrpSess = [0 1]`, it will only ask you about
39-
session
40-
41-
If you use it with `cfg.subject.askGrpSess = [1 1]`, it will ask you about both.
42-
This is the default behavior.
43-
4416
## createFilename
4517

4618
Create the BIDS compliant directories and filenames (but not the files) for the
@@ -64,76 +36,6 @@ Function to save output files for events that will be BIDS compliant.
6436
If the user DOES NOT provide `onset`, `trial_type`, this events will be skipped.
6537
`duration` will be set to `n/a` if no value is provided.
6638

67-
## checkCFG
68-
69-
Check that we have all the fields that we need in the experiment parameters.
70-
71-
### CFG content
72-
73-
```matlab
74-
% The following can be modified by users but their effect might
75-
% only be effective after running checkCFG
76-
77-
cfg.verbose = 0;
78-
79-
cfg.subject.subjectGrp = '';
80-
cfg.subject.sessionNb = 1;
81-
cfg.subject.askGrpSess = [true true];
82-
83-
% BOLD MRI details
84-
% some of those will be transferred to the correct fields in cfg.bids by checkCFG
85-
cfg.mri.repetitionTime = [];
86-
cfg.mri.contrastEnhancement = [];
87-
cfg.mri.phaseEncodingDirection = [];
88-
cfg.mri.reconstruction = [];
89-
cfg.mri.echo = [];
90-
cfg.mri.acquisition = [];
91-
92-
cfg.fileName.task = '';
93-
cfg.fileName.zeroPadding = 3; % amount of 0 padding the subject, session, run number
94-
95-
cfg.eyeTracker.do = false;
96-
97-
% content of the json side-car file for bold data
98-
cfg.bids.mri.RepetitionTime = [];
99-
cfg.bids.mri.SliceTiming = '';
100-
cfg.bids.mri.TaskName = '';
101-
cfg.bids.mri.Instructions = '';
102-
cfg.bids.mri.TaskDescription = '';
103-
104-
% content of the json side-car file for MEG
105-
cfg.bids.meg.TaskName = '';
106-
cfg.bids.meg.SamplingFrequency = [];
107-
cfg.bids.meg.PowerLineFrequency = [];
108-
cfg.bids.meg.DewarPosition = [];
109-
cfg.bids.meg.SoftwareFilters = [];
110-
cfg.bids.meg.DigitizedLandmarks = [];
111-
cfg.bids.meg.DigitizedHeadPoints = [];
112-
113-
% content of the datasetDescription.json file
114-
cfg.bids.datasetDescription.Name = '';
115-
cfg.bids.datasetDescription.BIDSVersion = '';
116-
cfg.bids.datasetDescription.License = '';
117-
cfg.bids.datasetDescription.Authors = {''};
118-
cfg.bids.datasetDescription.Acknowledgements = '';
119-
cfg.bids.datasetDescription.HowToAcknowledge = '';
120-
cfg.bids.datasetDescription.Funding = {''};
121-
cfg.bids.datasetDescription.ReferencesAndLinks = {''};
122-
cfg.bids.datasetDescription.DatasetDOI = '';
123-
124-
125-
%% Should not be modified by users
126-
% many of those fields are set up by checkCFG and you might get output that is not BIDS valid if you touch those
127-
cfg.fileName.dateFormat = 'yyyymmddHHMM'; % actual date of the experiment that is appended to the filename
128-
cfg.fileName.modality
129-
cgf.fileName.suffix.mri
130-
cgf.fileName.suffix.meg
131-
cfg.fileName.stim
132-
cfg.fileName.events
133-
cfg.fileName.datasetDescription
134-
135-
```
136-
13739
## createBoldJson
13840

13941
```bash

docs/source/contributing.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
Contributing
2-
************
1+
How to contribute to this project
2+
*********************************
33

4-
How to contribute to this project.
4+
For more details please check the `contributing guidelines <https://github.com/cpp-lln-lab/.github/blob/main/CONTRIBUTING.md>`_
5+
on the CPP lab's Github organization.
56

67

78
Function templates

docs/source/function_description.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ List of functions in the ``src`` folder.
77

88
.. automodule:: src
99

10-
.. autofunction:: checkCFG
1110
.. autofunction:: convertSourceToRaw
1211
.. autofunction:: createDataDictionary
1312
.. autofunction:: createDatasetDescription

docs/source/gui.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Graphic interface
2+
*****************
3+
4+
List of functions in the ``gui`` folder: those are mostly to handle the "graphic interface"
5+
that can be used to deal with ``userInputs()``.
6+
7+
----
8+
9+
.. automodule:: src.gui
10+
11+
.. autofunction:: askForGroupAndOrSession
12+
.. autofunction:: askUserGui
13+
.. autofunction:: createQuestionList
14+
.. autofunction:: getIsQuestionToAsk
15+
.. autofunction:: setDefaultResponses
16+
17+

docs/source/index.rst

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
.. cpp_bids_spm documentation master file, created by
2-
sphinx-quickstart on Tue Oct 13 11:38:30 2020.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
1+
.. cpp_bids documentation master file
52
63
Welcome to CPP BIDS documentation!
74
**********************************
@@ -10,17 +7,47 @@ Welcome to CPP BIDS documentation!
107
:maxdepth: 2
118
:caption: Content
129

10+
set_up
1311
function_description
1412
utilities
13+
gui
1514
contributing
1615

17-
This pipeline contains a set of functions to run fMRI analysis on a
18-
[BIDS data set](https://bids.neuroimaging.io/) using SPM12.
16+
A set of function for matlab and octave to create
17+
`BIDS-compatible <https://bids-specification.readthedocs.io/en/stable/>`_
18+
structure and filenames for the output of behavioral, EEG, fMRI, eyetracking
19+
experiments.
1920

21+
Output format
22+
=============
2023

24+
Modality agnostic aspect
25+
------------------------
2126

27+
The files created by this toolbox will always follow the following pattern::
2228

29+
dataDir/sub-<[Group]SubNb>/ses-sesNb/sub-<[Group]SubNb>_ses-<sesNb>_task-<taskName>*_modality_date-*.fileExtension
2330

31+
Subjects, session and run number labels will be numbers with zero padding up (default is set to
32+
3, meaning that subject 1 will become ``sub-001``).
33+
34+
The ``Group`` name is optional.
35+
36+
A session folder will ALWAYS be created even if not requested (default will be ``ses-001``).
37+
38+
Task labels will be printed in ``camelCase`` in the filenames.
39+
40+
Time stamps are added directly in the filename by adding a suffix
41+
``_date-*`` (default format is ``YYYYMMDDHHMM``) which makes the file name non-BIDS compliant.
42+
This was added to prevent overwriting files in case a certain run needs to be done
43+
a second time because of a crash.
44+
Some of us are paranoid about keeping even cancelled runs during my experiments.
45+
This suffix should be removed to make the data set BIDS compliant.
46+
See ``convertSourceToRaw()`` for more details.
47+
48+
For example::
49+
50+
/user/bob/dataset002/sub-090/ses-003/sub-090_ses-003_task-auditoryTask_run-023_events_date-202007291536.tsv
2451

2552

2653
Indices and tables

docs/source/set_up.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Setting up your experiment
2+
**************************
3+
4+
Configuration
5+
=============
6+
7+
.. todo:
8+
describe how to set things up
9+
10+
11+
.. automodule:: src
12+
.. autofunction:: checkCFG
13+
14+
.. automodule:: src.utils
15+
.. autofunction:: transferInfoToBids
16+
17+
.. todo:
18+
0: almost nothing gets printed on screen
19+
1: allows saveEvents to print stuff when saving to file or createFilename to tell you where things will be saved
20+
2: let printCredits do its job and lets saveEvents print extra info when it sends some warning.
21+
22+
Group, subject, session and run
23+
===============================
24+
25+
You can use the ``userInputs()`` function to easily set the group name as well as
26+
the subject, session and run number. You can ask the function to not bother you with
27+
group and session
28+
29+
30+
.. todo:
31+
32+
Get subject, run and session number and make sure they are positive integer
33+
values.
34+
35+
By default this will return `cfg.subject.session = 1` even if you asked it to
36+
omit enquiring about sessions. This means that the folder tree will always
37+
include a session folder.
38+
39+
```matlab
40+
[cfg] = userInputs(cfg)
41+
```
42+
43+
If you use it with `cfg.subject.askGrpSess = [0 0]`, it won't ask you about
44+
group or session.
45+
46+
If you use it with `cfg.subject.askGrpSess = [1]`, it will only ask you about
47+
group
48+
49+
If you use it with `cfg.subject.askGrpSess = [0 1]`, it will only ask you about
50+
session
51+
52+
If you use it with `cfg.subject.askGrpSess = [1 1]`, it will ask you about both.
53+
This is the default behavior.

docs/source/utilities.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ List of functions in the ``utils`` folder.
1919
.. autofunction:: returnNamesExtraColumns
2020
.. autofunction:: returnNbColumns
2121
.. autofunction:: setDefaultFields
22-
.. autofunction:: transferInfoToBids
22+
23+
.. automodule:: src.gui
24+
25+
.. autofunction:: askUserCli

0 commit comments

Comments
 (0)