Skip to content

Commit 8a83e02

Browse files
committed
update doc
1 parent f7f7244 commit 8a83e02

17 files changed

+408
-13
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@ name: Bug report
55

66
description: Fill in this template to report a bug
77

8-
title: "[BUG]: "
8+
title: "[BUG]"
99

10-
labels: ["bug"]
10+
labels: ["bug :bug:"]
1111

1212
body:
13+
14+
- type: markdown
15+
attributes:
16+
value: |
17+
Thanks for taking the time to fill out this bug report!
18+
19+
To maximize chances for a quick fix make sure you know
20+
[How to Report Bugs Effectively](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html)
21+
1322
- type: checkboxes
1423
attributes:
1524
label: Is there an existing issue for this?

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
1212
[![codecov](https://codecov.io/gh/cpp-lln-lab/CPP_SPM/branch/main/graph/badge.svg?token=PMQYH0DIPX)](https://codecov.io/gh/cpp-lln-lab/CPP_SPM)
1313
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3554331.svg)](https://doi.org/10.5281/zenodo.3554331)
14-
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](https://github.com/cpp-lln-lab/CPP_SPM#contributors)
14+
[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](https://github.com/cpp-lln-lab/CPP_SPM#contributors)
1515

1616
<!-- markdown-link-check-enable -->
1717

@@ -58,7 +58,6 @@ See
5858
### Preprocessing
5959

6060
```matlab
61-
6261
bids_dir = path_to_raw_bids_dataset;
6362
output_dir = path_to_where_the_output_should_go;
6463
@@ -73,7 +72,6 @@ cpp_spm(bids_dir, output_dir, 'subject', ...
7372
### GLM
7473

7574
```matlab
76-
7775
bids_dir = path_to_raw_bids_dataset;
7876
preproc_dir = path_to_preprocessed_dataset;
7977
output_dir = path_to_where_the_output_should_go;

docs/source/bids_stats_model.md

Lines changed: 142 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ It uses
9292
to run those transformations. Please see this bids-matlab documentation to know
9393
how to use them and call them in your JSON.
9494

95-
The advantage of this bids-matlab transformers is
96-
that they allow you to directly add on tsv files to quickly see
97-
what outcome a series of transformers will produce.
95+
The advantage of this bids-matlab transformers is that they allow you to
96+
directly add on tsv files to quickly see what outcome a series of transformers
97+
will produce.
9898

9999
Below is an example on how to subtract 3 seconds from the event onsets of the
100100
conditions `motion` listed in the `trial_type` columns of the `events.tsv` file,
@@ -151,7 +151,7 @@ dummy scans will be included.
151151
"static"
152152
],
153153
"Model": "spm"
154-
}
154+
}
155155
```
156156

157157
`HRF` specifies:
@@ -169,13 +169,40 @@ Not yet implementated:
169169

170170
- `"fir"`
171171

172+
```json
173+
"Model": {
174+
"Type": "glm",
175+
"X": [
176+
"motion", -------- Those 2 conditions will be convolved
177+
"static", -------| using the canonical HRF only.
178+
Those 3 conditions <-------"trans_?", |
179+
will not <-------"rot_?", |
180+
be convolved. <-------"*outlier*" |
181+
], |
182+
"HRF": { |
183+
"Variables": [ |
184+
"motion", <--|
185+
"static" <--|
186+
],
187+
"Model": "spm"
188+
}
189+
```
190+
191+
```{image} ./images/gui_batch_model_hrf.png
192+
:alt: Corresponding options in SPM batch
193+
:align: center
194+
```
195+
172196
(bids_stats_model_sofware)=
173197

174198
### Software
199+
175200
<!-- markdown-link-check-disable -->
201+
176202
Note that if you wanted to change the
177203
[`SerialCorrelation` model](auto_correlation_model) used by CPP SPM, you could
178204
do so via the `Software` object of the BIDS stats model.
205+
179206
<!-- markdown-link-check-enable -->
180207

181208
Similar you can adapt directly in the model the threshold used by SPM to create
@@ -207,6 +234,111 @@ of SPM defaults.) .
207234
}
208235
```
209236

237+
```{figure} ./images/gui_batch_model_serialCorrelation_maskThresh.png
238+
---
239+
name: software_spm_batch
240+
align: center
241+
---
242+
Corresponding options in SPM batch
243+
```
244+
245+
### Contrasts
246+
247+
#### Run level
248+
249+
To stay close to the way most SPM users are familiar with, all runs are analyzed
250+
in one single GLM.
251+
252+
Contrasts are the run level that are either specified using `DummyContrasts` or
253+
`Contrasts` will be computed and will have the run number appended to their name
254+
in the SPM gui as shown in {ref}`contrast_run_1` and {ref}`contrast_run_2`.
255+
256+
```{literalinclude} ./examples/model-contrastsRun_smdl.json
257+
:language: json
258+
```
259+
260+
```{figure} ./images/gui_contrast_run_1.png
261+
---
262+
name: contrast_run_1
263+
align: center
264+
---
265+
Contrast for run 1
266+
```
267+
268+
```{figure} ./images/gui_contrast_run_2.png
269+
---
270+
name: contrast_run_2
271+
align: center
272+
---
273+
Contrast for run 2
274+
```
275+
276+
#### Subject level
277+
278+
At the moment the only type of model supported at the run level is averaging of
279+
run level contrasts.
280+
281+
```{literalinclude} ./examples/model-contrastsSubject_smdl.json
282+
:language: json
283+
```
284+
285+
```{figure} ./images/gui_contrast_run_1_and_2.png
286+
---
287+
name: contrast_subject
288+
align: center
289+
---
290+
Subject level contrast averaging beta of run 1 and 2
291+
```
292+
293+
## Dataset level
294+
295+
At the moment only, the only type of models that are supported are:
296+
297+
- one sample t-test: averaging across all subjects
298+
299+
```{literalinclude} ./examples/model-datasetLevel_smdl.json
300+
:language: json
301+
```
302+
303+
- one sample t-test: averaging across all subjects of a specific group
304+
305+
```{literalinclude} ./examples/model_withinGroup_smdl.json
306+
:language: json
307+
```
308+
309+
- 2 samples t-test: comparing 2 groups
310+
311+
At the moment this can only be based on how participants are allocated to a
312+
group based on a `group` or `Group` column in the `participants.tsv` of in the
313+
raw dataset.
314+
315+
```{literalinclude} ./examples/model_betweenGroups_smdl.json
316+
:language: json
317+
```
318+
319+
### Method section
320+
321+
It is possible to write a draft of method section based on a BIDS statistical
322+
model.
323+
324+
```matlab
325+
opt.model.file = fullfile(pwd, ...
326+
'models', ...
327+
'model-faceRepetition_smdl.json');
328+
opt.fwhm.contrast = 0;
329+
opt = checkOptions(opt);
330+
331+
opt.designType = 'block';
332+
333+
outputFile = boilerplate(opt, ...
334+
'outputPath', pwd, ...
335+
'pipelineType', 'stats');
336+
```
337+
338+
```{literalinclude} ./examples/stats.md
339+
:language: markdown
340+
```
341+
210342
## Parametric modulation
211343

212344
Those are not yet fully implemented but there is an example of how to get
@@ -224,8 +356,13 @@ There are several examples of models in the
224356
[model zoo](https://github.com/bids-standard/model-zoo) along with links to
225357
their datasets.
226358

227-
Several of the :ref:`demos` have their own model and you can find several
359+
<!-- markdown-link-check-disable -->
360+
361+
Several of the [demos](demos) have their own model and you can find several
228362
"dummy" models (without corresponding data) used for testing
363+
364+
<!-- markdown-link-check-enable -->
365+
229366
[in this folder](https://github.com/cpp-lln-lab/CPP_SPM/tree/dev/tests/dummyData/models).
230367

231368
An example of JSON file could look something like that:

docs/source/demos.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _demos:
2-
31
Demos
42
*****
53

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"Level": "Run",
3+
"Name": "run_level",
4+
"X": [
5+
"olfid_eucalyptus_left",
6+
"olfid_eucalyptus_right",
7+
"olfid_almond_left",
8+
"olfid_almond_right",
9+
"olfloc_eucalyptus_left",
10+
"olfloc_eucalyptus_right",
11+
"olfloc_almond_left",
12+
"olfloc_almond_right",
13+
"resp_03",
14+
"resp_12",
15+
1
16+
],
17+
"DummyContrasts": {
18+
"Contrasts": [
19+
"olfid_eucalyptus_left",
20+
"olfid_eucalyptus_right",
21+
"olfid_almond_left",
22+
"olfid_almond_right",
23+
"olfloc_eucalyptus_left",
24+
"olfloc_eucalyptus_right",
25+
"olfloc_almond_left",
26+
"olfloc_almond_right"
27+
],
28+
"Test": "t"
29+
},
30+
"Contrasts": [
31+
{
32+
"Name": "olfid",
33+
"ConditionList": [
34+
"olfid_eucalyptus_left",
35+
"olfid_eucalyptus_right",
36+
"olfid_almond_left",
37+
"olfid_almond_right"
38+
],
39+
"Weights": [
40+
1,
41+
1,
42+
1,
43+
1
44+
],
45+
"Test": "t"
46+
}
47+
]
48+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"Level": "Subject",
3+
"Name": "subject_level",
4+
"Description": "Only averaging at the subject level is supported for now.",
5+
"GroupBy": [
6+
"contrast",
7+
"subject"
8+
],
9+
"Model": {
10+
"X": [
11+
1
12+
],
13+
"Type": "glm"
14+
},
15+
"DummyContrasts": {
16+
"Test": "t"
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"Level": "Dataset",
3+
"Name": "dataset_level",
4+
"GroupBy": [
5+
"contrast"
6+
],
7+
"Model": {
8+
"X": [
9+
1
10+
],
11+
"Type": "glm"
12+
},
13+
"DummyContrasts": {
14+
"Test": "t"
15+
}
16+
}

0 commit comments

Comments
 (0)