Skip to content
Snippets Groups Projects
Commit 91a619c9 authored by nbeliy's avatar nbeliy
Browse files

improved readme

parent b7e66250
No related branches found
No related tags found
No related merge requests found
# Bidscoin Example 1 # Bidscoin Example 1
## Introduction ## Table of contents
- [Introduction](#intro)
- [Experiment description](#exp)
- [High Cognitive Load (HCL) session](#exp_hcl)
- [Low Cognitive Load (LCL) session](#exp_lcl)
- [Stroop session](#exp_stroop)
- [Working memory task description](#exp_mem)
- [Assessment description](#exp_ass)
- [Dataset structure](#ds)
- [Acquired data files](#ds_data)
- [Additional files](#ds_aux)
- [Bidscoin files](#ds_bids)
- [How to run example](#run)
- [Data preparation](#run_prep)
- [Bidsmap creation](#run_map)
- [Data processing](#run_proc)
- [Data bidsification](#run_bids)
Task results are formatted following [bids](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html),
and stored in `source/<subject>/<session>/nii/FCsepNBack.tsv` file.
The results are formatted following [bids](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#phenotypic-and-assessment-data),
and stored in `source/<subject>/<session>/nii/VAS.tsv`
This dataset is an purely fictional, designed to demonstrate the core ## <a name="intro"></a> Introduction
This dataset is a purely fictional, designed to demonstrate the core
features of `bidscoin` bidsifier tool. features of `bidscoin` bidsifier tool.
The structure of dataset is modelled of real-life dataset, currently unpublished. The structure of dataset is modelled of real-life dataset, currently unpublished.
...@@ -15,108 +40,83 @@ for [SPM12](https://www.fil.ion.ucl.ac.uk/spm/software/spm12/). ...@@ -15,108 +40,83 @@ for [SPM12](https://www.fil.ion.ucl.ac.uk/spm/software/spm12/).
All `.nii` images are replaced by an empty file, and any personal information is removed All `.nii` images are replaced by an empty file, and any personal information is removed
from json files. from json files.
## Experiment description ## <a name="exp_descr"></a>Experiment description
The experiment is designed to study of effect of fatigue on memory performance.
5 participants are separated into pairs with matched sex, age and years of education.
First persons of pairs are used for study (patient group), while paired persons are used for control.
During experiment, each participant is scanned 3 times (sessions), for each of session they are asked to perform either a memory or a stroop task:
- **HLC** with memory task performed after a tiring task (High Cognitive Load)
- In additional to functional and structural, a diffusion scan is present
- **LCL** with memory task performed without tiring task (Low Cognitive Load)
- Session contains structural and functional MRI scans
- **STROOP** with a standard stroop task
- session contains only multi parametric mapping MRI (MPM)
The order in which each scan is performed may vary from participant to participant.
## Original dataset structure
The original data is stored in `source` directory. Data corresponding to each participants
is stored in `source/<participant id>` sub-folder, where `<participant id>` the code of
participant padded with `0`.
Inside participants sub-folders, 3 folders of session data is places. The folder names
don't have a direct correspondence with session, bit represent a code applied by a scanner,
in form `sXYZ`.
The image data is stored directly in session sub-folder `nii`.
For **LCL** and **HCL** sessions, task and assessment are stored in `inp` sub-folder.
Tiring task, and stroop task data are not present in dataset.
### Memory task description
Task consist of a classic n-back working memory update task.
A set of letters is presented to participant. Each letter is presented during `1.7s`,
followed by `0.5s` fixation cross presentation. Participant is asked to remember
if such letter was present in the last, 2 cards ago or 3 cards age (1back, 2back, 3back).
A participant response ("c" for correct, "n" for non-correct) is registered alongside with
expected response.
A fill task consists of 18 blocks of 1,2,3-back tasks, with 16 presented letters in each block.
Task results are formatted following [bids](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html), The experiment is designed to study of effect of fatigue on cognition
and stored in `source/<subject>/<session>/nii/FCsepNBack.tsv` file. (working memory and processing speed) and to identify brain
correlates of cognitive fatigue in patterns with multiple sclerosis
compared to healthy controls.
### Assesment description In total dataset contains 4 participants, two in `patient` group and two
in `control` group with matched demographic information (age, sex and
years of educations).
The demographic data for each matched pair is randomly generated.
Each task is followed by visual analogue assessment (VAS) questioner, where participant is During experiment, each participant is scanned 3 times (sessions),
asked to estimate his psychological state from bad (0) to good (100). during three separate days.
In particular the next estimations are requested: Each session started with a cognitive task outside the scanner:
either a Stroop task or dual-task (Time Load Dual Back) in which
cognitive was manipulated.
- **Motivation** The order in which each scan is performed was counterbalanced from participant
- **Hapiness** to participant.
- **Fatigue**
- **Openness**
- **Stress**
- **Anxiety**
- **Effort**
The results are formatted following [bids](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#phenotypic-and-assessment-data), ### <a name="exp_hcl"></a>High Cognitive Load (HCL) session
and stored in `source/<subject>/<session>/nii/VAS.tsv`
### MRI scanning sessions High Cognitive Load (HCL) session was performed with dual-task performed
in a tiring condition.
Functional acquisition were performed while participant where answering
to a classical working memory task (N-back) with three levels of difficulty,
as well as during resting state.
#### LCL During HCL session following MRI acquisitions has been acquired:
During the LCL session, the next acquisitions are taken:
- localisation (protocol: `localizer`) - localisation (protocol: `localizer`)
- a short fMRI sequence with inverted phase-encoding direction - a short fMRI sequence with inverted phase-encoding direction
(protocol: `cmrr_mbep2d_bold_mb2_invertpe`) (protocol: `cmrr_mbep2d_bold_mb2_invertpe`)
- a fMRI sequence during nBack task execution (protocol: `cmrr_mbep2d_bold_mb2_task_nfat`) - a fMRI sequence during nBack task execution (protocol:
`cmrr_mbep2d_bold_mb2_task_fat`)
- a short fMRI sequence with inverted phase-encoding direction - a short fMRI sequence with inverted phase-encoding direction
(protocol: `cmrr_mbep2d_bold_mb2_invertpe`) (protocol: `cmrr_mbep2d_bold_mb2_invertpe`)
- a fMRI sequence without task execution -- in resting state (protocol: `cmrr_mbep2d_bold_mb2_rest`) - a fMRI sequence without task execution -- in resting state (protocol:
`cmrr_mbep2d_bold_mb2_rest`)
- a magnitude encoded fieldmap sequence (protocol: `gre_field_mapping`) - a magnitude encoded fieldmap sequence (protocol: `gre_field_mapping`)
- a phase-difference fieldmap sequence (protocol: `gre_field_mapping`) - a phase-difference fieldmap sequence (protocol: `gre_field_mapping`)
- a FLAIR sequence (protocol: `t1_mpr_sag_p2_iso`) - a diffusion sequence with inverted gradient direction (protocol:
- a T2 weighted sequence (protocol: `t2_spc_da-fl_sag_p2_iso`) `cmrr_mbep2d_diff_NODDI_invertpe`)
- a diffusion sequence with normal gradient direction (protocol:
`cmrr_mbep2d_diff_NODDI`)
- a diffusion sequence without RF-pulse (protocol:
`cmrr_mbep2d_diff_NODDI_noise`)
#### HCL ### <a name="exp_lcl"></a> Low Cognitive Load (LCL) session
During HCL session, the next acquisitions are taken: Low Cognitive Load (LCL) session was performed in control conditions.
Functional acquisition were performed while participant where answering
to a classical working memory task (N-back) with three levels of difficulty,
as well as during resting state.
During LCL session following MRI acquisitions has been acquired:
- localisation (protocol: `localizer`) - localisation (protocol: `localizer`)
- a short fMRI sequence with inverted phase-encoding direction - a short fMRI sequence with inverted phase-encoding direction
(protocol: `cmrr_mbep2d_bold_mb2_invertpe`) (protocol: `cmrr_mbep2d_bold_mb2_invertpe`)
- a fMRI sequence during nBack task execution (protocol: `cmrr_mbep2d_bold_mb2_task_fat`) - a fMRI sequence during nBack task execution (protocol:
`cmrr_mbep2d_bold_mb2_task_nfat`)
- a short fMRI sequence with inverted phase-encoding direction - a short fMRI sequence with inverted phase-encoding direction
(protocol: `cmrr_mbep2d_bold_mb2_invertpe`) (protocol: `cmrr_mbep2d_bold_mb2_invertpe`)
- a fMRI sequence without task execution -- in resting state (protocol: `cmrr_mbep2d_bold_mb2_rest`) - a fMRI sequence without task execution -- in resting state (protocol:
`cmrr_mbep2d_bold_mb2_rest`)
- a magnitude encoded fieldmap sequence (protocol: `gre_field_mapping`) - a magnitude encoded fieldmap sequence (protocol: `gre_field_mapping`)
- a phase-difference fieldmap sequence (protocol: `gre_field_mapping`) - a phase-difference fieldmap sequence (protocol: `gre_field_mapping`)
- a diffusion sequence with inverted gradient direction (protocol: `cmrr_mbep2d_diff_NODDI_invertpe`) - a T1 FLAIR sequence (protocol: `t1_mpr_sag_p2_iso`)
- a diffusion sequence with normal gradient direction (protocol: `cmrr_mbep2d_diff_NODDI`) - a T2 FLAIR sequence (protocol: `t2_spc_da-fl_sag_p2_iso`)
- a diffusion sequence without RF-pulse (protocol: `cmrr_mbep2d_diff_NODDI_noise`)
#### STROOP ### <a name="exp_stroop"></a>STROOP session
During STROOP session, the next acquisitions are taken: STROOP session was performed with a computerized Stroop task.
The session contains only multi parametric mapping MRI (MPM), consisting in
following acquisitions:
- localisation (protocol: `localizer`) - localisation (protocol: `localizer`)
- head-localised fieldmap for PD weighted sMRI (protocol: `al_mtflash3d_sensArray`) - head-localised fieldmap for PD weighted sMRI (protocol: `al_mtflash3d_sensArray`)
...@@ -135,11 +135,79 @@ During STROOP session, the next acquisitions are taken: ...@@ -135,11 +135,79 @@ During STROOP session, the next acquisitions are taken:
- a magnitude encoded fieldmap sequence (protocol: `gre_field_mapping`) - a magnitude encoded fieldmap sequence (protocol: `gre_field_mapping`)
- a phase-difference fieldmap sequence (protocol: `gre_field_mapping`) - a phase-difference fieldmap sequence (protocol: `gre_field_mapping`)
### Additional files ### <a name="exp_mem"></a>Working Memory task description
All non-data files corresponding to dataset are stored in `resources` subfolder Task consist of a classic n-back working memory update task.
A set of letters is presented to participant.
Each letter is presented during 1.7 seconds, followed by 0.5 seconds
fixation cross presentation.
For each letter, participant was asked to determine if it matches the
one presented N positions before it (*1back*: the previous one,
*2back*: the second last, *3back*: the third last letter presented).
A participant response (*c* for yes, *n* for no) is registered alongside
expected response.
A full task consists of 6 blocks of 16 stimuli for each condition, in
total 18 blocks.
At the end of each block, a fixation cross was presented for 12 seconds.
#### Participants bookkeeping `Appariement.xlsx`
### <a name="exp_ass"></a>Assessment description
Each task is followed the Karolinska sleepiness Scale as well as visual
analogue scale (VAS), where participant is asked to estimate his
psychological state from low (0) to high (100).
In particular the next estimations are requested:
- **Motivation**
- **Hapiness**
- **Fatigue**
- **Openness**
- **Stress**
- **Anxiety**
- **Effort** to perform task
## <a name="ds_descr"></a>Dataset structure
The non-bidsified dataset is stored in `source` directory.
Additional files, needed to bidsify dataset are stored in `resources`
directory
### <a name="ds_data"></a>Acquired data files
Data corresponding to each participants is stored in `source/<participant id>`
sub-folder, where `<participant id>` the code of participant padded with `0`.
Inside participants sub-folders, 3 folders of session data is places.
The folder names don't have a direct correspondence with session,
but represent a code applied by a scanner, in form `sXYZ`.
The MRI image data is stored directly in session sub-folder `nii`.
The image file format simulates the DICOM format converted to Nifti
by [hmri toolbox](https://hmri-group.github.io/hMRI-toolbox/).
The `.nii` data files are empty files, and `.json` files contains DICOM
header bump.
Task and assessment files (if present) are stored in `inp` sub-folders.
They are formatted following BIDS (for
[task](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html),
and for
[assessement](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#phenotypic-and-assessment-data)).
Dual-task, and Stroop task data are not present in dataset.
### <a name="ds_aux"></a>Additional files
A set of files, containing additional information needed for bidsification
is stored in `resources` folder.
It contains a number of
[sidecar json](https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#tabular-files)
files for various bids tables, a table of participants and gradient direction
files needed for diffusion data.
#### <a name="ds_aux_part"></a>Participants bookkeeping `Appariement.xlsx`
`Appariement.xlsx` is an excel table containing the list of participants with key `Appariement.xlsx` is an excel table containing the list of participants with key
demographic data. demographic data.
...@@ -161,7 +229,7 @@ Columns are, in order: ...@@ -161,7 +229,7 @@ Columns are, in order:
- **2**: Name of the second scanned session - **2**: Name of the second scanned session
- **3**: Name of the third scanned session - **3**: Name of the third scanned session
#### Sidecar json files #### <a name=ds_aux_json></a>Sidecar json files
Prepeared json files to use as [descriptions](https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#tabular-files) Prepeared json files to use as [descriptions](https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#tabular-files)
for bidsified `.tsv` files: for bidsified `.tsv` files:
...@@ -174,13 +242,23 @@ demonstration of participant table manipulations by `bidscoin` ...@@ -174,13 +242,23 @@ demonstration of participant table manipulations by `bidscoin`
- `VAS.json` is sidecar json file for VAS - `VAS.json` is sidecar json file for VAS
#### bval and bvec files #### <a name="ds_aux-bval"></a>bval and bvec files
`bval` and `bvec` files used to accompany [diffusion data](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#diffusion-imaging-data) `bval` and `bvec` files used to accompany [diffusion data](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#diffusion-imaging-data)
are placed in `resources/diffusion` folder. They are common to all diffusion images used are placed in `resources/diffusion` folder.
in this dataset. They are common to all diffusion images used in this dataset.
#### <a name="ds_aux_descr"></a>Dataset description files
A minimal example of dataset desctiption
[file](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#dataset-description)
is stored at `resources/dataset_description.json`.
### <a name="ds_bids"></a>Bidscoin files
#### Bidsmap files A set of files needed to run the example are stored in `resources/map` and
`resources/plugins`
#### <a name="ds_bids_map"></a>Bidsmap files
Generated bidsmap files, that can be used to bidsify this dataset are placed in `resources/map` directory: Generated bidsmap files, that can be used to bidsify this dataset are placed in `resources/map` directory:
...@@ -189,7 +267,7 @@ Generated bidsmap files, that can be used to bidsify this dataset are placed in ...@@ -189,7 +267,7 @@ Generated bidsmap files, that can be used to bidsify this dataset are placed in
These files can be used with `-b` option directly, or copied into `bids/code/bidscoin` directory. These files can be used with `-b` option directly, or copied into `bids/code/bidscoin` directory.
#### Plugins #### <a name="ds_bids_plug"></a>Plugins
The plugins are stored in `resources/plugins` directory, and contains commented example of additional data management provided by `bidscoin` infrastructure. The plugins are stored in `resources/plugins` directory, and contains commented example of additional data management provided by `bidscoin` infrastructure.
...@@ -198,28 +276,21 @@ The plugins are stored in `resources/plugins` directory, and contains commented ...@@ -198,28 +276,21 @@ The plugins are stored in `resources/plugins` directory, and contains commented
- `process_plugin.py` contains some example of intermediate data processing, namely merging functional and diffusion 3D images into 4D images, it also shows example of subject demographic data modification - `process_plugin.py` contains some example of intermediate data processing, namely merging functional and diffusion 3D images into 4D images, it also shows example of subject demographic data modification
- `bidsify_plugin.py` contains examples of recording metadata modification in order to facilitate recordings identification - `bidsify_plugin.py` contains examples of recording metadata modification in order to facilitate recordings identification
#### Dataset description files
[The dataset description](https://bids-specification.readthedocs.io/en/stable/03-modality-agnostic-files.html#dataset-description)
consists of two files:
- `dataset_description.json`, a minimal example of json file describing dataset
- `README.md`, this file
## <a name="run"></a>How to run example
## How to run example
Dataset bidsification is composed of two steps: data preparation and data bidsification. Dataset bidsification is composed of two steps: data preparation and data bidsification.
An optional data-processing step can be inserted between preparation and bidsification. An optional data-processing step can be inserted between preparation and bidsification.
A one-time step of bidsmap creation may be necessary. A one-time step of bidsmap creation may be necessary.
### Data preparation ### <a name="run_prep"></a>Data preparation
In this step, a generic user-defined dataset is organized in a standardized way. In this step, a generic user-defined dataset is organized in a standardized way.
To run data preparation, it will be enough to run from `example1` directory To run data preparation, it will be enough to run from `example1` directory
``` ```python
python3 bidscoin.py prepare --part-template resources/participants.json --recfolder nii=MRI --plugin resources/plugins/rename_plugin.py source/ renamed/ python3 bidscoin.py prepare --part-template resources/participants.json --recfolder nii=MRI --plugin resources/plugins/rename_plugin.py source/ renamed/
``` ```
...@@ -227,7 +298,7 @@ The options `--part-template resources/participants.json` will tell bidscoin to ...@@ -227,7 +298,7 @@ The options `--part-template resources/participants.json` will tell bidscoin to
The column `participant_id` will be filled automatically, while other columns will be filled The column `participant_id` will be filled automatically, while other columns will be filled
by default by `n/a`, unless they are set in plugin: by default by `n/a`, unless they are set in plugin:
``` ```python
session.sub_values["sex"] = "M" session.sub_values["sex"] = "M"
``` ```
...@@ -245,7 +316,7 @@ After the execution of preparation, the `rename` folder should contain folders a ...@@ -245,7 +316,7 @@ After the execution of preparation, the `rename` folder should contain folders a
- **code/bidscoin**, with log files of the last execution of preparation step - **code/bidscoin**, with log files of the last execution of preparation step
- **participants.tsv** and **participants.json** files with formatted and filled participant list, all columns for all subjects must be filled except `handiness`, which should contain only `n/a` - **participants.tsv** and **participants.json** files with formatted and filled participant list, all columns for all subjects must be filled except `handiness`, which should contain only `n/a`
- **sub-00X** folders for subjects 1-4 - **sub-00X** folders for subjects 1-4
- **ses-HCL** sub-folders with bidsified session name (either `ses-LCL`, if run with plugin, of `ses-s01905` if run without plugin) - **ses-HCL** sub-folders with bidsified session name (either `ses-HCL`, if run with plugin, of `ses-s01905` if run without plugin)
- **auxiliary** folder with task and VAS tables and json (only if run with plugin) - **auxiliary** folder with task and VAS tables and json (only if run with plugin)
- **MRI** subfolder containing MRI data - **MRI** subfolder containing MRI data
- **00x-<seq_name>** folders with original image data organased by sequences - **00x-<seq_name>** folders with original image data organased by sequences
...@@ -255,25 +326,25 @@ For example the participant table can be corrected if contain wrong or missing v ...@@ -255,25 +326,25 @@ For example the participant table can be corrected if contain wrong or missing v
Running bidscoin with all options can be tedious. To streamline the experience, the majority of options can be saved in configuration file by running Running bidscoin with all options can be tedious. To streamline the experience, the majority of options can be saved in configuration file by running
``` ```python
python3 bidscoin.py -c conf.yamel --conf-save prepare <options> source/ renamed/ python3 bidscoin.py -c conf.yamel --conf-save prepare <options> source/ renamed/
``` ```
This will create a local `conf.yamel` file with passed options. This will create a local `conf.yamel` file with passed options.
To load the configuration: To load the configuration:
``` ```python
python3 bidscoin.py -c conf.yamel prepare source/ renamed/ python3 bidscoin.py -c conf.yamel prepare source/ renamed/
``` ```
Passing other options and using switch `--conf-save` will update configuration file. Passing other options and using switch `--conf-save` will update configuration file.
### Bidsmap creation ### <a name="run_map"></a>Bidsmap creation
Bidsmap is created/tested with `map` command: Bidsmap is created/tested with `map` command:
``` ```python
python3 bidscoin.py map --plugin resources/plugins/bidsify_plugin.py --template bidsmap_template.yaml renamed/ bids/ python3 bidscoin.py map --plugin resources/plugins/bidsify_plugin.py --template bidsmap_template.yaml renamed/ bids/
``` ```
...@@ -281,7 +352,7 @@ The option `--plugin resources/plugins/bidsify_plugin.py` will load corresponden ...@@ -281,7 +352,7 @@ The option `--plugin resources/plugins/bidsify_plugin.py` will load corresponden
identify scans are applied). identify scans are applied).
The option `--template bidsmap_template.yaml` tells which template will be used. The template The option `--template bidsmap_template.yaml` tells which template will be used. The template
reads the common metatdata and tries to guess the modality. This is based on protocol names and can vary from institute to institute. reads the common metadata and tries to guess the modality. This is based on protocol names and can vary from institute to institute.
The `bidsmap_template.yaml` works with example dataset, but for real data a different template may be needed. The `bidsmap_template.yaml` works with example dataset, but for real data a different template may be needed.
The parameters `renamed/` and `bids/` tells where prepared dataset is stored and where the bidsified dataset will be placed. The parameters `renamed/` and `bids/` tells where prepared dataset is stored and where the bidsified dataset will be placed.
...@@ -294,7 +365,7 @@ If placed in `bids/code/bidscoin/` directory, the `map` should not produce any w ...@@ -294,7 +365,7 @@ If placed in `bids/code/bidscoin/` directory, the `map` should not produce any w
### Process step ### <a name="run_proc"></a>Process step
The process step is an optional step, which allow limited data manipulation before bidsification. The process step is an optional step, which allow limited data manipulation before bidsification.
Without plugins, it just verifies that all data is identifiable, and files with same bids name Without plugins, it just verifies that all data is identifiable, and files with same bids name
...@@ -305,7 +376,7 @@ With plugins, it can be used for data manipulation, and metadata completion. ...@@ -305,7 +376,7 @@ With plugins, it can be used for data manipulation, and metadata completion.
For example `resources/plugins/process_plugin.py` fills the `nandiness` column, and merges For example `resources/plugins/process_plugin.py` fills the `nandiness` column, and merges
fMRI and diffusion images in single 4D image. fMRI and diffusion images in single 4D image.
``` ```python
python3 bidscoin.py process --plugin resources/plugins/process_plugin.py renamed/ bids/ python3 bidscoin.py process --plugin resources/plugins/process_plugin.py renamed/ bids/
``` ```
...@@ -317,11 +388,24 @@ This step can be easily replaced by any custom script and/or pipeline. The only ...@@ -317,11 +388,24 @@ This step can be easily replaced by any custom script and/or pipeline. The only
is some `bids` and `bidscoin` specific checks and recording identification. is some `bids` and `bidscoin` specific checks and recording identification.
### Bidsification step ### <a name="run_bids"></a>Bidsification step
The final step is bidsification, it is run with `bidsify` command: The final step is bidsification, it is run with `bidsify` command:
``` ```python
python3 bidscoin.py map --plugin resources/plugins/bidsify_plugin.py renamed/ bids/ python3 bidscoin.py map --plugin resources/plugins/bidsify_plugin.py renamed/ bids/
``` ```
The `--plugin resources/plugins/bidsify_plugin.py` option loads an
appropriate plugin.
The `renamed/` parameter indicates the paths to prepared dataset.
The bidsified dataset should be found in `bids/` folder and should be
fully bids complaint, including the participant and scans json sidecar
files and json files with exported scans meta-data.
`bidscoin` offer the possibility to rename subjects during bidsification.
To do so, it will be enough to change value of `scan.subject` in
`ParticipantEP` function, as demonstrated in
`plugin resources/plugins/bidsify_plugin.py` file on lines 85--89.
...@@ -80,12 +80,14 @@ def SubjectEP(scan): ...@@ -80,12 +80,14 @@ def SubjectEP(scan):
# This will demonstrate the subject renaming # This will demonstrate the subject renaming
# namely increasing the id by 1 # namely increasing the id by 1
"""
sub_id = int(scan.subject[4:]) sub_id = int(scan.subject[4:])
scan.subject = "sub-{:03d}".format(sub_id + 1) scan.subject = "sub-{:03d}".format(sub_id + 1)
# changing also in participant.tsv file # changing also in participant.tsv file
if scan.sub_values["paired"]: if scan.sub_values["paired"]:
pair_id = int(scan.sub_values["paired"][4:]) pair_id = int(scan.sub_values["paired"][4:])
scan.sub_values["paired"] = "sub-{:03d}".format(pair_id + 1) scan.sub_values["paired"] = "sub-{:03d}".format(pair_id + 1)
"""
################################# #################################
# Subject metadata manipulation # # Subject metadata manipulation #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment