Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
2ea24ce
minor fix in readAndFilterLogfile
marcobarilari Nov 16, 2020
7c52652
minor fix
marcobarilari Nov 16, 2020
f781603
update doc on createFilename
marcobarilari Nov 16, 2020
cc99e1e
Update src/createFilename.m
marcobarilari Nov 16, 2020
f7aa1eb
update doc on creatDataDictionary
marcobarilari Nov 16, 2020
093ea51
Merge remote-tracking branch 'origin/marco_dockhaton' into marco_dock…
marcobarilari Nov 16, 2020
ea52938
update doc for createQuestionList
marcobarilari Nov 16, 2020
753316f
update doc for askForGroupAndOrSession
marcobarilari Nov 16, 2020
9a50f6d
update doc in setDefaultResponses
marcobarilari Nov 16, 2020
3ad5c38
update on doc
CerenB Nov 16, 2020
943b869
update code for getIsQuestionToAsk
marcobarilari Nov 16, 2020
305a21c
minor fix
CerenB Nov 16, 2020
383efd6
mh fix
CerenB Nov 16, 2020
a0b9b6a
wording update
CerenB Nov 16, 2020
404510f
update docs for askUserCli
marcobarilari Nov 16, 2020
240c83f
added output
CerenB Nov 16, 2020
e2655ad
update docs for askUserGui
marcobarilari Nov 16, 2020
42967ae
suffix fix
CerenB Nov 16, 2020
1436553
removeDateSuffix.m doc added
CerenB Nov 16, 2020
d2220fc
Update src/utils/removeDateSuffix.m
CerenB Nov 16, 2020
ce9a437
Update src/createFilename.m
marcobarilari Nov 16, 2020
0140c9a
Update src/createFilename.m
marcobarilari Nov 16, 2020
58386c1
Update src/gui/getIsQuestionToAsk.m
marcobarilari Nov 16, 2020
90b4240
Update src/gui/getIsQuestionToAsk.m
marcobarilari Nov 16, 2020
fdd6abc
Update src/gui/getIsQuestionToAsk.m
marcobarilari Nov 16, 2020
c882c48
Update src/readAndFilterLogfile.m
marcobarilari Nov 16, 2020
0f43fe6
Update src/utils/removeAllDateSuffix.m
CerenB Nov 16, 2020
5e8a617
Update src/utils/removeAllDateSuffix.m
CerenB Nov 16, 2020
62d91cd
Merge pull request #127 from CerenB/cer-doc
CerenB Nov 16, 2020
697585d
update doc checkCppBidsDependencies
marcobarilari Nov 16, 2020
4b5fe63
doc update on convertSourceToRaw.m
CerenB Nov 16, 2020
e396b39
Merge remote-tracking branch 'origin/cer-doc' into cer-doc
CerenB Nov 16, 2020
96830fb
mh fix
CerenB Nov 16, 2020
c77017b
Update src/gui/setDefaultResponses.m
marcobarilari Nov 16, 2020
822965a
Update src/gui/setDefaultResponses.m
marcobarilari Nov 16, 2020
42c8859
Update src/gui/createQuestionList.m
marcobarilari Nov 16, 2020
07ab932
Update src/gui/createQuestionList.m
marcobarilari Nov 16, 2020
13f8b40
Update src/gui/askUserGui.m
marcobarilari Nov 16, 2020
5f6be6b
Update src/gui/askUserCli.m
marcobarilari Nov 16, 2020
13c2dee
Update src/gui/askForGroupAndOrSession.m
marcobarilari Nov 16, 2020
57cc55e
Merge pull request #123 from marcobarilari/marco_dockhaton
marcobarilari Nov 16, 2020
dfc3843
add doc to returnNamesExtraColumns
marcobarilari Nov 16, 2020
8583274
add doc to returnHeaderName
marcobarilari Nov 16, 2020
0a6222e
add doc to printCreditsCppBids
marcobarilari Nov 16, 2020
444b043
add doc to isPositiveInteger
marcobarilari Nov 16, 2020
71fc4e7
Update src/utils/checkCppBidsDependencies.m
marcobarilari Nov 16, 2020
e4d0b50
Update src/utils/printCreditsCppBids.m
marcobarilari Nov 16, 2020
f8fb13e
Update src/utils/printCreditsCppBids.m
marcobarilari Nov 16, 2020
13844c6
Update src/utils/returnHeaderName.m
marcobarilari Nov 16, 2020
be37036
Update src/utils/returnHeaderName.m
marcobarilari Nov 16, 2020
94e601c
Update src/utils/returnNamesExtraColumns.m
marcobarilari Nov 16, 2020
94d911d
Apply suggestions from code review
marcobarilari Nov 16, 2020
3b89585
add doc to returnNbColumns
marcobarilari Nov 16, 2020
38f4400
minor update doc to initializeExtraColumns
marcobarilari Nov 16, 2020
0f1a16c
minor fix to createValidName
marcobarilari Nov 16, 2020
23ba820
minor fix to createJson
marcobarilari Nov 16, 2020
993740b
add doc to createDatasetDescription
marcobarilari Nov 16, 2020
2e7ff48
Update src/convertSourceToRaw.m
Remi-Gau Nov 16, 2020
cbb55a1
Merge pull request #131 from marcobarilari/marco_dochaton-pt2
marcobarilari Nov 16, 2020
25dd99f
reformat help section from checkCFG
Remi-Gau Nov 16, 2020
0186b98
reorder checkCFG sub-functions by order of appearance in main function
Remi-Gau Nov 16, 2020
5892a8b
remove repetition time from the list of suffixes
Remi-Gau Nov 16, 2020
8a788b7
update help section of checkCFG
Remi-Gau Nov 16, 2020
36e0589
mh fix
Remi-Gau Nov 16, 2020
4488a84
update help section transferInfoToBids
Remi-Gau Nov 16, 2020
19b208f
basic set up of the doc
Remi-Gau Nov 16, 2020
815efad
minor fix on the doc to build rtd
marcobarilari Nov 16, 2020
2d76e8f
Apply suggestions from code review
marcobarilari Nov 16, 2020
01c0736
move command line function of user input in the doc
Remi-Gau Nov 16, 2020
7f39cee
Merge remote-tracking branch 'Remi-Gau/remi-doc' into marco_build-rtd
marcobarilari Nov 16, 2020
795e97f
Merge pull request #133 from marcobarilari/marco_dockhaton-pt3
marcobarilari Nov 16, 2020
86fab40
Merge pull request #125 from Remi-Gau/remi-doc
Remi-Gau Nov 16, 2020
5a04a20
Merge branch 'doc' into marco_build-rtd
marcobarilari Nov 16, 2020
df401f5
Merge pull request #128 from CerenB/cer-doc
CerenB Nov 16, 2020
7257021
Merge branch 'dev' into doc
Remi-Gau Nov 16, 2020
53b1689
Merge branch 'doc' into marco_build-rtd
marcobarilari Nov 16, 2020
cc48a1d
mh fix
Remi-Gau Nov 16, 2020
31b5542
sphynx fix
marcobarilari Nov 16, 2020
297b8f9
fixes doc in convertSourceToRaw
Remi-Gau Nov 16, 2020
c212459
fix returnNbColumns
Remi-Gau Nov 16, 2020
2535ac6
update help section on saveEvents
Remi-Gau Nov 16, 2020
c6cc1e0
Merge pull request #2 from Remi-Gau/remi-fix_doc
marcobarilari Nov 16, 2020
9505caa
Merge pull request #137 from Remi-Gau/remi-doc
Remi-Gau Nov 16, 2020
b03924c
Merge pull request #138 from marcobarilari/marco_build-rtd
Remi-Gau Nov 16, 2020
1da3c2d
mh fix
Remi-Gau Nov 16, 2020
21c840d
Merge pull request #139 from Remi-Gau/remi-doc
Remi-Gau Nov 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,11 @@ A set of function for matlab and octave to create
structure and filenames for the output of behavioral, EEG, fMRI, eyetracking
studies.

