From 2ea24ce5ba7456909358f5c6a7fd1b490bcfdb5d Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 10:09:45 +0100 Subject: [PATCH 01/70] minor fix in readAndFilterLogfile --- src/readAndFilterLogfile.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/readAndFilterLogfile.m b/src/readAndFilterLogfile.m index b446f05c..51c2648b 100644 --- a/src/readAndFilterLogfile.m +++ b/src/readAndFilterLogfile.m @@ -19,7 +19,7 @@ % and you have ``trigger_motion`` and ``trigger_static``, % ``trigger`` as input will do) % :type filterBy: string - % :param saveOutputTsv: flag to save output on file + % :param saveOutputTsv: flag to save the filtered output on a tsv file % :type saveOutputTsv: boolean % :param tsvFile: TSV file to filter % :type tsvFile: string @@ -29,8 +29,8 @@ % % :returns: % - % :outputFiltered: dataset with only the specified content, to see it - % in the command window use ``display(outputFiltered)``. + % - :outputFiltered: dataset with only the specified content, to see it + % in the command window use ``display(outputFiltered)``. % % Create tag to add to output file in case you want to save it From 7c526529aadd1a704563476209ce5c94759b3a01 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 10:33:58 +0100 Subject: [PATCH 02/70] minor fix --- src/readAndFilterLogfile.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/readAndFilterLogfile.m b/src/readAndFilterLogfile.m index 51c2648b..e636b8d7 100644 --- a/src/readAndFilterLogfile.m +++ b/src/readAndFilterLogfile.m @@ -29,8 +29,8 @@ % % :returns: % - % - :outputFiltered: dataset with only the specified content, to see it - % in the command window use ``display(outputFiltered)``. + % :outputFiltered: dataset with only the specified content, to see it + % in the command window use ``display(outputFiltered)``. % % Create tag to add to output file in case you want to save it From f781603091edbd2ce34ddd5693ed4dc053515e5c Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 10:34:25 +0100 Subject: [PATCH 03/70] update doc on createFilename --- src/createFilename.m | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/createFilename.m b/src/createFilename.m index 4f6addb7..053080b3 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -1,20 +1,34 @@ % (C) Copyright 2020 CPP_BIDS developers function cfg = createFilename(cfg) - % cfg = createFilename(cfg) % - % create the BIDS compliant directories and fileNames for the behavioral output + % It create the BIDS compliant directories and fileNames for the behavioral output % for this subject / session / run using the information from cfg and expParameters. - % Will also create the right fileName for the eyetracking data file. + % Will also create the right fileName for the eyetracking data file. For the moment the date of + % acquisition is appended to the fileName. % - % For the moment the date of acquisition is appended to the fileName + % USAGE:: % - % can work for behavioral experiment if cfg.device is set to 'PC' - % can work for fMRI experiment if cfg.device is set to 'scanner' - % can work for simple eyetracking data if cfg.eyeTracker.do is set to 1 + % [cfg] = createFilename(cfg) % + % :param cfg: Configuration. See ``checkCFG()``. + % :type cfg: structure % - % See test_createFilename in the test folder for more details on how to use it. + % :returns: + % + % :cfg: (structure) Configuration update with the name of info about the + % participants. + % + % The behavior of this function depends on: + % - ``cfg.testingDevice``: + % - set to ``pc`` (dummy try) or ``beh`` can work for behavioral experiment. + % - set on ``mri`` for fMRI experiment. + % - set on ``eeg`` or ``ieeg`` can work for electro encephalography or + % intracranial eeg + % - set on ``meg`` can work for magneto encephalography + % - ``cfg.eyeTracker.do`` set to 1, can work for simple eyetracking data. + % + % See ``test_createFilename`` in the test folder for more details on how to use it. cfg = checkCFG(cfg); From cc99e1e0fdeadf34ee5ee9e8dba9f79290370a89 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 11:43:51 +0100 Subject: [PATCH 04/70] Update src/createFilename.m --- src/createFilename.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/createFilename.m b/src/createFilename.m index 053080b3..1e68e5d2 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -2,7 +2,7 @@ function cfg = createFilename(cfg) % - % It create the BIDS compliant directories and fileNames for the behavioral output + % It creates the BIDS compliant directories and fileNames for the behavioral output % for this subject / session / run using the information from cfg and expParameters. % Will also create the right fileName for the eyetracking data file. For the moment the date of % acquisition is appended to the fileName. From f7aa1eb91f2c6b58a485db246e629e31352f0f03 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 12:05:44 +0100 Subject: [PATCH 05/70] update doc on creatDataDictionary --- src/createDataDictionary.m | 27 ++++++++------------------- src/userInputs.m | 1 - 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/createDataDictionary.m b/src/createDataDictionary.m index cf1fdf63..2b68e727 100644 --- a/src/createDataDictionary.m +++ b/src/createDataDictionary.m @@ -2,29 +2,18 @@ function createDataDictionary(cfg, logFile) % - % Short description of what the function does goes here. + % It creates the data dictionary to be associated with a _events.tsv file. It will create empty + % fields that you can then fill in manually in the JSON file. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % createDataDictionary(cfg, logFile) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % createDataDictionary(cfg, logFile) - % - % creates the data dictionary to be associated with a _events.tsv file - % will create empty field that you can then fill in manually in the JSON - % file + % :param cfg: Configuration. See ``checkCFG()``. + % :type cfg: structure + % :param logFile: Contains the data you want to save. + % :type logFile: structure + fileName = strrep(logFile(1).filename, '.tsv', '.json'); fullFilename = getFullFilename(fileName, cfg); diff --git a/src/userInputs.m b/src/userInputs.m index 4e9db1aa..f7eb2ce3 100644 --- a/src/userInputs.m +++ b/src/userInputs.m @@ -23,7 +23,6 @@ % % - the first value set to ``false`` will skip asking for the participants group % - the second value set to ``false`` will skip asking for the session - % if nargin < 1 cfg = struct('debug', []); From ea52938302761f0ba7d9d62f0ddd77eb4c182aae Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 12:57:46 +0100 Subject: [PATCH 06/70] update doc for createQuestionList --- src/gui/createQuestionList.m | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gui/createQuestionList.m b/src/gui/createQuestionList.m index 22d709b6..b4a653f6 100644 --- a/src/gui/createQuestionList.m +++ b/src/gui/createQuestionList.m @@ -2,23 +2,19 @@ function questions = createQuestionList(cfg) % - % Short description of what the function does goes here. + % It creates a list if degault questions to ask to the users regarding the subj ID, the run nb, + % the group ID (if recquired by user) and session nb (if recquired by user). % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [questions] = createQuestionList(cfg) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param cfg: Configuration. See ``checkCFG()``. + % :type cfg: structure % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: + % :questions: (structure) It contains the questions list to ask and if the response + % given to one question must be checked to be an integer number. % cfg = askForGroupAndOrSession(cfg); From 753316f5f4a56b9c2d171a4e09920ae205b54f8a Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 12:58:03 +0100 Subject: [PATCH 07/70] update doc for askForGroupAndOrSession --- src/gui/askForGroupAndOrSession.m | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/gui/askForGroupAndOrSession.m b/src/gui/askForGroupAndOrSession.m index 271644c3..bc7b799f 100644 --- a/src/gui/askForGroupAndOrSession.m +++ b/src/gui/askForGroupAndOrSession.m @@ -2,24 +2,19 @@ function cfg = askForGroupAndOrSession(cfg) % - % Short description of what the function does goes here. + % It checks ``cfg`` if ``group`` and ``session`` are recquired in ``cfg.subject.askGrpSess`` by + % the user. If not specified, it will add these as ``true`` by defautl. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [cfg] = askForGroupAndOrSession(cfg) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :param cfg: Configuration. See ``checkCFG()``. + % :type cfg: structure % + % :returns: + % :cfg: (structure) Configuration update with the instructions if to ask for ``group`` + % and ``session``. askGrpSess = [true true]; From 9a50f6d224ff6e524cc85a9631b606b1fb1b62e3 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 14:12:15 +0100 Subject: [PATCH 08/70] update doc in setDefaultResponses --- src/gui/setDefaultResponses.m | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/gui/setDefaultResponses.m b/src/gui/setDefaultResponses.m index cb0d0597..4ffb7454 100644 --- a/src/gui/setDefaultResponses.m +++ b/src/gui/setDefaultResponses.m @@ -2,23 +2,18 @@ function [cfg, responses] = setDefaultResponses(cfg) % - % Short description of what the function does goes here. + % It sets default responses to for all the entries regarding subject group and nb and for + % session and run nb. The defaults are choosen depending on ``cfg.debug.do``. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [cfg, responses] = setDefaultResponses(cfg) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param cfg: Configuration. See ``checkCFG()``. % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :responses: (cell) It contains the response set by default + % - :cfg: (structure) Configuration update with ``cfg.debug.do`` set to false if not + % set by the user. % if nargin < 1 From 3ad5c3894dee30552b85222df0b2e795a83864bb Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 15:48:36 +0100 Subject: [PATCH 09/70] update on doc --- src/utils/removeAllDateSuffix.m | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 3abab5fd..29098f71 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -2,26 +2,25 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % - % Short description of what the function does goes here. + % Function removes the date suffix in the _events and _stim (.tsv and .json) + % files in given raw, session and subject folder. And zips the _stim files. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % removeAllDateSuffix(rawDir, subjName, sesName) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % removeAllDateSuffix(rawDir, subjName, sesName) + % :param rawDir: obligatory argument. + % :type rawDir: string + % + % :param subjName: Some of the options can be ``sub-001`` or ``sub-pilot001``. + % :type subjName: string % + % :param sesName: Some of the options can be ``ses-001`` or ``ses-003``. + % :type sesName: string + + % :output: - files are renamed by removing 'yyyymmddHHMM' date suffix + + labels = {'func', 'bold', 'eeg', 'ieeg', 'meg', 'beh'}; From 943b869234abe14fb23cd2649e9d76bae5ce217b Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 15:53:17 +0100 Subject: [PATCH 10/70] update code for getIsQuestionToAsk --- src/gui/getIsQuestionToAsk.m | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/gui/getIsQuestionToAsk.m b/src/gui/getIsQuestionToAsk.m index 94d5fec1..e1368b01 100644 --- a/src/gui/getIsQuestionToAsk.m +++ b/src/gui/getIsQuestionToAsk.m @@ -2,20 +2,19 @@ function isQuestionToAsk = getIsQuestionToAsk(questions, responses) % - % Short description of what the function does goes here. + % While using the GUI interface to input the expertiment inofrmation, it flags any question that + % will be presented in the GUI. If a response is not valid (e.g. is not an integer) it will keep + % flagging it as a 'questio to ask' and represent the GUI. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % isQuestionToAsk = getIsQuestionToAsk(questions, responses) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param questions: It contains the questions list to ask and if the response given to one + % question must be checked to be an integer number. + % :type questions: structure + % :param responses: It contains the responses set by default or as input by the user + % :type responses: cell % % :returns: - :argout1: (type) (dimension) % - :argout2: (type) (dimension) From 305a21c6aa3a13384478ef1a7d1b2b82cce82d00 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:02:35 +0100 Subject: [PATCH 11/70] minor fix --- src/utils/removeAllDateSuffix.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 29098f71..056a8022 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -9,7 +9,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % % removeAllDateSuffix(rawDir, subjName, sesName) % - % :param rawDir: obligatory argument. + % :param rawDir: Raw folder directory. % :type rawDir: string % % :param subjName: Some of the options can be ``sub-001`` or ``sub-pilot001``. From 383efd672b7a931e9b74071fcc2764c8cad6339c Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:03:49 +0100 Subject: [PATCH 12/70] mh fix --- src/utils/removeAllDateSuffix.m | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 056a8022..d34a6db6 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -2,7 +2,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % - % Function removes the date suffix in the _events and _stim (.tsv and .json) + % Function removes the date suffix in the _events and _stim (.tsv and .json) % files in given raw, session and subject folder. And zips the _stim files. % % USAGE:: @@ -11,16 +11,14 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % % :param rawDir: Raw folder directory. % :type rawDir: string - % + % % :param subjName: Some of the options can be ``sub-001`` or ``sub-pilot001``. % :type subjName: string % % :param sesName: Some of the options can be ``ses-001`` or ``ses-003``. % :type sesName: string - - % :output: - files are renamed by removing 'yyyymmddHHMM' date suffix - + % :output: - files are renamed by removing 'yyyymmddHHMM' date suffix labels = {'func', 'bold', 'eeg', 'ieeg', 'meg', 'beh'}; From a0b9b6a1162ff5bb6ef929c84c83b43617ff7595 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:07:01 +0100 Subject: [PATCH 13/70] wording update --- src/utils/removeAllDateSuffix.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index d34a6db6..965fd4f9 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -9,7 +9,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % % removeAllDateSuffix(rawDir, subjName, sesName) % - % :param rawDir: Raw folder directory. + % :param rawDir: BIDS raw folder directory. % :type rawDir: string % % :param subjName: Some of the options can be ``sub-001`` or ``sub-pilot001``. From 404510f50acd2e17d94ed113e3f6253c55635b85 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 16:07:51 +0100 Subject: [PATCH 14/70] update docs for askUserCli --- src/gui/askUserCli.m | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/gui/askUserCli.m b/src/gui/askUserCli.m index 097465ba..aa599bfa 100644 --- a/src/gui/askUserCli.m +++ b/src/gui/askUserCli.m @@ -2,27 +2,20 @@ function responses = askUserCli(questions, responses) % - % Short description of what the function does goes here. + % It shows the questions to ask in the commnad window and checks, when it is necessary, if the + % given input by the user is an integer. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % responses = askUserCli(questions, responses) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param questions: It contains the questions list to ask and if the response given to one + % question must be checked to be an integer number. + % :type questions: structure + % :param responses: It contains the responses set by default. + % :type responses: cell % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % response = askUserCli(questions) - % - % command line interface to ask questions to user + % :returns: - :responses: (cell) Response updated with the user inputs. % for iQuestion = 1:size(questions.questionsToAsk, 1) From 240c83f78d3de320da09f8f95d8ff3a49348ae83 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:10:12 +0100 Subject: [PATCH 15/70] added output --- src/utils/removeAllDateSuffix.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 965fd4f9..0440094e 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -19,6 +19,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % :type sesName: string % :output: - files are renamed by removing 'yyyymmddHHMM' date suffix + % and _stim files are zipped labels = {'func', 'bold', 'eeg', 'ieeg', 'meg', 'beh'}; From e2655adb6e1f86fbcd62580eb1f53dc798012eb6 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 16:12:15 +0100 Subject: [PATCH 16/70] update docs for askUserGui --- src/gui/askUserCli.m | 2 +- src/gui/askUserGui.m | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/gui/askUserCli.m b/src/gui/askUserCli.m index aa599bfa..5bfe5b61 100644 --- a/src/gui/askUserCli.m +++ b/src/gui/askUserCli.m @@ -7,7 +7,7 @@ % % USAGE:: % - % responses = askUserCli(questions, responses) + % [responses] = askUserCli(questions, responses) % % :param questions: It contains the questions list to ask and if the response given to one % question must be checked to be an integer number. diff --git a/src/gui/askUserGui.m b/src/gui/askUserGui.m index 1c72bfcc..1647fa7b 100644 --- a/src/gui/askUserGui.m +++ b/src/gui/askUserGui.m @@ -2,23 +2,21 @@ function responses = askUserGui(questions, responses) % - % Short description of what the function does goes here. + % It shows the questions to ask in in a GUI interface and checks, when it is necessary, if the + % given input by the user is an integer. If the input is not an integer, it keeps showing the + % GUI interface. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [responses] = askUserGui(questions, responses) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param questions: It contains the questions list to ask and if the response given to one + % question must be checked to be an integer number. + % :type questions: structure + % :param responses: It contains the responses set by default. + % :type responses: cell % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :responses: (cell) Response updated with the user inputs. % % boolean for which question should be asked From 42967aeaad3c9bbe8b572ddf5d2a8802cfdb9928 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:13:14 +0100 Subject: [PATCH 17/70] suffix fix --- src/utils/removeAllDateSuffix.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 0440094e..39e86bb1 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -4,6 +4,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % % Function removes the date suffix in the _events and _stim (.tsv and .json) % files in given raw, session and subject folder. And zips the _stim files. + % Function will look for files with suffix of ``_date-yyyymmddHHMM`` % % USAGE:: % @@ -18,7 +19,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % :param sesName: Some of the options can be ``ses-001`` or ``ses-003``. % :type sesName: string - % :output: - files are renamed by removing 'yyyymmddHHMM' date suffix + % :output: - files are renamed by removing '_date-yyyymmddHHMM' suffix % and _stim files are zipped labels = {'func', 'bold', 'eeg', 'ieeg', 'meg', 'beh'}; From 1436553f9f32f806e4faef4a81224983f0824c60 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:16:25 +0100 Subject: [PATCH 18/70] removeDateSuffix.m doc added --- src/utils/removeDateSuffix.m | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/utils/removeDateSuffix.m b/src/utils/removeDateSuffix.m index ae5e8a80..33ac7470 100644 --- a/src/utils/removeDateSuffix.m +++ b/src/utils/removeDateSuffix.m @@ -2,27 +2,21 @@ function removeDateSuffix(filenames, subjectPath) % - % Short description of what the function does goes here. + % Function removes the date suffix in a given filename(s) + % Function will look for regular expression in filenames with ``_date-`` + % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) - % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % removeDateSuffix(filenames, subjectPath) % - % removeDateSuffix(filenames, subjectPath) + % :param filenames: File names with _date- suffix + % :type filenames: string % + % :param subjectPath: Location/path of the files + % :type subjectPath: string % + % :output: - files are renamed by removing '_date-yyyymmddHHMM' suffix if isempty(filenames) filenames = {}; From d2220fca42d80e9b1574b93bd1ac068025be1472 Mon Sep 17 00:00:00 2001 From: CerenB Date: Mon, 16 Nov 2020 16:24:13 +0100 Subject: [PATCH 19/70] Update src/utils/removeDateSuffix.m Co-authored-by: Remi Gau --- src/utils/removeDateSuffix.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/removeDateSuffix.m b/src/utils/removeDateSuffix.m index 33ac7470..1ed96087 100644 --- a/src/utils/removeDateSuffix.m +++ b/src/utils/removeDateSuffix.m @@ -16,7 +16,7 @@ function removeDateSuffix(filenames, subjectPath) % :param subjectPath: Location/path of the files % :type subjectPath: string % - % :output: - files are renamed by removing '_date-yyyymmddHHMM' suffix + % :output: - files are renamed by removing '_date-*' suffix if isempty(filenames) filenames = {}; From ce9a43747286ef867be0bd0589da9e53ebe77e77 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:27:15 +0100 Subject: [PATCH 20/70] Update src/createFilename.m Co-authored-by: Remi Gau --- src/createFilename.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/createFilename.m b/src/createFilename.m index 1e68e5d2..59068873 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -26,7 +26,7 @@ % - set on ``eeg`` or ``ieeg`` can work for electro encephalography or % intracranial eeg % - set on ``meg`` can work for magneto encephalography - % - ``cfg.eyeTracker.do`` set to 1, can work for simple eyetracking data. + % - ``cfg.eyeTracker.do`` set to ``true``, can work for simple eyetracking data. % % See ``test_createFilename`` in the test folder for more details on how to use it. From 0140c9ab5225d8131fa32ee1903bc5a7d9e46804 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:27:25 +0100 Subject: [PATCH 21/70] Update src/createFilename.m Co-authored-by: Remi Gau --- src/createFilename.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/createFilename.m b/src/createFilename.m index 59068873..dafab64a 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -28,7 +28,7 @@ % - set on ``meg`` can work for magneto encephalography % - ``cfg.eyeTracker.do`` set to ``true``, can work for simple eyetracking data. % - % See ``test_createFilename`` in the test folder for more details on how to use it. + % See ``test_createFilename`` in the ``tests`` folder for more details on how to use it. cfg = checkCFG(cfg); From 58386c14ec2a8c2838bd8a0b46b7331562a9be5b Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:27:40 +0100 Subject: [PATCH 22/70] Update src/gui/getIsQuestionToAsk.m Co-authored-by: Remi Gau --- src/gui/getIsQuestionToAsk.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/getIsQuestionToAsk.m b/src/gui/getIsQuestionToAsk.m index e1368b01..d73955f2 100644 --- a/src/gui/getIsQuestionToAsk.m +++ b/src/gui/getIsQuestionToAsk.m @@ -2,7 +2,7 @@ function isQuestionToAsk = getIsQuestionToAsk(questions, responses) % - % While using the GUI interface to input the expertiment inofrmation, it flags any question that + % While using the GUI interface to input the experiment information, it flags any question that % will be presented in the GUI. If a response is not valid (e.g. is not an integer) it will keep % flagging it as a 'questio to ask' and represent the GUI. % From 90b4240aca18c0f108ba50720ac3191a082d6f20 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:27:49 +0100 Subject: [PATCH 23/70] Update src/gui/getIsQuestionToAsk.m Co-authored-by: Remi Gau --- src/gui/getIsQuestionToAsk.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/getIsQuestionToAsk.m b/src/gui/getIsQuestionToAsk.m index d73955f2..a8bb4eb9 100644 --- a/src/gui/getIsQuestionToAsk.m +++ b/src/gui/getIsQuestionToAsk.m @@ -4,7 +4,7 @@ % % While using the GUI interface to input the experiment information, it flags any question that % will be presented in the GUI. If a response is not valid (e.g. is not an integer) it will keep - % flagging it as a 'questio to ask' and represent the GUI. + % flagging it as a 'question to ask' and represent the GUI. % % USAGE:: % From fdd6abcc30182dd13cc85664454b28d6c0ba1817 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:28:11 +0100 Subject: [PATCH 24/70] Update src/gui/getIsQuestionToAsk.m Co-authored-by: Remi Gau --- src/gui/getIsQuestionToAsk.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/getIsQuestionToAsk.m b/src/gui/getIsQuestionToAsk.m index a8bb4eb9..f495fb50 100644 --- a/src/gui/getIsQuestionToAsk.m +++ b/src/gui/getIsQuestionToAsk.m @@ -11,7 +11,7 @@ % isQuestionToAsk = getIsQuestionToAsk(questions, responses) % % :param questions: It contains the questions list to ask and if the response given to one - % question must be checked to be an integer number. + % question must be checked to be an integer. % :type questions: structure % :param responses: It contains the responses set by default or as input by the user % :type responses: cell From c882c487326285e18fd3e34259ef277787ab06ec Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:28:27 +0100 Subject: [PATCH 25/70] Update src/readAndFilterLogfile.m Co-authored-by: Remi Gau --- src/readAndFilterLogfile.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/readAndFilterLogfile.m b/src/readAndFilterLogfile.m index e636b8d7..52bd1f2a 100644 --- a/src/readAndFilterLogfile.m +++ b/src/readAndFilterLogfile.m @@ -19,7 +19,7 @@ % and you have ``trigger_motion`` and ``trigger_static``, % ``trigger`` as input will do) % :type filterBy: string - % :param saveOutputTsv: flag to save the filtered output on a tsv file + % :param saveOutputTsv: flag to save the filtered output in a tsv file % :type saveOutputTsv: boolean % :param tsvFile: TSV file to filter % :type tsvFile: string From 0f43fe65497a5189aa720710f57fb76c942bf045 Mon Sep 17 00:00:00 2001 From: CerenB Date: Mon, 16 Nov 2020 16:40:08 +0100 Subject: [PATCH 26/70] Update src/utils/removeAllDateSuffix.m --- src/utils/removeAllDateSuffix.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 39e86bb1..7d96db8c 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -4,7 +4,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % % Function removes the date suffix in the _events and _stim (.tsv and .json) % files in given raw, session and subject folder. And zips the _stim files. - % Function will look for files with suffix of ``_date-yyyymmddHHMM`` + % Function will look for files with suffix of ``_date-*`` % % USAGE:: % From 5e8a617260cddadd31978a46bbcd8f8ddacb34fc Mon Sep 17 00:00:00 2001 From: CerenB Date: Mon, 16 Nov 2020 16:40:18 +0100 Subject: [PATCH 27/70] Update src/utils/removeAllDateSuffix.m --- src/utils/removeAllDateSuffix.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 7d96db8c..946cf4a6 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -19,7 +19,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % :param sesName: Some of the options can be ``ses-001`` or ``ses-003``. % :type sesName: string - % :output: - files are renamed by removing '_date-yyyymmddHHMM' suffix + % :output: - files are renamed by removing '_date-*' suffix % and _stim files are zipped labels = {'func', 'bold', 'eeg', 'ieeg', 'meg', 'beh'}; From 697585da5beafbf481f61d1753cfe47725908fff Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 16:49:27 +0100 Subject: [PATCH 28/70] update doc checkCppBidsDependencies --- src/utils/checkCppBidsDependencies.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/checkCppBidsDependencies.m b/src/utils/checkCppBidsDependencies.m index e86503ab..61e6dd32 100644 --- a/src/utils/checkCppBidsDependencies.m +++ b/src/utils/checkCppBidsDependencies.m @@ -2,12 +2,14 @@ function checkCppBidsDependencies(cfg) % - % Adds dependencies to the matlab path and make sure we got all of them/ + % Adds dependencies to the matlab path and make sure we got all of them. % % USAGE:: % % checkCppBidsDependencies(cfg) % + % :param cfg: Configuration. See ``checkCFG()``. + % :type cfg: structure GITHUB_WORKSPACE = getenv('GITHUB_WORKSPACE'); From 4b5fe63c84d3ea85af5baaffe7a36cc465d28285 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:52:07 +0100 Subject: [PATCH 29/70] doc update on convertSourceToRaw.m --- src/convertSourceToRaw.m | 32 ++++++++++++-------------------- src/utils/removeAllDateSuffix.m | 4 ++-- src/utils/removeDateSuffix.m | 2 +- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/convertSourceToRaw.m b/src/convertSourceToRaw.m index 3684733f..e8b39cce 100644 --- a/src/convertSourceToRaw.m +++ b/src/convertSourceToRaw.m @@ -2,33 +2,25 @@ function convertSourceToRaw(cfg) % - % Short description of what the function does goes here. - % - % USAGE:: + % Function attempts to convert a source dataset created with CPP_BIDS into a valid + % BIDS data set. % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % Only covers func folder at the moment % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % USAGE:: % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % convertSourceToRaw(cfg) % - % convertSourceToRaw(cfg) + % :param cfg: cfg structure is needed only for providing the path in + % ``cfg.dir.output`` + % :type cfg: structure % - % attempts to convert a source dataset created with CPP_BIDS into a valid - % BIDS data set. + % :output: % - creates dummy README and CHANGE file % - copy source dir to raw dir - % - remove the date suffix (_date-YYYYMMDDHHMM) from the files where it is present - % - % Only covers func folder at the moment + % - remove the date suffix (_date-*) from the files where it is present + % - zips the _stim files. + sourceDir = fullfile(cfg.dir.output, 'source'); rawDir = fullfile(cfg.dir.output, 'raw'); diff --git a/src/utils/removeAllDateSuffix.m b/src/utils/removeAllDateSuffix.m index 39e86bb1..946cf4a6 100644 --- a/src/utils/removeAllDateSuffix.m +++ b/src/utils/removeAllDateSuffix.m @@ -4,7 +4,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % % Function removes the date suffix in the _events and _stim (.tsv and .json) % files in given raw, session and subject folder. And zips the _stim files. - % Function will look for files with suffix of ``_date-yyyymmddHHMM`` + % Function will look for files with suffix of ``_date-*`` % % USAGE:: % @@ -19,7 +19,7 @@ function removeAllDateSuffix(rawDir, subjName, sesName) % :param sesName: Some of the options can be ``ses-001`` or ``ses-003``. % :type sesName: string - % :output: - files are renamed by removing '_date-yyyymmddHHMM' suffix + % :output: - files are renamed by removing '_date-*' suffix % and _stim files are zipped labels = {'func', 'bold', 'eeg', 'ieeg', 'meg', 'beh'}; diff --git a/src/utils/removeDateSuffix.m b/src/utils/removeDateSuffix.m index 33ac7470..1ed96087 100644 --- a/src/utils/removeDateSuffix.m +++ b/src/utils/removeDateSuffix.m @@ -16,7 +16,7 @@ function removeDateSuffix(filenames, subjectPath) % :param subjectPath: Location/path of the files % :type subjectPath: string % - % :output: - files are renamed by removing '_date-yyyymmddHHMM' suffix + % :output: - files are renamed by removing '_date-*' suffix if isempty(filenames) filenames = {}; From 96830fbe407449a607eb561d33585000e0e60e33 Mon Sep 17 00:00:00 2001 From: Ceren Date: Mon, 16 Nov 2020 16:56:23 +0100 Subject: [PATCH 30/70] mh fix --- src/convertSourceToRaw.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/convertSourceToRaw.m b/src/convertSourceToRaw.m index e8b39cce..ad62d11e 100644 --- a/src/convertSourceToRaw.m +++ b/src/convertSourceToRaw.m @@ -15,13 +15,12 @@ function convertSourceToRaw(cfg) % ``cfg.dir.output`` % :type cfg: structure % - % :output: + % :output: % - creates dummy README and CHANGE file % - copy source dir to raw dir % - remove the date suffix (_date-*) from the files where it is present % - zips the _stim files. - sourceDir = fullfile(cfg.dir.output, 'source'); rawDir = fullfile(cfg.dir.output, 'raw'); From c77017bbf62c6ee773b394143a1d8023445f78eb Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:57:56 +0100 Subject: [PATCH 31/70] Update src/gui/setDefaultResponses.m Co-authored-by: Remi Gau --- src/gui/setDefaultResponses.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/setDefaultResponses.m b/src/gui/setDefaultResponses.m index 4ffb7454..0a41b3a6 100644 --- a/src/gui/setDefaultResponses.m +++ b/src/gui/setDefaultResponses.m @@ -3,7 +3,7 @@ function [cfg, responses] = setDefaultResponses(cfg) % % It sets default responses to for all the entries regarding subject group and nb and for - % session and run nb. The defaults are choosen depending on ``cfg.debug.do``. + % session and run number. The defaults are choosen depending on ``cfg.debug.do``. % % USAGE:: % From 822965a50b6ac74bcefe162497de67d795d377e2 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:58:18 +0100 Subject: [PATCH 32/70] Update src/gui/setDefaultResponses.m Co-authored-by: Remi Gau --- src/gui/setDefaultResponses.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/setDefaultResponses.m b/src/gui/setDefaultResponses.m index 0a41b3a6..d9ff6d35 100644 --- a/src/gui/setDefaultResponses.m +++ b/src/gui/setDefaultResponses.m @@ -2,7 +2,7 @@ function [cfg, responses] = setDefaultResponses(cfg) % - % It sets default responses to for all the entries regarding subject group and nb and for + % It sets default responses to for all the entries regarding subject group and for % session and run number. The defaults are choosen depending on ``cfg.debug.do``. % % USAGE:: From 42c8859d9e87b276bd4d9bef1cea36424d1a6d73 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:58:38 +0100 Subject: [PATCH 33/70] Update src/gui/createQuestionList.m Co-authored-by: Remi Gau --- src/gui/createQuestionList.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/createQuestionList.m b/src/gui/createQuestionList.m index b4a653f6..3d4f5488 100644 --- a/src/gui/createQuestionList.m +++ b/src/gui/createQuestionList.m @@ -14,7 +14,7 @@ % % :returns: % :questions: (structure) It contains the questions list to ask and if the response - % given to one question must be checked to be an integer number. + % given to one question must be checked to be a positive integer. % cfg = askForGroupAndOrSession(cfg); From 07ab932c634928d4776c659f8d2f47e226eb8f0f Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:58:52 +0100 Subject: [PATCH 34/70] Update src/gui/createQuestionList.m Co-authored-by: Remi Gau --- src/gui/createQuestionList.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/createQuestionList.m b/src/gui/createQuestionList.m index 3d4f5488..4f16049b 100644 --- a/src/gui/createQuestionList.m +++ b/src/gui/createQuestionList.m @@ -2,7 +2,7 @@ function questions = createQuestionList(cfg) % - % It creates a list if degault questions to ask to the users regarding the subj ID, the run nb, + % It creates a list of default questions to ask the users regarding the subj ID, the run number, % the group ID (if recquired by user) and session nb (if recquired by user). % % USAGE:: From 13f8b40486f495dea03384504f9f02b52f6c6d7b Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:59:13 +0100 Subject: [PATCH 35/70] Update src/gui/askUserGui.m Co-authored-by: Remi Gau --- src/gui/askUserGui.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/askUserGui.m b/src/gui/askUserGui.m index 1647fa7b..61ca3423 100644 --- a/src/gui/askUserGui.m +++ b/src/gui/askUserGui.m @@ -3,7 +3,7 @@ function responses = askUserGui(questions, responses) % % It shows the questions to ask in in a GUI interface and checks, when it is necessary, if the - % given input by the user is an integer. If the input is not an integer, it keeps showing the + % given input by the user is a positive integer. If not, it keeps showing the % GUI interface. % % USAGE:: From 5f6be6b1a99477ab3d2a982a5e2805d700d18d47 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:59:24 +0100 Subject: [PATCH 36/70] Update src/gui/askUserCli.m Co-authored-by: Remi Gau --- src/gui/askUserCli.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/askUserCli.m b/src/gui/askUserCli.m index 5bfe5b61..d44d04bd 100644 --- a/src/gui/askUserCli.m +++ b/src/gui/askUserCli.m @@ -10,7 +10,7 @@ % [responses] = askUserCli(questions, responses) % % :param questions: It contains the questions list to ask and if the response given to one - % question must be checked to be an integer number. + % question must be checked to be a positive integer. % :type questions: structure % :param responses: It contains the responses set by default. % :type responses: cell From 13c2deecaeb5a4496a4ada43cb8c59cf8e5edc8a Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:59:39 +0100 Subject: [PATCH 37/70] Update src/gui/askForGroupAndOrSession.m Co-authored-by: Remi Gau --- src/gui/askForGroupAndOrSession.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/askForGroupAndOrSession.m b/src/gui/askForGroupAndOrSession.m index bc7b799f..3393836f 100644 --- a/src/gui/askForGroupAndOrSession.m +++ b/src/gui/askForGroupAndOrSession.m @@ -3,7 +3,7 @@ function cfg = askForGroupAndOrSession(cfg) % % It checks ``cfg`` if ``group`` and ``session`` are recquired in ``cfg.subject.askGrpSess`` by - % the user. If not specified, it will add these as ``true`` by defautl. + % the user. If not specified, it will add these as ``true`` by default. % % USAGE:: % From dfc3843d22787cc936e2f9ecda2593e73bc43f0f Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 18:28:28 +0100 Subject: [PATCH 38/70] add doc to returnNamesExtraColumns --- src/utils/returnNamesExtraColumns.m | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/utils/returnNamesExtraColumns.m b/src/utils/returnNamesExtraColumns.m index 5b77ee37..81657bb4 100644 --- a/src/utils/returnNamesExtraColumns.m +++ b/src/utils/returnNamesExtraColumns.m @@ -1,26 +1,18 @@ % (C) Copyright 2020 CPP_BIDS developers -function [namesExtraColumns, logFile] = returnNamesExtraColumns(logFile) +function [namesExtraColumns, logfile] = returnNamesExtraColumns(logFile) % - % Short description of what the function does goes here. + % It returns the extra colums name(s), in ``cfg.extraColumns``, as header to add to the + % ``event`` file % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [namesExtraColumns] = returnNamesExtraColumns(logFile) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param logFile: It contains all the information to be saved in the event/stim file + % :type logFile: structure % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % [namesExtraColumns, logFile] = returnNamesExtraColumns(logFile) + % :returns: - :namesExtraColumns: (cell) (nx1) % namesExtraColumns = []; From 8583274d54df8ae53de72896d5aa4eece19d12c3 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 18:28:45 +0100 Subject: [PATCH 39/70] add doc to returnHeaderName --- src/utils/returnHeaderName.m | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/utils/returnHeaderName.m b/src/utils/returnHeaderName.m index 806f9d2c..840f4062 100644 --- a/src/utils/returnHeaderName.m +++ b/src/utils/returnHeaderName.m @@ -2,25 +2,20 @@ function headerName = returnHeaderName(columnName, nbCol, iCol) % - % Short description of what the function does goes here. + % It return one by one the column name to be used as a header in a fresh opened event file % % USAGE:: % % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param columnName: The column name to print + % :type columnName: string + % :param nbCol: It is the number of columns associated to one entry of the extra column list + % :type nbCol: integer + % :param iCol: index of the columns associated to one entry of the extra column list + % :type iCol: integer % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % headerName = returnHeaderName(columnName, nbCol, iCol) + % :returns: - :headerName: (string) return the extra column name to be used as header % if nbCol == 1 From 0a6222e792e3c2f3216942f33c819d3b21bbbb1e Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 18:29:01 +0100 Subject: [PATCH 40/70] add doc to printCreditsCppBids --- src/utils/printCreditsCppBids.m | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/utils/printCreditsCppBids.m b/src/utils/printCreditsCppBids.m index e6e652e8..97d01da1 100644 --- a/src/utils/printCreditsCppBids.m +++ b/src/utils/printCreditsCppBids.m @@ -2,23 +2,15 @@ function printCreditsCppBids(cfg) % - % Short description of what the function does goes here. + % It will print the credits of this repo. Depending on the level of verbosit set in + % ``cfg.verbose`` (default is 2 if not set), it will print the graphic and general information. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % printCreditsCppBids(cfg) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :param cfg: Configuration. See ``checkCFG()``. + % :type argin1: structure % try From 444b0435806cffad39ea7c1c2f593e11ed7b23fe Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 18:29:12 +0100 Subject: [PATCH 41/70] add doc to isPositiveInteger --- src/utils/isPositiveInteger.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/isPositiveInteger.m b/src/utils/isPositiveInteger.m index 1583ad11..0058ca09 100644 --- a/src/utils/isPositiveInteger.m +++ b/src/utils/isPositiveInteger.m @@ -2,14 +2,14 @@ function trueOrFalse = isPositiveInteger(input2check) % - % + % It checks whether the input is a positive integer and report it as ``true`` or ``false`` % % USAGE:: % % trueOrFalse = isPositiveInteger(input2check) % - % :param input2check: - % :type input2check: column vector + % :param input2check: (1xn) The input to check (either a number or ``NaN``) + % :type input2check: vector % % :returns: :trueOrFalse: (boolean) % From 71fc4e750dcb41f383578023f7dc3179923a4def Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:47:40 +0100 Subject: [PATCH 42/70] Update src/utils/checkCppBidsDependencies.m Co-authored-by: Remi Gau --- src/utils/checkCppBidsDependencies.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/checkCppBidsDependencies.m b/src/utils/checkCppBidsDependencies.m index 61e6dd32..88cd1833 100644 --- a/src/utils/checkCppBidsDependencies.m +++ b/src/utils/checkCppBidsDependencies.m @@ -2,7 +2,7 @@ function checkCppBidsDependencies(cfg) % - % Adds dependencies to the matlab path and make sure we got all of them. + % Adds dependencies to the Matlab / Octave path and make sure we got all of them. % % USAGE:: % From e4d0b50bc0c638a1cc31f0e6b5aea8c2324857e5 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:48:28 +0100 Subject: [PATCH 43/70] Update src/utils/printCreditsCppBids.m Co-authored-by: CerenB --- src/utils/printCreditsCppBids.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/printCreditsCppBids.m b/src/utils/printCreditsCppBids.m index 97d01da1..5792bd52 100644 --- a/src/utils/printCreditsCppBids.m +++ b/src/utils/printCreditsCppBids.m @@ -2,7 +2,7 @@ function printCreditsCppBids(cfg) % - % It will print the credits of this repo. Depending on the level of verbosit set in + % It will print the credits of this repo. Depending on the level of verbosity set in % ``cfg.verbose`` (default is 2 if not set), it will print the graphic and general information. % % USAGE:: From f8fb13e3aa9bed3d45e9a8c9f61d319730554b4c Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:49:31 +0100 Subject: [PATCH 44/70] Update src/utils/printCreditsCppBids.m Co-authored-by: CerenB --- src/utils/printCreditsCppBids.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/printCreditsCppBids.m b/src/utils/printCreditsCppBids.m index 5792bd52..46209414 100644 --- a/src/utils/printCreditsCppBids.m +++ b/src/utils/printCreditsCppBids.m @@ -10,7 +10,7 @@ function printCreditsCppBids(cfg) % printCreditsCppBids(cfg) % % :param cfg: Configuration. See ``checkCFG()``. - % :type argin1: structure + % :type cfg: structure % try From 13844c6c407e8fecbf7f2789f99bde93a1c85ae0 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:49:56 +0100 Subject: [PATCH 45/70] Update src/utils/returnHeaderName.m Co-authored-by: Remi Gau --- src/utils/returnHeaderName.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/returnHeaderName.m b/src/utils/returnHeaderName.m index 840f4062..208f503b 100644 --- a/src/utils/returnHeaderName.m +++ b/src/utils/returnHeaderName.m @@ -6,7 +6,7 @@ % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % headerName = returnHeaderName(columnName, nbCol, iCol) % % :param columnName: The column name to print % :type columnName: string From be370362fd83ef01f528aff5bfcd9b5cbe7bcb9c Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:50:05 +0100 Subject: [PATCH 46/70] Update src/utils/returnHeaderName.m Co-authored-by: CerenB --- src/utils/returnHeaderName.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/returnHeaderName.m b/src/utils/returnHeaderName.m index 208f503b..a345fc61 100644 --- a/src/utils/returnHeaderName.m +++ b/src/utils/returnHeaderName.m @@ -2,7 +2,7 @@ function headerName = returnHeaderName(columnName, nbCol, iCol) % - % It return one by one the column name to be used as a header in a fresh opened event file + % It returns one by one the column name to be used as a header in a recently opened event file % % USAGE:: % From 94e601cacb5d0c50a6c531559de28b433ffcfc83 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:50:34 +0100 Subject: [PATCH 47/70] Update src/utils/returnNamesExtraColumns.m Co-authored-by: CerenB --- src/utils/returnNamesExtraColumns.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/returnNamesExtraColumns.m b/src/utils/returnNamesExtraColumns.m index 81657bb4..5573695b 100644 --- a/src/utils/returnNamesExtraColumns.m +++ b/src/utils/returnNamesExtraColumns.m @@ -2,7 +2,7 @@ function [namesExtraColumns, logfile] = returnNamesExtraColumns(logFile) % - % It returns the extra colums name(s), in ``cfg.extraColumns``, as header to add to the + % It returns the extra columns name(s), in ``cfg.extraColumns``, as header to add to the % ``event`` file % % USAGE:: From 94d911d02426f9ab3c8996dde89d16851b91f921 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 18:54:20 +0100 Subject: [PATCH 48/70] Apply suggestions from code review --- src/utils/returnHeaderName.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/returnHeaderName.m b/src/utils/returnHeaderName.m index a345fc61..682fc40c 100644 --- a/src/utils/returnHeaderName.m +++ b/src/utils/returnHeaderName.m @@ -12,7 +12,7 @@ % :type columnName: string % :param nbCol: It is the number of columns associated to one entry of the extra column list % :type nbCol: integer - % :param iCol: index of the columns associated to one entry of the extra column list + % :param iCol: Index of the columns associated to one entry of the extra column list % :type iCol: integer % % :returns: - :headerName: (string) return the extra column name to be used as header From 3b8958553d7e32be369d745a87764271779cdae8 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 19:46:33 +0100 Subject: [PATCH 49/70] add doc to returnNbColumns --- src/utils/returnNbColumns.m | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/utils/returnNbColumns.m b/src/utils/returnNbColumns.m index 920890a6..09377cba 100644 --- a/src/utils/returnNbColumns.m +++ b/src/utils/returnNbColumns.m @@ -2,25 +2,19 @@ function nbCol = returnNbColumns(logFile, nameExtraColumn) % - % Short description of what the function does goes here. + % It returns the number of columns associated to one entry of the extra column list. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [nbCol] = returnNbColumns(logFile, nameExtraColumn) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param logFile: It contains every information related to the experiment output(s) + % :type logFile: structure + % :param nameExtraColumn: An entry of ``logFile.extraColumns`` + % :type nameExtraColumn: string % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % nbCol = returnNbColumns(logFile, nameExtraColumn) + % :returns: - :nbCol: (integer) The number of columns associated to one entry of the extra + % column list. % thisExtraColumn = logFile(1).extraColumns.(nameExtraColumn); From 38f4400f06487e5cb382e217cacd4785a024ab9c Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 19:47:00 +0100 Subject: [PATCH 50/70] minor update doc to initializeExtraColumns --- src/utils/initializeExtraColumns.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/initializeExtraColumns.m b/src/utils/initializeExtraColumns.m index 0d974ec9..40cc86cd 100644 --- a/src/utils/initializeExtraColumns.m +++ b/src/utils/initializeExtraColumns.m @@ -8,10 +8,10 @@ % % logFile = initializeExtraColumns(logFile) % - % :param logFile: + % :param logFile: It contains what to save in the experiment outputs. % :type logFile: structure % - % :returns: :logFile: (structure) (dimension) + % :returns: :logFile: (structure) ``logfile`` updated with extra columns. % % Example:: % From 0f1a16c65d1522414bb57a99f58a424a2e0d0fef Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 19:47:16 +0100 Subject: [PATCH 51/70] minor fix to createValidName --- src/utils/createValidName.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/createValidName.m b/src/utils/createValidName.m index 8aa0c7e0..e4e9c032 100644 --- a/src/utils/createValidName.m +++ b/src/utils/createValidName.m @@ -10,7 +10,7 @@ % % :param taskName: (dimension) obligatory argument. Lorem ipsum dolor sit amet, % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: string + % :type taskName: string % % :returns: % :name: (string) returns the input with an upper case for first letter From 23ba82008ad9b360f32922e39ad58371c31be988 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 19:47:33 +0100 Subject: [PATCH 52/70] minor fix to createJson --- src/createJson.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/createJson.m b/src/createJson.m index 277d243a..b5e219f5 100644 --- a/src/createJson.m +++ b/src/createJson.m @@ -26,6 +26,9 @@ function createJson(varargin) % a valid BIDS dataset. % :type extraInfo: structure % + % :output: - :``*.json``: (jsonfile) The file name corresponds to the run + suffix depending on + % the arguments passed in. + % % .. TODO: % % - use input parser for this one From 993740beb0bd712e90f4cd55a6f6d3a269cc7665 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 19:47:46 +0100 Subject: [PATCH 53/70] add doc to createDatasetDescription --- src/createDatasetDescription.m | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/createDatasetDescription.m b/src/createDatasetDescription.m index 84007bea..da6a8f50 100644 --- a/src/createDatasetDescription.m +++ b/src/createDatasetDescription.m @@ -2,28 +2,18 @@ function createDatasetDescription(cfg) % - % Short description of what the function does goes here. + % It creates ``dataset_description.json`` and writes in every entry contained in + % ``cfg.bids.datasetDescription``. The file should goes in the root of a BIDS dataset. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % createDatasetDescription(cfg) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param cfg: Configuration. See ``checkCFG()``. + % :type cfg: structure % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :output: - :``dataset_description.json``: (jsonfile) % - % createDatasetDescription(cfg) - % - % creates the datasetDescription.json file that goes in the root of a BIDS - % dataset opts.Indent = ' '; From 2e7ff48636bc7ac1fdff22ca0fbed5cf8fc32333 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 19:52:11 +0100 Subject: [PATCH 54/70] Update src/convertSourceToRaw.m --- src/convertSourceToRaw.m | 1 - 1 file changed, 1 deletion(-) diff --git a/src/convertSourceToRaw.m b/src/convertSourceToRaw.m index ad62d11e..3e779a53 100644 --- a/src/convertSourceToRaw.m +++ b/src/convertSourceToRaw.m @@ -5,7 +5,6 @@ function convertSourceToRaw(cfg) % Function attempts to convert a source dataset created with CPP_BIDS into a valid % BIDS data set. % - % Only covers func folder at the moment % % USAGE:: % From 25dd99fb8c4bc4662cbe607df80b06a12ebd7df9 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 10:10:06 +0100 Subject: [PATCH 55/70] reformat help section from checkCFG --- src/checkCFG.m | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/checkCFG.m b/src/checkCFG.m index 4c3a3318..2f2eb114 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -2,28 +2,24 @@ function cfg = checkCFG(cfg) % - % Short description of what the function does goes here. + % Check the fields of the configuration structure ``cfg``. If a required field is + % missing the default value will be assigned to that field. If this field already + % exists then the existing value will not be replaced. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % cfg = checkCFG([cfg]) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param cfg: Lorem ipsum dolor sit amet, + % consectetur adipiscing elit. Ut congue nec est ac lacinia. + % :type cfg: type % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: :cfg: (structure) + % + % This function reuses a lot of code and comment from the BIDS starter kit: + % https://github.com/bids-standard/bids-starter-kit/tree/master/matlabCode % - % cfg = checkCFG(cfg) - % - % check that we have all the fields that we need in the experiment parameters - % reuses a lot of code from the BIDS starter kit + if nargin < 1 || isempty(cfg) cfg = struct(); From 0186b98def1fa23c20906ad7746abf89d66fbf23 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 13:17:34 +0100 Subject: [PATCH 56/70] reorder checkCFG sub-functions by order of appearance in main function --- src/checkCFG.m | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/checkCFG.m b/src/checkCFG.m index 2f2eb114..f20cc488 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -54,12 +54,12 @@ %% BIDS - fieldsToSet = behJsonDefaults(fieldsToSet); fieldsToSet = datasetDescriptionDefaults(fieldsToSet); + fieldsToSet = behJsonDefaults(fieldsToSet); + fieldsToSet = mriJsonDefaults(fieldsToSet); fieldsToSet = eegJsonDefaults(fieldsToSet); fieldsToSet = ieegJsonDefaults(fieldsToSet); fieldsToSet = megJsonDefaults(fieldsToSet); - fieldsToSet = mriJsonDefaults(fieldsToSet); fieldsToSet = transferInfoToBids(fieldsToSet, cfg); @@ -126,6 +126,17 @@ end +function fieldsToSet = behJsonDefaults(fieldsToSet) + % for json for BEH data + + fieldsToSet.bids.beh.TaskName = []; + + fieldsToSet.bids.beh.Instructions = []; + + fieldsToSet.bids.beh = orderfields(fieldsToSet.bids.beh); + +end + function fieldsToSet = mriJsonDefaults(fieldsToSet) % for json for funcfional MRI data @@ -251,17 +262,6 @@ end -function fieldsToSet = behJsonDefaults(fieldsToSet) - % for json for BEH data - - fieldsToSet.bids.beh.TaskName = []; - - fieldsToSet.bids.beh.Instructions = []; - - fieldsToSet.bids.ieeg = orderfields(fieldsToSet.bids.beh); - -end - function fieldsToSet = eyetrackerDefaults(fieldsToSet) fieldsToSet.eyeTracker.do = false; From 5892a8b45ecbcb330b41a3c569e831a4215e9957 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 16:59:50 +0100 Subject: [PATCH 57/70] remove repetition time from the list of suffixes --- src/checkCFG.m | 1 - tests/test_checkCFG.m | 1 - 2 files changed, 2 deletions(-) diff --git a/src/checkCFG.m b/src/checkCFG.m index f20cc488..28c29451 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -76,7 +76,6 @@ fieldsToSet.suffix.reconstruction = []; fieldsToSet.suffix.echo = []; fieldsToSet.suffix.acquisition = []; - fieldsToSet.suffix.repetitionTime = []; fieldsToSet.suffix.recording = []; fieldsToSet.suffix = orderfields(fieldsToSet.suffix); diff --git a/tests/test_checkCFG.m b/tests/test_checkCFG.m index dc2edc90..25809d22 100644 --- a/tests/test_checkCFG.m +++ b/tests/test_checkCFG.m @@ -103,7 +103,6 @@ function test_checkCfgBasic() expectedCfgStructure.suffix.reconstruction = []; expectedCfgStructure.suffix.echo = []; expectedCfgStructure.suffix.acquisition = []; - expectedCfgStructure.suffix.repetitionTime = []; expectedCfgStructure.suffix.recording = []; expectedCfgStructure.bids.beh.TaskName = ''; From 8a788b7a47b0e6805fd86303b23115d3ca59d17e Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 17:15:21 +0100 Subject: [PATCH 58/70] update help section of checkCFG --- src/checkCFG.m | 165 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 159 insertions(+), 6 deletions(-) diff --git a/src/checkCFG.m b/src/checkCFG.m index 28c29451..6eb55c63 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -10,16 +10,171 @@ % % cfg = checkCFG([cfg]) % - % :param cfg: Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type cfg: type + % :param cfg: The configuration variable to check. + % :type cfg: structure % % :returns: :cfg: (structure) % % This function reuses a lot of code and comment from the BIDS starter kit: + % % https://github.com/bids-standard/bids-starter-kit/tree/master/matlabCode % - + % **Fields descriptions**: + % The following section describes the main fields set by ``checkCFG()`` with + % their associated default value. + % + % - ``cfg.testingDevice = 'pc'`` + % set the way the experiment is run and the different options match the imaging + % modality: + % + % - ``pc`` is for behavioral test + % - ``mri`` is for fMRI + % - ``eeg`` is for EEG... + % + % - ``cfg.verbose = 0`` + % sets how talkative the code will be. Possible values range from ``0`` to ``2``. + % + % - ``cfg.useGUI = false`` + % sets whether a graphic interface should be used for the ``userInputs()`` + % to query about group name, as well as for session, subject and run number. + % + % - ``cfg.dir.output`` + % sets where the data will be saved. + % + % Filename options: + % Sets options that will help in creating the filenames. + % + % - ``cfg.fileName.task = ''`` + % sets the name to be given to the task + % - ``cfg.fileName.zeroPadding = 3`` + % sets tha amount of 0 padding the subject, session and run number. + % - ``cfg.fileName.dateFormat = 'yyyymmddHHMM'`` + % sets the format of the date and time stamp that will be appended to all files. + % + % The following fields can be used to specify certain of the labels that are used + % to specify certain of the acquisition conditions of certain experemental runs + % in a BIDS data set. These are mostly for MRI and, if set, will be ignored + % for most other modalities. See ``tests/test_createFilename()`` for details on how + % to use these. + % + % - ``cfg.suffix.contrastEnhancement = []`` + % - ``cfg.suffix.phaseEncodingDirection = []`` + % - ``cfg.suffix.reconstruction = []`` + % - ``cfg.suffix.echo = []`` + % - ``cfg.suffix.acquisition = []`` + % - ``cfg.suffix.recording = []`` + % + % Group and session options: + % All the fields of ``cfg.subject`` can be set using the ``userInputs()`` function + % but can also be set "manually" directly into the ``cfg`` structure. + % + % - ``cfg.subject.subjectGrp = ''`` + % is set to empty in case no group was provided. + % - ``cfg.subject.sessionNb = 1`` + % always sets to 1 in case no session was provided. + % - ``cfg.subject.askGrpSess = [true true]`` + % means that ``userInputs()`` will always ask for group and session by default. + % + % Eyetracker options: + % Those options are mostly work in progress at the moment but should allow to + % track the some of the metadata regarding eyetracking data acquisition. + % + % - ``cfg.eyeTracker.do = false`` + % - ``cfg.eyeTracker.SamplingFrequency = []`` + % - ``cfg.eyeTracker.PupilPositionType = ''`` + % - ``cfg.eyeTracker.RawSamples = []`` + % - ``cfg.eyeTracker.Manufacturer = ''`` + % - ``cfg.eyeTracker.ManufacturersModelName = ''`` + % - ``cfg.eyeTracker.SoftwareVersions = ''`` + % - ``cfg.eyeTracker.CalibrationType = 'HV5'`` + % - ``cfg.eyeTracker.CalibrationPosition = ''`` + % - ``cfg.eyeTracker.CalibrationDistance = ''`` + % - ``cfg.eyeTracker.MaximalCalibrationError = []`` + % - ``cfg.eyeTracker.AverageCalibrationError = []`` + % - ``cfg.eyeTracker.RawDataFilters = {}`` + % + % ``cfg.bids``: + % ``checkCFG()`` will also initialize ``cfg.bids`` that + % contains any information related to a BIDS data set and that will end up in + % in one of the JSON "sidecar" files containing the metadata of your + % experiment. + % + % If the content of some fields of ``cfg`` has been set before running ``checkCFG()``, + % that content might be copied into the relevant field in ``cfg.bids``. For example, + % if you have set the field ``cfg.mri.repetitionTime``, then when you run ``checkCFG()``, + % its content will also be copied into ``cfg.bids.mri.RepetitionTime``. + % + % ``cfg.bids`` is further sub-divided into several fields for the different + % "imaging modalities". + % + % - ``cfg.bids.datasetDescription`` will be there for all type of experiments + % - ``cfg.bids.beh`` is for purely behavioral experiment with no associated imaging + % - ``cfg.bids.mri`` is for fMRI experiments + % - ``cfg.bids.eeg`` is for EEG experiments + % - ``cfg.bids.meg`` is for MEG experiments + % - ``cfg.bids.ieeg`` is for iEEG experiments + % + % The content of each of those subfields matches the different "keys" one can find + % in the JSON file for each modality. The content of those different keys is detailed + % in the code of ``checkCFG()``, + % but a more extensive and updated descriptions will be found in the + % BIDS specifications themselves. + % + % https://bids-specification.readthedocs.io/en/stable/ + % + % For the content of the ``datasetDescription.json`` files:: + % + % 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 = ''; + % + % For the content of the JSON files for behavioral data:: + % + % cfg.bids.beh.TaskName = []; + % cfg.bids.beh.Instructions = []; + % + % For the content of the JSON files for fMRI data:: + % + % cfg.bids.mri.TaskName = ''; + % cfg.bids.mri.Instructions = ''; + % cfg.bids.mri.RepetitionTime = []; + % cfg.bids.mri.SliceTiming = ''; + % cfg.bids.mri.TaskDescription = ''; + % + % For the content of the JSON files for EEG:: + % + % cfg.bids.eeg.TaskName = ''; + % cfg.bids.eeg.Instructions = ''; + % cfg.bids.eeg.EEGReference = ''; + % cfg.bids.eeg.SamplingFrequency = []; + % cfg.bids.eeg.PowerLineFrequency = 50; + % cfg.bids.eeg.SoftwareFilters = 'n/a'; + % + % For the content of the JSON files for iEEG:: + % + % cfg.bids.ieeg.TaskName = ''; + % cfg.bids.ieeg.Instructions = ''; + % cfg.bids.ieeg.iEEGReference = ''; + % cfg.bids.ieeg.SamplingFrequency = []; + % cfg.bids.ieeg.PowerLineFrequency = 50; + % cfg.bids.ieeg.SoftwareFilters = 'n/a'; + % + % For the content of the JSON files for MEG:: + % + % cfg.bids.meg.TaskName = ''; + % cfg.bids.meg.Instructions = ''; + % cfg.bids.meg.SamplingFrequency = []; + % cfg.bids.meg.PowerLineFrequency = []; + % cfg.bids.meg.DewarPosition = []; + % cfg.bids.meg.SoftwareFilters = []; + % cfg.bids.meg.DigitizedLandmarks = []; + % cfg.bids.meg.DigitizedHeadPoints = []; if nargin < 1 || isempty(cfg) cfg = struct(); @@ -27,8 +182,6 @@ checkCppBidsDependencies(cfg); - %% list the defaults to set - fieldsToSet.verbose = 0; fieldsToSet.useGUI = false; From 36e05895c0b83903c5b3730dc7203956a3c981a9 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 17:18:32 +0100 Subject: [PATCH 59/70] mh fix --- src/checkCFG.m | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/checkCFG.m b/src/checkCFG.m index 6eb55c63..762681ca 100644 --- a/src/checkCFG.m +++ b/src/checkCFG.m @@ -2,9 +2,9 @@ function cfg = checkCFG(cfg) % - % Check the fields of the configuration structure ``cfg``. If a required field is + % Check the fields of the configuration structure ``cfg``. If a required field is % missing the default value will be assigned to that field. If this field already - % exists then the existing value will not be replaced. + % exists then the existing value will not be replaced. % % USAGE:: % @@ -14,13 +14,13 @@ % :type cfg: structure % % :returns: :cfg: (structure) - % + % % This function reuses a lot of code and comment from the BIDS starter kit: % % https://github.com/bids-standard/bids-starter-kit/tree/master/matlabCode % % **Fields descriptions**: - % The following section describes the main fields set by ``checkCFG()`` with + % The following section describes the main fields set by ``checkCFG()`` with % their associated default value. % % - ``cfg.testingDevice = 'pc'`` @@ -31,8 +31,8 @@ % - ``mri`` is for fMRI % - ``eeg`` is for EEG... % - % - ``cfg.verbose = 0`` - % sets how talkative the code will be. Possible values range from ``0`` to ``2``. + % - ``cfg.verbose = 0`` + % sets how talkative the code will be. Possible values range from ``0`` to ``2``. % % - ``cfg.useGUI = false`` % sets whether a graphic interface should be used for the ``userInputs()`` @@ -46,14 +46,14 @@ % % - ``cfg.fileName.task = ''`` % sets the name to be given to the task - % - ``cfg.fileName.zeroPadding = 3`` + % - ``cfg.fileName.zeroPadding = 3`` % sets tha amount of 0 padding the subject, session and run number. % - ``cfg.fileName.dateFormat = 'yyyymmddHHMM'`` % sets the format of the date and time stamp that will be appended to all files. - % + % % The following fields can be used to specify certain of the labels that are used % to specify certain of the acquisition conditions of certain experemental runs - % in a BIDS data set. These are mostly for MRI and, if set, will be ignored + % in a BIDS data set. These are mostly for MRI and, if set, will be ignored % for most other modalities. See ``tests/test_createFilename()`` for details on how % to use these. % @@ -63,16 +63,16 @@ % - ``cfg.suffix.echo = []`` % - ``cfg.suffix.acquisition = []`` % - ``cfg.suffix.recording = []`` - % - % Group and session options: + % + % Group and session options: % All the fields of ``cfg.subject`` can be set using the ``userInputs()`` function % but can also be set "manually" directly into the ``cfg`` structure. % - % - ``cfg.subject.subjectGrp = ''`` + % - ``cfg.subject.subjectGrp = ''`` % is set to empty in case no group was provided. - % - ``cfg.subject.sessionNb = 1`` + % - ``cfg.subject.sessionNb = 1`` % always sets to 1 in case no session was provided. - % - ``cfg.subject.askGrpSess = [true true]`` + % - ``cfg.subject.askGrpSess = [true true]`` % means that ``userInputs()`` will always ask for group and session by default. % % Eyetracker options: @@ -97,14 +97,14 @@ % ``checkCFG()`` will also initialize ``cfg.bids`` that % contains any information related to a BIDS data set and that will end up in % in one of the JSON "sidecar" files containing the metadata of your - % experiment. + % experiment. % % If the content of some fields of ``cfg`` has been set before running ``checkCFG()``, % that content might be copied into the relevant field in ``cfg.bids``. For example, % if you have set the field ``cfg.mri.repetitionTime``, then when you run ``checkCFG()``, % its content will also be copied into ``cfg.bids.mri.RepetitionTime``. % - % ``cfg.bids`` is further sub-divided into several fields for the different + % ``cfg.bids`` is further sub-divided into several fields for the different % "imaging modalities". % % - ``cfg.bids.datasetDescription`` will be there for all type of experiments @@ -114,14 +114,14 @@ % - ``cfg.bids.meg`` is for MEG experiments % - ``cfg.bids.ieeg`` is for iEEG experiments % - % The content of each of those subfields matches the different "keys" one can find - % in the JSON file for each modality. The content of those different keys is detailed - % in the code of ``checkCFG()``, - % but a more extensive and updated descriptions will be found in the - % BIDS specifications themselves. + % The content of each of those subfields matches the different "keys" one can find + % in the JSON file for each modality. The content of those different keys is detailed + % in the code of ``checkCFG()``, + % but a more extensive and updated descriptions will be found in the + % BIDS specifications themselves. % % https://bids-specification.readthedocs.io/en/stable/ - % + % % For the content of the ``datasetDescription.json`` files:: % % cfg.bids.datasetDescription.Name = ''; @@ -146,7 +146,7 @@ % cfg.bids.mri.RepetitionTime = []; % cfg.bids.mri.SliceTiming = ''; % cfg.bids.mri.TaskDescription = ''; - % + % % For the content of the JSON files for EEG:: % % cfg.bids.eeg.TaskName = ''; @@ -155,7 +155,7 @@ % cfg.bids.eeg.SamplingFrequency = []; % cfg.bids.eeg.PowerLineFrequency = 50; % cfg.bids.eeg.SoftwareFilters = 'n/a'; - % + % % For the content of the JSON files for iEEG:: % % cfg.bids.ieeg.TaskName = ''; From 4488a846f39ef05369869eb7278c309fb749f586 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 17:50:48 +0100 Subject: [PATCH 60/70] update help section transferInfoToBids --- src/utils/transferInfoToBids.m | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/utils/transferInfoToBids.m b/src/utils/transferInfoToBids.m index a57a68f2..cdb464d5 100644 --- a/src/utils/transferInfoToBids.m +++ b/src/utils/transferInfoToBids.m @@ -2,28 +2,26 @@ function fieldsToSet = transferInfoToBids(fieldsToSet, cfg) % - % Short description of what the function does goes here. + % Transfers any info that might have been provided + % by the user in ``cfg`` to the relevant field of ``fieldsToSet`` + % for its reuse later for BIDS filenames or JSON. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % fieldsToSet = transferInfoToBids(fieldsToSet, cfg) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % :type argin3: integer + % :param fieldsToSet: List of the fields to set. See ``checkCFG()``. + % :type fieldsToSet: structure + % :param cfg: The configuration variable where the user has predefined some fields. + % See ``checkCFG()``. + % :type cfg: structure % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: :fieldsToSet: Updated list of the fields to set. % - % fieldsToSet = transferInfoToBids(fieldsToSet, cfg) + % This can be used for example to make sure that the repetition time set + % manually in ``cfg.mri.repetitionTime`` or in ``cfg.task.name`` + % will be passed to the correct field in right fields of ``cfg.bids``. % - % transfer any info that might have been provided by the user to the - % relevant field for its reuse for BIDS filenames or JSON later if isfield(cfg, 'task') && isfield(cfg.task, 'name') [taskName, taskNameValid] = createValidName(cfg.task.name); From 19b208fa1098d2a955fd0ee5fb676d1d2089094f Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 19:44:08 +0100 Subject: [PATCH 61/70] basic set up of the doc --- README.md | 29 +------- docs/README.md | 2 +- docs/functions-description.md | 98 ---------------------------- docs/source/contributing.rst | 7 +- docs/source/function_description.rst | 1 - docs/source/gui.rst | 18 +++++ docs/source/index.rst | 39 +++++++++-- docs/source/set_up.rst | 53 +++++++++++++++ docs/source/utilities.rst | 2 +- 9 files changed, 112 insertions(+), 137 deletions(-) create mode 100644 docs/source/gui.rst create mode 100644 docs/source/set_up.rst diff --git a/README.md b/README.md index 971efaaa..6f23bdc8 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/docs/README.md b/docs/README.md index d34286ac..7d772758 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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 ``` diff --git a/docs/functions-description.md b/docs/functions-description.md index b6c3ab0d..d8fbb811 100644 --- a/docs/functions-description.md +++ b/docs/functions-description.md @@ -5,42 +5,14 @@ - [functions description](#functions-description) - - [userInputs](#userinputs) - [createFilename](#createfilename) - [saveEventsFile](#saveeventsfile) - - [checkCFG](#checkcfg) - - [CFG content](#cfg-content) - [createBoldJson](#createboldjson) -## 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 @@ -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 diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst index fb47029d..38d48d74 100644 --- a/docs/source/contributing.rst +++ b/docs/source/contributing.rst @@ -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 `_ +on the CPP lab's Github organization. Function templates diff --git a/docs/source/function_description.rst b/docs/source/function_description.rst index 5a721c9c..99940d0d 100644 --- a/docs/source/function_description.rst +++ b/docs/source/function_description.rst @@ -7,7 +7,6 @@ List of functions in the ``src`` folder. .. automodule:: src -.. autofunction:: checkCFG .. autofunction:: convertSourceToRaw .. autofunction:: createDataDictionary .. autofunction:: createDatasetDescription diff --git a/docs/source/gui.rst b/docs/source/gui.rst new file mode 100644 index 00000000..631f935f --- /dev/null +++ b/docs/source/gui.rst @@ -0,0 +1,18 @@ +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:: askUserCli +.. autofunction:: askUserGui +.. autofunction:: createQuestionList +.. autofunction:: getIsQuestionToAsk +.. autofunction:: setDefaultResponses + + diff --git a/docs/source/index.rst b/docs/source/index.rst index c1b29398..b663cb83 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -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! ********************************** @@ -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 `_ +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-_task-*_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 diff --git a/docs/source/set_up.rst b/docs/source/set_up.rst new file mode 100644 index 00000000..41c9edfb --- /dev/null +++ b/docs/source/set_up.rst @@ -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. \ No newline at end of file diff --git a/docs/source/utilities.rst b/docs/source/utilities.rst index 9197bd4a..4d0fb7c2 100644 --- a/docs/source/utilities.rst +++ b/docs/source/utilities.rst @@ -19,4 +19,4 @@ List of functions in the ``utils`` folder. .. autofunction:: returnNamesExtraColumns .. autofunction:: returnNbColumns .. autofunction:: setDefaultFields -.. autofunction:: transferInfoToBids + From 815efad1d5f6ac13af76e7a1467a1a9852b06394 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 20:03:03 +0100 Subject: [PATCH 62/70] minor fix on the doc to build rtd --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index d34286ac..7d772758 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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 ``` From 2d76e8f7134f24ebe615acb471ef8f32c2b13a09 Mon Sep 17 00:00:00 2001 From: marcobarilari <38101692+marcobarilari@users.noreply.github.com> Date: Mon, 16 Nov 2020 20:09:40 +0100 Subject: [PATCH 63/70] Apply suggestions from code review Co-authored-by: Remi Gau --- src/createDatasetDescription.m | 2 +- src/utils/createValidName.m | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/createDatasetDescription.m b/src/createDatasetDescription.m index da6a8f50..2d16c694 100644 --- a/src/createDatasetDescription.m +++ b/src/createDatasetDescription.m @@ -3,7 +3,7 @@ function createDatasetDescription(cfg) % % It creates ``dataset_description.json`` and writes in every entry contained in - % ``cfg.bids.datasetDescription``. The file should goes in the root of a BIDS dataset. + % ``cfg.bids.datasetDescription``. The file should go in the root of a BIDS dataset. % % USAGE:: % diff --git a/src/utils/createValidName.m b/src/utils/createValidName.m index e4e9c032..2d7ea607 100644 --- a/src/utils/createValidName.m +++ b/src/utils/createValidName.m @@ -8,8 +8,7 @@ % % [taskName, taskNameValid] = createTaskName(taskName) % - % :param taskName: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. + % :param taskName: Name given to the task. Can be any string including spaces and special characters. % :type taskName: string % % :returns: From 01c0736f0478031e36441d858e3400d31fdb3a66 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 20:10:41 +0100 Subject: [PATCH 64/70] move command line function of user input in the doc and fix typo --- docs/source/gui.rst | 1 - docs/source/utilities.rst | 3 +++ src/gui/askUserCli.m | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/source/gui.rst b/docs/source/gui.rst index 631f935f..3852af8a 100644 --- a/docs/source/gui.rst +++ b/docs/source/gui.rst @@ -9,7 +9,6 @@ that can be used to deal with ``userInputs()``. .. automodule:: src.gui .. autofunction:: askForGroupAndOrSession -.. autofunction:: askUserCli .. autofunction:: askUserGui .. autofunction:: createQuestionList .. autofunction:: getIsQuestionToAsk diff --git a/docs/source/utilities.rst b/docs/source/utilities.rst index 4d0fb7c2..f78e6fee 100644 --- a/docs/source/utilities.rst +++ b/docs/source/utilities.rst @@ -20,3 +20,6 @@ List of functions in the ``utils`` folder. .. autofunction:: returnNbColumns .. autofunction:: setDefaultFields +.. automodule:: src.gui + +.. autofunction:: askUserCli diff --git a/src/gui/askUserCli.m b/src/gui/askUserCli.m index d44d04bd..3615d9f5 100644 --- a/src/gui/askUserCli.m +++ b/src/gui/askUserCli.m @@ -2,7 +2,7 @@ function responses = askUserCli(questions, responses) % - % It shows the questions to ask in the commnad window and checks, when it is necessary, if the + % It shows the questions to ask in the command window and checks, when it is necessary, if the % given input by the user is an integer. % % USAGE:: From cc48a1d5b4a18f7ebd6f9f03202cbbcb0b62aea6 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 20:49:28 +0100 Subject: [PATCH 65/70] mh fix --- src/createDataDictionary.m | 1 - src/utils/createValidName.m | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/createDataDictionary.m b/src/createDataDictionary.m index 2b68e727..def87e47 100644 --- a/src/createDataDictionary.m +++ b/src/createDataDictionary.m @@ -14,7 +14,6 @@ function createDataDictionary(cfg, logFile) % :param logFile: Contains the data you want to save. % :type logFile: structure - fileName = strrep(logFile(1).filename, '.tsv', '.json'); fullFilename = getFullFilename(fileName, cfg); diff --git a/src/utils/createValidName.m b/src/utils/createValidName.m index 2d7ea607..27036a2f 100644 --- a/src/utils/createValidName.m +++ b/src/utils/createValidName.m @@ -8,7 +8,8 @@ % % [taskName, taskNameValid] = createTaskName(taskName) % - % :param taskName: Name given to the task. Can be any string including spaces and special characters. + % :param taskName: Name given to the task. Can be any string including spaces + % and special characters. % :type taskName: string % % :returns: From 31b5542f2cf0b032a2891c27b9f0388eba48a930 Mon Sep 17 00:00:00 2001 From: marcobarilari Date: Mon, 16 Nov 2020 20:55:50 +0100 Subject: [PATCH 66/70] sphynx fix --- src/convertSourceToRaw.m | 11 +++++------ src/createFilename.m | 10 +++++----- src/createJson.m | 5 +++-- src/gui/setDefaultResponses.m | 2 +- src/utils/returnNbColumns.m | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/convertSourceToRaw.m b/src/convertSourceToRaw.m index 3e779a53..293aebd2 100644 --- a/src/convertSourceToRaw.m +++ b/src/convertSourceToRaw.m @@ -10,15 +10,14 @@ function convertSourceToRaw(cfg) % % convertSourceToRaw(cfg) % - % :param cfg: cfg structure is needed only for providing the path in - % ``cfg.dir.output`` + % :param cfg: cfg structure is needed only for providing the path in ``cfg.dir.output``. % :type cfg: structure % % :output: - % - creates dummy README and CHANGE file - % - copy source dir to raw dir - % - remove the date suffix (_date-*) from the files where it is present - % - zips the _stim files. + % - :creates: dummy README and CHANGE file + % - :copy: source dir to raw dir + % - :remove: the date suffix (_date-*) from the files where it is present + % - :zip: the _stim files. sourceDir = fullfile(cfg.dir.output, 'source'); rawDir = fullfile(cfg.dir.output, 'raw'); diff --git a/src/createFilename.m b/src/createFilename.m index dafab64a..c38cb0dc 100644 --- a/src/createFilename.m +++ b/src/createFilename.m @@ -21,11 +21,11 @@ % % The behavior of this function depends on: % - ``cfg.testingDevice``: - % - set to ``pc`` (dummy try) or ``beh`` can work for behavioral experiment. - % - set on ``mri`` for fMRI experiment. - % - set on ``eeg`` or ``ieeg`` can work for electro encephalography or - % intracranial eeg - % - set on ``meg`` can work for magneto encephalography + % + set to ``pc`` (dummy try) or ``beh`` can work for behavioral experiment. + % + set on ``mri`` for fMRI experiment. + % + set on ``eeg`` or ``ieeg`` can work for electro encephalography or intracranial eeg + % + set on ``meg`` can work for magneto encephalography + % % - ``cfg.eyeTracker.do`` set to ``true``, can work for simple eyetracking data. % % See ``test_createFilename`` in the ``tests`` folder for more details on how to use it. diff --git a/src/createJson.m b/src/createJson.m index b5e219f5..a99ab373 100644 --- a/src/createJson.m +++ b/src/createJson.m @@ -26,8 +26,9 @@ function createJson(varargin) % a valid BIDS dataset. % :type extraInfo: structure % - % :output: - :``*.json``: (jsonfile) The file name corresponds to the run + suffix depending on - % the arguments passed in. + % :output: + % - :``*.json``: (jsonfile) The file name corresponds to the run + suffix depending + % on the arguments passed in. % % .. TODO: % diff --git a/src/gui/setDefaultResponses.m b/src/gui/setDefaultResponses.m index d9ff6d35..3376b736 100644 --- a/src/gui/setDefaultResponses.m +++ b/src/gui/setDefaultResponses.m @@ -13,7 +13,7 @@ % % :returns: - :responses: (cell) It contains the response set by default % - :cfg: (structure) Configuration update with ``cfg.debug.do`` set to false if not - % set by the user. + % set by the user. % if nargin < 1 diff --git a/src/utils/returnNbColumns.m b/src/utils/returnNbColumns.m index 09377cba..c46fef34 100644 --- a/src/utils/returnNbColumns.m +++ b/src/utils/returnNbColumns.m @@ -14,7 +14,7 @@ % :type nameExtraColumn: string % % :returns: - :nbCol: (integer) The number of columns associated to one entry of the extra - % column list. + % column list. % thisExtraColumn = logFile(1).extraColumns.(nameExtraColumn); From 297b8f9ccca1f0c69ef8fc71cb881055335ba318 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 21:07:44 +0100 Subject: [PATCH 67/70] fixes doc in convertSourceToRaw --- src/convertSourceToRaw.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/convertSourceToRaw.m b/src/convertSourceToRaw.m index 293aebd2..edb6dcaf 100644 --- a/src/convertSourceToRaw.m +++ b/src/convertSourceToRaw.m @@ -14,10 +14,10 @@ function convertSourceToRaw(cfg) % :type cfg: structure % % :output: - % - :creates: dummy README and CHANGE file - % - :copy: source dir to raw dir - % - :remove: the date suffix (_date-*) from the files where it is present - % - :zip: the _stim files. + % - :creates: a dummy README and CHANGE file + % - :copies: ``source`` directory to ``raw`` directory + % - :removes: the date suffix ``_date-*`` from the files where it is present + % - :zips: the ``_stim.tsv`` files. sourceDir = fullfile(cfg.dir.output, 'source'); rawDir = fullfile(cfg.dir.output, 'raw'); From c212459b5d54e539f768421ab843f1bcba77aa40 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 21:09:06 +0100 Subject: [PATCH 68/70] fix returnNbColumns --- src/utils/returnNbColumns.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/returnNbColumns.m b/src/utils/returnNbColumns.m index c46fef34..efba05e3 100644 --- a/src/utils/returnNbColumns.m +++ b/src/utils/returnNbColumns.m @@ -13,7 +13,8 @@ % :param nameExtraColumn: An entry of ``logFile.extraColumns`` % :type nameExtraColumn: string % - % :returns: - :nbCol: (integer) The number of columns associated to one entry of the extra + % :returns: + % - :nbCol: (integer) The number of columns associated to one entry of the extra % column list. % From 2535ac6c49744e7067c560b8b1d7b4e79512a428 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 21:25:54 +0100 Subject: [PATCH 69/70] update help section on saveEvents --- src/saveEventsFile.m | 81 ++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/src/saveEventsFile.m b/src/saveEventsFile.m index b254a91d..a5ad234b 100644 --- a/src/saveEventsFile.m +++ b/src/saveEventsFile.m @@ -1,6 +1,6 @@ % (C) Copyright 2020 CPP_BIDS developers -function [logFile] = saveEventsFile(action, cfg, logFile) +function logFile = saveEventsFile(action, cfg, logFile) % % Function to save output files for events that will be BIDS compliant. % @@ -8,60 +8,67 @@ % % [logFile] = saveEventsFile(action, cfg, logFile) % - % logFile] = saveEventsFile('init', [cfg], logFile) - % logFile] = saveEventsFile('open', [cfg], logFile) - % logFile] = saveEventsFile('open_stim', [cfg], logFile) - % logFile] = saveEventsFile('save', [cfg], logFile) - % logFile] = saveEventsFile('close', cfg, logFile) + % :param action: Defines the operation to do. The different possibilities are + % ``'init'``, ``'open'``, ``'open_stim'``, ``'save'`` or ``'close'``. + % For more information on each case see below. + % :type action: string + % :param cfg: Configuration variable. See ``checkCFG()``. + % :type cfg: structure + % :param logFile: (n x 1) The ``logFile`` variable that contains the n events + % you want to save must be a nx1 structure. + % :type logFile: structure + % + % .. todo: + % - more details about how to structure the logFile variable % - % INPUTS - % - % logFile: - % - % When you want to save your data ``logFile`` contains the data you want to save. - % The ``logFile`` variable that contains the n events you want to save must be a nx1 structure. - % Each field will be saved in a separate column. + % See ``tests/test_saveEventsFile()`` for more details on how to use it. % - % example:: + % Example:: % % logFile(1,1).onset = 2; % logFile(1,1).trial_type = 'motion_up'; % logFile(1,1).duration = 1; - % logFile(1,1).speed = 2; - % logFile(1,1).is_fixation = true; % - % logFile(2,1).onset = 3; - % logFile(2,1).trial_type = 'static'; - % logFile(2,1).duration = 4; - % logFile(2,1).is_fixation = 3; + % Actions: % + % .. todo: + % wait for updates on the API of this function to finish updating % - % action: + % Example:: % - % - ``'open'`` will create the file ID and return it in ``logFile.fileID`` using - % the information in the ``cfg`` structure. - % This file ID is then reused when calling that function to save data into this file. - % This creates the header with the obligatory ``'onset'``, ``'duration'`` required - % by BIDS and other columns can be specified in varargin. + % logFile = saveEventsFile('init', [cfg], logFile) + % logFile = saveEventsFile('open', [cfg], logFile) + % logFile = saveEventsFile('open_stim', [cfg], logFile) + % logFile = saveEventsFile('save', [cfg], logFile) % - % example:: + % - ``'open'`` will create the file ID and return it in ``logFile.fileID`` using + % the information in the ``cfg`` structure. + % This file ID is then reused when calling that function to save data into this file. + % This creates the header with the obligatory ``'onset'``, ``'duration'`` required + % by BIDS and other columns can be specified in varargin. % - % logFile = saveEventsFile('open', cfg, [], 'direction', 'speed', 'target'); + % Example:: % + % logFile = saveEventsFile('open', cfg, logFile); % - % - ``'save'`` will save the data contained in logfile by using the file ID ``logFile.fileID``; - % logfile must then contain: + % - ``'save'`` will save the data contained in logfile by using the file ID ``logFile.fileID``; + % logfile must then contain: % - % - logFile.onset - % - logFile.trial_type - % - logFile.duration + % - logFile.onset + % - logFile.trial_type + % - logFile.duration % - % The name of any extra column whose content must be saved should be listed in varargin. + % Example:: % - % - ``'close'`` closes the file with file ID ``logFile.fileID``. If ``cfg.verbose`` is set - % to true then this will tell you where the file is located. + % logFile = saveEventsFile('open', cfg, logFile); + % + % - ``'close'`` closes the file with file ID ``logFile.fileID``. If ``cfg.verbose`` is superior + % to ``1`` then this will tell you where the file is located. + % + % Example:: + % + % logFile = saveEventsFile('close', cfg, logFile) % - % See ``tests/test_saveEventsFile()`` for more details on how to use it. % if nargin < 1 From 1da3c2d35e4f13cf6c7fce434727eae26e816cb9 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 16 Nov 2020 21:54:48 +0100 Subject: [PATCH 70/70] mh fix --- src/saveEventsFile.m | 15 ++++++++------- src/utils/returnNbColumns.m | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/saveEventsFile.m b/src/saveEventsFile.m index a5ad234b..dff76120 100644 --- a/src/saveEventsFile.m +++ b/src/saveEventsFile.m @@ -10,14 +10,14 @@ % % :param action: Defines the operation to do. The different possibilities are % ``'init'``, ``'open'``, ``'open_stim'``, ``'save'`` or ``'close'``. - % For more information on each case see below. + % For more information on each case see below. % :type action: string % :param cfg: Configuration variable. See ``checkCFG()``. % :type cfg: structure % :param logFile: (n x 1) The ``logFile`` variable that contains the n events % you want to save must be a nx1 structure. % :type logFile: structure - % + % % .. todo: % - more details about how to structure the logFile variable % @@ -51,8 +51,8 @@ % % logFile = saveEventsFile('open', cfg, logFile); % - % - ``'save'`` will save the data contained in logfile by using the file ID ``logFile.fileID``; - % logfile must then contain: + % - ``'save'`` will save the data contained in logfile by using the file ID + % ``logFile.fileID``; logfile must then contain: % % - logFile.onset % - logFile.trial_type @@ -62,9 +62,10 @@ % % logFile = saveEventsFile('open', cfg, logFile); % - % - ``'close'`` closes the file with file ID ``logFile.fileID``. If ``cfg.verbose`` is superior - % to ``1`` then this will tell you where the file is located. - % + % - ``'close'`` closes the file with file ID ``logFile.fileID``. + % If ``cfg.verbose`` is superior to ``1`` then this will tell you + % where the file is located. + % % Example:: % % logFile = saveEventsFile('close', cfg, logFile) diff --git a/src/utils/returnNbColumns.m b/src/utils/returnNbColumns.m index efba05e3..48c9da85 100644 --- a/src/utils/returnNbColumns.m +++ b/src/utils/returnNbColumns.m @@ -13,7 +13,7 @@ % :param nameExtraColumn: An entry of ``logFile.extraColumns`` % :type nameExtraColumn: string % - % :returns: + % :returns: % - :nbCol: (integer) The number of columns associated to one entry of the extra % column list. %