## Output format

### Modality agnostic aspect

Subjects, session and run number labels will be numbers with zero padding up to
3 values (e.g subject 1 will become `sub-001`).

A session folder will ALWAYS be created even if not requested (default will be
`ses-001`).

Task labels will be printed in camelCase in the filenames.

Time stamps are added directly in the filename by adding a suffix
`_date-YYYYMMDDHHMM` which makes the file name non-BIDS compliant. This was
added to prevent overwriting files in case a certain run needs to be done a
second time because of a crash (Some of us are paranoid about keeping even
cancelled runs during my experiments). This suffix should be removed to make the
data set BIDS compliant. See `convertSourceToRaw.m` for more details.

For example:

```bash
sub-090/ses-003/sub-090_ses-003_task-auditoryTask_run-023_events_date-202007291536.tsv
```

## Documentation

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

## Contributing

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

### Guidestyle
### Style guide

- We use camelCase.

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```bash
virtualenv -p python3 cpp_bids
source cpp_spm/bin/activate
source cpp_bids/bin/activate

pip install -r requirements.txt
```
Expand Down
98 changes: 0 additions & 98 deletions docs/functions-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,14 @@
<!-- TOC -->

- [functions description](#functions-description)
- [userInputs](#userinputs)
- [createFilename](#createfilename)
- [saveEventsFile](#saveeventsfile)
- [checkCFG](#checkcfg)
- [CFG content](#cfg-content)
- [createBoldJson](#createboldjson)

<!-- /TOC -->

<!-- lint enable -->

## userInputs

Get subject, run and session number and make sure they are positive integer
values.

By default this will return `cfg.subject.session = 1` even if you asked it to
omit enquiring about sessions. This means that the folder tree will always
include a session folder.

```matlab
[cfg] = userInputs(cfg)
```

If you use it with `cfg.subject.askGrpSess = [0 0]`, it won't ask you about
group or session.

If you use it with `cfg.subject.askGrpSess = [1]`, it will only ask you about
group

If you use it with `cfg.subject.askGrpSess = [0 1]`, it will only ask you about
session

If you use it with `cfg.subject.askGrpSess = [1 1]`, it will ask you about both.
This is the default behavior.

## createFilename

Create the BIDS compliant directories and filenames (but not the files) for the
Expand All @@ -64,76 +36,6 @@ Function to save output files for events that will be BIDS compliant.
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.

## checkCFG

Check that we have all the fields that we need in the experiment parameters.

### CFG content

```matlab
% The following can be modified by users but their effect might
% only be effective after running checkCFG

cfg.verbose = 0;

cfg.subject.subjectGrp = '';
cfg.subject.sessionNb = 1;
cfg.subject.askGrpSess = [true true];

% BOLD MRI details
% some of those will be transferred to the correct fields in cfg.bids by checkCFG
cfg.mri.repetitionTime = [];
cfg.mri.contrastEnhancement = [];
cfg.mri.phaseEncodingDirection = [];
cfg.mri.reconstruction = [];
cfg.mri.echo = [];
cfg.mri.acquisition = [];

cfg.fileName.task = '';
cfg.fileName.zeroPadding = 3; % amount of 0 padding the subject, session, run number

cfg.eyeTracker.do = false;

% content of the json side-car file for bold data
cfg.bids.mri.RepetitionTime = [];
cfg.bids.mri.SliceTiming = '';
cfg.bids.mri.TaskName = '';
cfg.bids.mri.Instructions = '';
cfg.bids.mri.TaskDescription = '';

% content of the json side-car file for MEG
cfg.bids.meg.TaskName = '';
cfg.bids.meg.SamplingFrequency = [];
cfg.bids.meg.PowerLineFrequency = [];
cfg.bids.meg.DewarPosition = [];
cfg.bids.meg.SoftwareFilters = [];
cfg.bids.meg.DigitizedLandmarks = [];
cfg.bids.meg.DigitizedHeadPoints = [];

% content of the datasetDescription.json file
cfg.bids.datasetDescription.Name = '';
cfg.bids.datasetDescription.BIDSVersion = '';
cfg.bids.datasetDescription.License = '';
cfg.bids.datasetDescription.Authors = {''};
cfg.bids.datasetDescription.Acknowledgements = '';
cfg.bids.datasetDescription.HowToAcknowledge = '';
cfg.bids.datasetDescription.Funding = {''};
cfg.bids.datasetDescription.ReferencesAndLinks = {''};
cfg.bids.datasetDescription.DatasetDOI = '';


%% Should not be modified by users
% many of those fields are set up by checkCFG and you might get output that is not BIDS valid if you touch those
cfg.fileName.dateFormat = 'yyyymmddHHMM'; % actual date of the experiment that is appended to the filename
cfg.fileName.modality
cgf.fileName.suffix.mri
cgf.fileName.suffix.meg
cfg.fileName.stim
cfg.fileName.events
cfg.fileName.datasetDescription

```

## createBoldJson

```bash
Expand Down
7 changes: 4 additions & 3 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Contributing
************
How to contribute to this project
*********************************

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


Function templates
Expand Down
1 change: 0 additions & 1 deletion docs/source/function_description.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ List of functions in the ``src`` folder.

.. automodule:: src

.. autofunction:: checkCFG
.. autofunction:: convertSourceToRaw
.. autofunction:: createDataDictionary
.. autofunction:: createDatasetDescription
Expand Down
17 changes: 17 additions & 0 deletions docs/source/gui.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Graphic interface
*****************

List of functions in the ``gui`` folder: those are mostly to handle the "graphic interface"
that can be used to deal with ``userInputs()``.

----

.. automodule:: src.gui

.. autofunction:: askForGroupAndOrSession
.. autofunction:: askUserGui
.. autofunction:: createQuestionList
.. autofunction:: getIsQuestionToAsk
.. autofunction:: setDefaultResponses


39 changes: 33 additions & 6 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
.. cpp_bids_spm documentation master file, created by
sphinx-quickstart on Tue Oct 13 11:38:30 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. cpp_bids documentation master file

Welcome to CPP BIDS documentation!
**********************************
Expand All @@ -10,17 +7,47 @@ Welcome to CPP BIDS documentation!
:maxdepth: 2
:caption: Content

set_up
function_description
utilities
gui
contributing

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

Output format
=============

Modality agnostic aspect
------------------------

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

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

Subjects, session and run number labels will be numbers with zero padding up (default is set to
3, meaning that subject 1 will become ``sub-001``).

The ``Group`` name is optional.

A session folder will ALWAYS be created even if not requested (default will be ``ses-001``).

Task labels will be printed in ``camelCase`` in the filenames.

Time stamps are added directly in the filename by adding a suffix
``_date-*`` (default format is ``YYYYMMDDHHMM``) which makes the file name non-BIDS compliant.
This was added to prevent overwriting files in case a certain run needs to be done
a second time because of a crash.
Some of us are paranoid about keeping even cancelled runs during my experiments.
This suffix should be removed to make the data set BIDS compliant.
See ``convertSourceToRaw()`` for more details.

For example::

/user/bob/dataset002/sub-090/ses-003/sub-090_ses-003_task-auditoryTask_run-023_events_date-202007291536.tsv


Indices and tables
Expand Down
53 changes: 53 additions & 0 deletions docs/source/set_up.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Setting up your experiment
**************************

Configuration
=============

.. todo:
describe how to set things up


.. automodule:: src
.. autofunction:: checkCFG

.. automodule:: src.utils
.. autofunction:: transferInfoToBids

.. todo:
0: almost nothing gets printed on screen
1: allows saveEvents to print stuff when saving to file or createFilename to tell you where things will be saved
2: let printCredits do its job and lets saveEvents print extra info when it sends some warning.

Group, subject, session and run
===============================

You can use the ``userInputs()`` function to easily set the group name as well as
the subject, session and run number. You can ask the function to not bother you with
group and session


.. todo:

Get subject, run and session number and make sure they are positive integer
values.

By default this will return `cfg.subject.session = 1` even if you asked it to
omit enquiring about sessions. This means that the folder tree will always
include a session folder.

```matlab
[cfg] = userInputs(cfg)
```

If you use it with `cfg.subject.askGrpSess = [0 0]`, it won't ask you about
group or session.

If you use it with `cfg.subject.askGrpSess = [1]`, it will only ask you about
group

If you use it with `cfg.subject.askGrpSess = [0 1]`, it will only ask you about
session

If you use it with `cfg.subject.askGrpSess = [1 1]`, it will ask you about both.
This is the default behavior.
5 changes: 4 additions & 1 deletion docs/source/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ List of functions in the ``utils`` folder.
.. autofunction:: returnNamesExtraColumns
.. autofunction:: returnNbColumns
.. autofunction:: setDefaultFields
.. autofunction:: transferInfoToBids

.. automodule:: src.gui

.. autofunction:: askUserCli
Loading