Skip to content

Tutorial - First steps⚓︎

How to use this tutorial⚓︎

This tutorial was developed assuming no prior knowledge of the tool, and little knowledge of the command line (terminal). It aims to be beginner-friendly by giving a lot of details. To get the most out of it, you recommend that you run the commands throughout the tutorial and compare your outputs with the outputs from the example.

Every time you need to run a command, you will see two tabs, one for the command you need to run, and another one with the expected output. While you can copy the command, you recommend that you type each command, which is good for your procedural memory :brain:. The Command and Output tabs will look like these:

1
echo "Hello, World!"
1
2
sam:~/$ echo "Hello, World!"
Hello, World!

Note that in the Output tab, the content before the command prompt ($) will be dependent or your operating system and terminal configuration. What you want to compare is what follows it and the output below the command that was ran. The output you see was taken directly out of your terminal when you tested the tutorial.

Setup⚓︎

dcm2bids must be installed

If you have not installed dcm2bids yet, now is the time to go to the installation page and install dcm2bids with its dependencies. This tutorial does not cover the installation part and assumes you have dcm2bids properly installed.

Activate your dcm2bids environment⚓︎

If you followed the installation procedure, you have to activate your dedicated environment for dcm2bids.

Note that you use dcm2bids as the name of the environment but you should use the name you gave your environment when you created it.

If you used Anaconda Navigator to install dcm2bids and create you environment, make sure to open your environment from Navigator as indicated in Create your environment with the Anaconda Navigator GUI.

1
conda activate dcm2bids
1
2
conda activate dcm2bids
(dcm2bids) sam:~$

Test your environment⚓︎

It is always good to make sure you have access to the software you want to use. You can test it with any command but a safe way is to use the --help command.

1
dcm2bids --help
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(dcm2bids) sam:~$ dcm2bids --help
usage: dcm2bids [-h] -d DICOM_DIR [DICOM_DIR ...] -p PARTICIPANT [-s SESSION]
                -c CONFIG [-o OUTPUT_DIR] [--auto_extract_entities]
                [--bids_validate] [--force_dcm2bids] [--skip_dcm2niix]
                [--clobber] [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-v]

Reorganising NIfTI files from dcm2niix into the Brain Imaging Data Structure

options:
  -h, --help            show this help message and exit
  -d DICOM_DIR [DICOM_DIR ...], --dicom_dir DICOM_DIR [DICOM_DIR ...]
                        DICOM directory(ies) or archive(s) (tar, tar.bz2, tar.gz or zip).
  -p PARTICIPANT, --participant PARTICIPANT
                        Participant ID.
  -s SESSION, --session SESSION
                        Session ID. []
  -c CONFIG, --config CONFIG
                        JSON configuration file (see example/config.json).
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        Output BIDS directory. [/home/runner/work/Dcm2Bids/Dcm2Bids]
  --auto_extract_entities
                        If set, it will automatically try to extract entityinformation [task, dir, echo] based on the suffix and datatype. [False]
  --bids_validate       If set, once your conversion is done it will check if your output folder is BIDS valid. [False]
                        bids-validator needs to be installed check: https://github.com/bids-standard/bids-validator#quickstart
  --force_dcm2bids      Overwrite previous temporary dcm2bids output if it exists.
  --skip_dcm2niix       Skip dcm2niix conversion. Option -d should contains NIFTI and json files.
  --clobber             Overwrite output if it exists.
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set logging level to the console. [INFO]
  -v, --version         Report dcm2bids version and the BIDS version.

Documentation at https://unfmontreal.github.io/Dcm2Bids/
What you can do if you did not get this output

If you got dcm2bids: command not found, it means dcm2bids is not either not installed or not accessible in your current environment. Did you activate your environment?

Visit the installation page for more info.

Create a new directory for this tutorial⚓︎

For the tutorial, we recommend that you create a new directory (folder) instead of jumping straight into a real project directory with real data. In this tutorial, we decided to named our project directory dcm2bids-tutorial.

1
2
mkdir dcm2bids-tutorial
cd dcm2bids-tutorial
1
2
3
4
5
(dcm2bids) sam:~$ mkdir dcm2bids-tutorial
(dcm2bids) sam:~$ cd dcm2bids-tutorial/
(dcm2bids) sam:~/dcm2bids-tutorial$
# no output is printed by mkdir and cd if when the command is successful.
# You can now see that you are inside dcm2bids-tutorial directory.

Scaffolding⚓︎

While scaffolding is a not mandatory step before converting data with the main dcm2bids command, it is highly recommended when you plan to convert data. dcm2bids has a command named dcm2bids_scaffold that will help you structure and organize your data in an efficient way by creating automatically for you a basic directory structure and the core files according to the Brain Imaging Data Structure (BIDS) specification.

Tree structure of the scaffold created by dcm2bids⚓︎

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
scaffold_directory/
├── CHANGES
├── code/
├── dataset_description.json
├── derivatives/
├── participants.json
├── participants.tsv
├── README
├── .bidsignore
└── sourcedata/

3 directories, 5 files

Describing the function of each directory and files is out of the scope of this tutorial but if you want to learn more about BIDS, you encourage you to go through the BIDS Starter Kit.

Run dcm2bids_scaffold⚓︎

To find out how to run dcm2bids_scaffold work, you can use the --help option.

1
dcm2bids_scaffold --help
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
(dcm2bids) sam:~/dcm2bids-tutorial$ dcm2bids_scaffold --help
usage: dcm2bids_scaffold [-h] [-o OUTPUT_DIR] [--force]

    Create basic BIDS files and directories.

    Based on the material provided by
    https://github.com/bids-standard/bids-starter-kit

options:
  -h, --help            show this help message and exit
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        Output BIDS directory. Default: [/home/runner/work/Dcm2Bids/Dcm2Bids]
  --force               Force overwriting of the output files.

Documentation at https://unfmontreal.github.io/Dcm2Bids/

As you can see at lines 11-12, dcm2bids_scaffold has an --output_dir (or -o for short) option with a default option, which means you can either specify where you want the scaffolding to happen to be or it will create the scaffold in the current directory as a default.

Below you can see the difference between specifying -o output_dir and NOT specifying (using the default) the -o option.

Note that you don't have to create the directory where you want to put the scaffold beforehand, the command will create it for you.

1
dcm2bids_scaffold
VS

1
dcm2bids_scaffold -o bids_project

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(dcm2bids) sam:~/dcm2bids-tutorial$ dcm2bids_scaffold
INFO    | --- dcm2bids_scaffold start ---
INFO    | Running the following command: /home/sam/miniconda3/envs/dcm2bids-env/bin/dcm2bids_scaffold
INFO    | OS version: Linux-5.19.0-45-generic-x86_64-with-glibc2.35
INFO    | Python version: 3.10.4 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
INFO    | dcm2bids version: 3.0.0
INFO    | Checking for software update
INFO    | Currently using the latest version of dcm2bids.
INFO    | The files used to create your BIDS directory were taken from https://github.com/bids-standard/bids-starter-kit.

INFO    | Tree representation of /home/sam/dcm2bids-tutorials/
INFO    | /home/sam/dcm2bids-tutorials/
INFO    | ├── code/
INFO    | ├── derivatives/
INFO    | ├── sourcedata/
INFO    | ├── tmp_dcm2bids/
INFO    |    └── log/
INFO    |        └── scaffold_20230703-163905.log
INFO    | ├── .bidsignore
INFO    | ├── CHANGES
INFO    | ├── dataset_description
INFO    | ├── participants.json
INFO    | ├── participants.tsv
INFO    | └── README
INFO    | Log file saved at /home/sam/dcm2bids-tutorials/tmp_dcm2bids/log/scaffold_20230703-163905.log
INFO    | --- dcm2bids_scaffold end ---

(dcm2bids) sam:~/dcm2bids-tutorial$ ls -a
.bidsignore CHANGES      dataset_description.json  participants.json  README
code        derivatives  participants.tsv          sourcedata
VS

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(dcm2bids) sam:~/dcm2bids-tutorial$ dcm2bids_scaffold -o bids_project
INFO    | --- dcm2bids_scaffold start ---
INFO    | Running the following command: /home/sam/miniconda3/envs/dcm2bids-env/bin/dcm2bids_scaffold -o bids_project
INFO    | OS version: Linux-5.19.0-45-generic-x86_64-with-glibc2.35
INFO    | Python version: 3.10.4 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
INFO    | dcm2bids version: 3.0.dev
INFO    | Checking for software update
INFO    | Currently using the latest version of dcm2bids.
INFO    | The files used to create your BIDS directory were taken from https://github.com/bids-standard/bids-starter-kit.

INFO    | Tree representation of bids_project/
INFO    | bids_project/
INFO    | ├── code/
INFO    | ├── derivatives/
INFO    | ├── sourcedata/
INFO    | ├── tmp_dcm2bids/
INFO    |    └── log/
INFO    |        └── scaffold_20230703-205902.log
INFO    | ├── .bidsignore
INFO    | ├── CHANGES
INFO    | ├── dataset_description
INFO    | ├── participants.json
INFO    | ├── participants.tsv
INFO    | └── README
INFO    | Log file saved at bids_project/tmp_dcm2bids/log/scaffold_20230703-205902.log
INFO    | --- dcm2bids_scaffold end ---
(dcm2bids) sam:~/dcm2bids-tutorial$ ls -Fa bids_project
.bidsignore CHANGES      dataset_description.json  participants.json  README
code        derivatives  participants.tsv          sourcedata

For the purpose of the tutorial, you chose to specify the output directory bids_project as if it were the start of a new project. For your real projects, you can choose to create a new directory with the commands or not, it is entirely up to you.

Change directory to go in your scaffold⚓︎

For those who created the scaffold in another directory, you must go inside that directory.

1
cd bids_project
1
2
(dcm2bids) sam:~/dcm2bids-tutorial$ cd bids_project/
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$

Download neuroimaging data⚓︎

For this tutorial, you will use a set of DICOMs made available by [neurolabusc][dcm_qa_nih] on GitHub.

Why use these data in particular?

You use the dcm_qa_nih data because it is the data used by the dcm2niix developers to validate the DICOM to NIfTI conversion process and it has been proven stable since 2017. It also includes data from both GE as well as Siemens MRI scanners so it gives a bit a diversity of data provenance.

To download the data, you can use your terminal or the GitHub interface. You can do it any way you want as long as the directory with the dicoms is in sourcedata directory with the name dcm_qa_nih.

In general, dicoms are considered sourcedata and should be placed in the sourcedata directory. There is no explicit BIDS organization for sourcedata, but having all of a subject's dicoms in a folder with the subject's name is an intuitive organization (with sub-folders for sessions, as necessary).

  1. Download the zipped file from https://github.com/neurolabusc/dcm_qa_nih/archive/refs/heads/master.zip.

    1
    wget -O dcm_qa_nih-master.zip https://github.com/neurolabusc/dcm_qa_nih/archive/refs/heads/master.zip
    

  2. Extract/unzip the zipped file into sourcedata/.

    1
    unzip dcm_qa_nih-master.zip -d sourcedata/
    

  3. Rename the directory dcm_qa_nih.

    1
    mv sourcedata/dcm_qa_nih-master sourcedata/dcm_qa_nih
    

OR

  1. You can clone the repository if you are familiar with Git. If you did the steps above, move on.
    1
    git clone https://github.com/neurolabusc/dcm_qa_nih/ sourcedata/dcm_qa_nih
    

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ wget -O dcm_qa_nih-master.zip https://github.com/neurolabusc/dcm_qa_nih/archive/refs/heads/master.zip
--2022-04-18 22:17:26--  https://github.com/neurolabusc/dcm_qa_nih/archive/refs/heads/master.zip
Resolving github.com (github.com)... 140.82.112.3
Connecting to github.com (github.com)|140.82.112.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/neurolabusc/dcm_qa_nih/zip/refs/heads/master [following]
--2022-04-18 22:17:26--  https://codeload.github.com/neurolabusc/dcm_qa_nih/zip/refs/heads/master
Resolving codeload.github.com (codeload.github.com)... 140.82.113.9
Connecting to codeload.github.com (codeload.github.com)|140.82.113.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10258820 (9.8M) [application/zip]
Saving to: ‘dcm_qa_nih-master.zip’

dcm_qa_nih-master.zip 100%[======================>]   9.78M  3.24MB/s    in 3.0s

2022-04-18 22:17:29 (3.24 MB/s) - ‘dcm_qa_nih-master.zip’ saved [10258820/10258820]

(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ unzip dcm_qa_nih-master.zip -d sourcedata/
Archive:  dcm_qa_nih-master.zip
aa82e560d5471b53f0d0332c4de33d88bf179157
creating: sourcedata/dcm_qa_nih-master/
extracting: sourcedata/dcm_qa_nih-master/.gitignore
creating: sourcedata/dcm_qa_nih-master/In/
creating: sourcedata/dcm_qa_nih-master/In/20180918GE/
inflating: sourcedata/dcm_qa_nih-master/In/20180918GE/README-Study.txt
creating: sourcedata/dcm_qa_nih-master/In/20180918GE/mr_0004/
inflating: sourcedata/dcm_qa_nih-master/In/20180918GE/mr_0004/README-Series.txt
inflating: sourcedata/dcm_qa_nih-master/In/20180918GE/mr_0004/axial_epi_fmri_interleaved_i_to_s-00001.dcm
# [...] output was manually truncated because it was really really long
inflating: sourcedata/dcm_qa_nih-master/Ref/EPI_PE=RL_5.nii
inflating: sourcedata/dcm_qa_nih-master/batch.sh
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ mv sourcedata/dcm_qa_nih-master sourcedata/dcm_qa_nih

  1. Go to: https://github.com/neurolabusc/dcm_qa_nih and click on the green button (Code) to download ZIP.

  1. Download the zipped file.
  2. Extract/unzip the zipped file to the sourcedata directory inside your scaffold and rename the newly created directory dcm_qa_nih.

You should now have a dcm_qa_nih directory nested in sourcedata with a bunch of files and directories:

1
ls sourcedata/dcm_qa_nih
1
2
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ ls sourcedata/dcm_qa_nih/
batch.sh  In  LICENSE  README.md  Ref

Building the configuration file⚓︎

The configuration file is the central element for dcm2bids to organize your data into the Brain Imaging Data Structure standard. dcm2bids uses information from the config file to determine which data in the protocol will be converted, and how they will be renamed based on a set of rules. For this reason, it is important to have a little understanding of the core BIDS principles. The BIDS Starter Kit a good place to start Tutorial on Annotating a BIDS dataset from .

As you will see below, the configuration file must be structured in the Javascript Object Notation (JSON) format.

More info about the configuration file

The How-to guide on creating a config file provides useful information about required and optional fields, and the inner working of a config file.

In short you need a configuration file because, for each acquisition, dcm2niix creates an associated .json file, containing information from the dicom header. These are known as sidecar files. These are the sidecars that dcm2bids uses to filter the groups of acquisitions based on the configuration file.

You have to input the filters yourself, which is way easier to define when you have access to an example of the sidecar files.

You can generate all the sidecar files for an individual participant using the dcm2bids_helper command.

dcm2bids_helper command⚓︎

This command will convert the DICOM files it finds to NIfTI files and save them inside a temporary directory for you to inspect and make some filters for the config file.

As usual the first command will be to request the help info.

1
dcm2bids_helper --help
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ dcm2bids_helper --help
usage: dcm2bids_helper [-h] -d DICOM_DIR [DICOM_DIR ...] [-o OUTPUT_DIR]
                       [-n [NEST]] [--force]
                       [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}]

Converts DICOM files to NIfTI files including their JSON sidecars in a
temporary directory which can be inspected to make a dc2mbids config file.

options:
  -h, --help            show this help message and exit
  -d DICOM_DIR [DICOM_DIR ...], --dicom_dir DICOM_DIR [DICOM_DIR ...]
                        DICOM directory(ies) or archive(s) (tar, tar.bz2, tar.gz or zip).
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        Output directory. (Default: [/home/runner/work/Dcm2Bids/Dcm2Bids/tmp_dcm2bids/helper]
  -n [NEST], --nest [NEST]
                        Nest a directory in <output_dir>. Useful if many helper runs are needed
                        to make a config file due to slight variations in MRI acquisitions.
                        Defaults to DICOM_DIR if no name is provided.
                        (Default: [False])
  --force, --force_dcm2bids
                        Force command to overwrite existing output files.
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set logging level to the console. [INFO]

Documentation at https://unfmontreal.github.io/Dcm2Bids/

To run the commands, you have to specify the -d option, namely the input directory containing the DICOM files. The -o option is optional, defaulting to moving the files inside a new tmp_dcm2bids/helper directory from where you run the command, the current directory.

Use one participant only

For this tutorial, it is easy since there are only few data. However, in general, each folder of dicoms should be specific to a participant and session. This will not only be more computationally efficient, but also avoid any confusion with overlapping file names between sessions if protocols are repeated.

In this tutorial, there are two directories with data, one with data coming from a Siemens scanner (20180918Si), and one with data coming from GE (20180918GE). The tutorial will use the data acquired on both scanners and Siemens scanner located in sourcedata/dcm_qa_nih/In/ and pretend it is one participant only.

1
dcm2bids_helper -d sourcedata/dcm_qa_nih/In/
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
INFO    | --- dcm2bids_helper start ---
INFO    | Running the following command: /home/sam/miniconda3/envs/dcm2bids-env/bin/dcm2bids_helper -d sourcedata/dcm_qa_nih/In/
INFO    | OS version: Linux-5.19.0-45-generic-x86_64-with-glibc2.35
INFO    | Python version: 3.10.4 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
INFO    | dcm2bids version: 3.0.0
INFO    | dcm2niix version: v1.0.20230411
INFO    | Checking for software update
INFO    | Currently using the latest version of dcm2bids.
INFO    | Currently using the latest version of dcm2niix.
INFO    | Running: dcm2niix -b y -ba y -z y -f %3s_%f_%p_%t -o /home/sam/miniconda3/envs/dcm2bids-env/bin/dcm2bids_helper sourcedata/dcm_qa_nih/In/
INFO    | Check log file for dcm2niix output

INFO    | Helper files in: /home/sam/dcm2bids-tutorial/bids_project/tmp_dcm2bids/helper

INFO    | Log file saved at /home/sam/dcm2bids-tutorial/bids_project/tmp_dcm2bids/log/helper_20230703-210946.log
INFO    | --- dcm2bids_helper end ---

Finding what you need in tmp_dcm2bids/helper⚓︎

You should now able to see a list of compressed NIfTI files (nii.gz) with their respective sidecar files (.json). You can tell which file goes with which file based on their identical names, only with a

1
ls tmp_dcm2bids/helper
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ ls tmp_dcm2bids/helper/
'003_In_EPI_PE=AP_20180918121230.json'
'003_In_EPI_PE=AP_20180918121230.nii.gz'
004_In_DCM2NIIX_regression_test_20180918114023.json
004_In_DCM2NIIX_regression_test_20180918114023.nii.gz
'004_In_EPI_PE=PA_20180918121230.json'
'004_In_EPI_PE=PA_20180918121230.nii.gz'
005_In_DCM2NIIX_regression_test_20180918114023.json
005_In_DCM2NIIX_regression_test_20180918114023.nii.gz
'005_In_EPI_PE=RL_20180918121230.json'
'005_In_EPI_PE=RL_20180918121230.nii.gz'
006_In_DCM2NIIX_regression_test_20180918114023.json
006_In_DCM2NIIX_regression_test_20180918114023.nii.gz
'006_In_EPI_PE=LR_20180918121230.json'
'006_In_EPI_PE=LR_20180918121230.nii.gz'
007_In_DCM2NIIX_regression_test_20180918114023.json
007_In_DCM2NIIX_regression_test_20180918114023.nii.gz

As you can see, it is not necessarily easy to tell which scan files (nii.gz) refer to which acquisitions from their names only. That is why you have to go through their sidecar files to find unique identifiers for one acquisition you want to BIDSify.

Go ahead and use any code editor, file viewer or your terminal to inspect the sidecar files.

Here, we compare two files that have similar names to highlight their differences:

1
diff --side-by-side tmp_dcm2bids/helper/"003_In_EPI_PE=AP_20180918121230.json" tmp_dcm2bids/helper/"004_In_EPI_PE=PA_20180918121230.json"
  • Note than in this example, the filename are wrapped with quotes (") as in "filename.ext" because there is an = include in the name. You have to wrap your filenames if they contains special characters, including spaces. To avoid weird problems, we highly recommend to use alphanumeric only names when you can choose the name of your MRI protocols and sequences.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ diff --side-by-side tmp_dcm2bids/helper/003_In_EPI_PE\=AP_20180918121230.json tmp_dcm2bids/helper/004_In_EPI_PE\=PA_20180918121230.json
{                                                           {
    "Modality": "MR",                                           "Modality": "MR",
    "MagneticFieldStrength": 3,                                 "MagneticFieldStrength": 3,
    "ImagingFrequency": 123.204,                                "ImagingFrequency": 123.204,
    "Manufacturer": "Siemens",                                  "Manufacturer": "Siemens",
    "ManufacturersModelName": "Skyra",                          "ManufacturersModelName": "Skyra",
    "InstitutionName": "NIH",                                   "InstitutionName": "NIH",
    "InstitutionalDepartmentName": "FMRIF 3TD",                 "InstitutionalDepartmentName": "FMRIF 3TD",
    "InstitutionAddress": "10 Center Drive Building 10 Ro       "InstitutionAddress": "10 Center Drive Building 10 Ro
    "DeviceSerialNumber": "45160",                              "DeviceSerialNumber": "45160",
    "StationName": "AWP45160",                                  "StationName": "AWP45160",
    "BodyPartExamined": "BRAIN",                                "BodyPartExamined": "BRAIN",
    "PatientPosition": "HFS",                                   "PatientPosition": "HFS",
    "ProcedureStepDescription": "FMRIF^QA",                     "ProcedureStepDescription": "FMRIF^QA",
    "SoftwareVersions": "syngo MR E11",                         "SoftwareVersions": "syngo MR E11",
    "MRAcquisitionType": "2D",                                  "MRAcquisitionType": "2D",
    "SeriesDescription": "EPI PE=AP",                      |    "SeriesDescription": "EPI PE=PA",
    "ProtocolName": "EPI PE=AP",                           |    "ProtocolName": "EPI PE=PA",
    "ScanningSequence": "EP",                                   "ScanningSequence": "EP",
    "SequenceVariant": "SK",                                    "SequenceVariant": "SK",
    "ScanOptions": "FS",                                        "ScanOptions": "FS",
    "SequenceName": "epfid2d1_72",                              "SequenceName": "epfid2d1_72",
    "ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "ECHO       "ImageType": ["ORIGINAL", "PRIMARY", "M", "ND", "ECHO
    "SeriesNumber": 3,                                     |    "SeriesNumber": 4,
    "AcquisitionTime": "12:24:58.102500",                  |    "AcquisitionTime": "12:26:54.517500",
    "AcquisitionNumber": 1,                                     "AcquisitionNumber": 1,
    "ImageComments": "None",                                    "ImageComments": "None",
    "SliceThickness": 3,                                        "SliceThickness": 3,
    "SpacingBetweenSlices": 12,                                 "SpacingBetweenSlices": 12,
    "SAR": 0.00556578,                                          "SAR": 0.00556578,
    "EchoTime": 0.05,                                           "EchoTime": 0.05,
    "RepetitionTime": 2.43537,                                  "RepetitionTime": 2.43537,
    "FlipAngle": 75,                                            "FlipAngle": 75,
    "PartialFourier": 1,                                        "PartialFourier": 1,
    "BaseResolution": 72,                                       "BaseResolution": 72,
    "ShimSetting": [                                            "ShimSetting": [
        -3717,                                                      -3717,
        15233,                                                      15233,
        -9833,                                                      -9833,
        -207,                                                       -207,
        -312,                                                       -312,
        -110,                                                       -110,
        150,                                                        150,
        226    ],                                                   226],
    "TxRefAmp": 316.97,                                         "TxRefAmp": 316.97,
    "PhaseResolution": 1,                                       "PhaseResolution": 1,
    "ReceiveCoilName": "Head_32",                               "ReceiveCoilName": "Head_32",
    "ReceiveCoilActiveElements": "HEA;HEP",                     "ReceiveCoilActiveElements": "HEA;HEP",
    "PulseSequenceDetails": "%CustomerSeq%\\nih_ep2d_bold       "PulseSequenceDetails": "%CustomerSeq%\\nih_ep2d_bold
    "CoilCombinationMethod": "Sum of Squares",                  "CoilCombinationMethod": "Sum of Squares",
    "ConsistencyInfo": "N4_VE11C_LATEST_20160120",              "ConsistencyInfo": "N4_VE11C_LATEST_20160120",
    "MatrixCoilMode": "SENSE",                                  "MatrixCoilMode": "SENSE",
    "PercentPhaseFOV": 100,                                     "PercentPhaseFOV": 100,
    "PercentSampling": 100,                                     "PercentSampling": 100,
    "EchoTrainLength": 72,                                      "EchoTrainLength": 72,
    "PhaseEncodingSteps": 72,                                   "PhaseEncodingSteps": 72,
    "AcquisitionMatrixPE": 72,                                  "AcquisitionMatrixPE": 72,
    "ReconMatrixPE": 72,                                        "ReconMatrixPE": 72,
    "BandwidthPerPixelPhaseEncode": 27.778,                     "BandwidthPerPixelPhaseEncode": 27.778,
    "EffectiveEchoSpacing": 0.000499996,                        "EffectiveEchoSpacing": 0.000499996,
    "DerivedVendorReportedEchoSpacing": 0.000499996,            "DerivedVendorReportedEchoSpacing": 0.000499996,
    "TotalReadoutTime": 0.0354997,                              "TotalReadoutTime": 0.0354997,
    "PixelBandwidth": 2315,                                     "PixelBandwidth": 2315,
    "DwellTime": 3e-06,                                         "DwellTime": 3e-06,
    "PhaseEncodingDirection": "j-",                        |    "PhaseEncodingDirection": "j",
    "SliceTiming": [                                            "SliceTiming": [
        0,                                                          0,
        1.45,                                              |        1.4475,
        0.4825,                                                     0.4825,
        1.9325,                                            |        1.93,
        0.9675    ],                                       |        0.965    ],
    "ImageOrientationPatientDICOM": [                           "ImageOrientationPatientDICOM": [
        1,                                                          1,
        0,                                                          0,
        0,                                                          0,
        0,                                                          0,
        1,                                                          1,
        0    ],                                                     0   ],
    "ImageOrientationText": "Tra",                              "ImageOrientationText": "Tra",
    "InPlanePhaseEncodingDirectionDICOM": "COL",                "InPlanePhaseEncodingDirectionDICOM": "COL",
    "ConversionSoftware": "dcm2niix",                           "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20211006"                "ConversionSoftwareVersion": "v1.0.20211006"
}                                                           }

Again, when you will do it with your DICOMs, you will want to run dcm2bids_helper on a typical session of one of your participants. You will probably get more files than this example

For the purpose of the tutorial, we will be interested in three specific acquisitions, namely:

  1. 004_In_DCM2NIIX_regression_test_20180918114023
  2. 003_In_EPI_PE=AP_20180918121230
  3. 004_In_EPI_PE=PA_20180918121230

The first is an resting-state fMRI acquisition whereas the second and third are fieldmap EPI.

Setting up the configuration file⚓︎

Once you found the data you want to BIDSify, you can start setting up your configuration file. The file name is arbitrary but for the readability purpose, you can name it dcm2bids_config.json like in the tutorial. You can create in the code/ directory. Use any code editor to create the file and add the following content:

1
2
3
{
  "descriptions": []
}
1
nano code/dcm2bids_config.json
1
2
3
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ nano code/dcm2bids_config.json
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$
# No output is shown since nano is an interactive terminal-based editor

Populating the config file⚓︎

To populate the config file, you need to inspect each sidecar files one at a time and make sure there is a unique match for the acquisition you target. For example, with the resting-state fMRI data (004_In_DCM2NIIX_regression_test_20180918114023). You can inspect its sidecar file and look for the "SeriesDescription" field for example. It is often a good unique identifier.

1
cat tmp_dcm2bids/helper/004_In_DCM2NIIX_regression_test_20180918114023.json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ cat tmp_dcm2bids/helper/004_In_DCM2NIIX_regression_test_20180918114023.json
{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 127.697,
    "Manufacturer": "GE",
    "PulseSequenceName": "epiRT",
    "InternalPulseSequenceName": "EPI",
    "ManufacturersModelName": "DISCOVERY MR750",
    "InstitutionName": "NIH FMRIF",
    "DeviceSerialNumber": "000301496MR3T6MR",
    "StationName": "fmrif3tb",
    "BodyPartExamined": "BRAIN",
    "PatientPosition": "HFS",
    "SoftwareVersions": "27\\LX\\MR Software release:DV26.0_R01_1725.a",
    "MRAcquisitionType": "2D",
    "SeriesDescription": "Axial EPI-FMRI (Interleaved I to S)",
    "ProtocolName": "DCM2NIIX regression test",
    "ScanningSequence": "EP\\GR",
    "SequenceVariant": "SS",
    "ScanOptions": "EPI_GEMS\\PFF",
    "ImageType": ["ORIGINAL", "PRIMARY", "EPI", "NONE"],
    "SeriesNumber": 4,
    "AcquisitionTime": "11:48:15.000000",
    "AcquisitionNumber": 1,
    "SliceThickness": 3,
    "SpacingBetweenSlices": 5,
    "SAR": 0.0166392,
    "EchoTime": 0.03,
    "RepetitionTime": 5,
    "FlipAngle": 60,
    "PhaseEncodingPolarityGE": "Unflipped",
    "CoilString": "32Ch Head",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "AcquisitionMatrixPE": 64,
    "ReconMatrixPE": 64,
    "EffectiveEchoSpacing": 0.000388,
    "TotalReadoutTime": 0.024444,
    "PixelBandwidth": 7812.5,
    "PhaseEncodingDirection": "j-",
    "SliceTiming": [
        0,
        2.66667,
        0.333333,
        3,
        0.666667,
        3.33333,
        1,
        3.66667,
        1.33333,
        4,
        1.66667,
        4.33333,
        2,
        4.66667,
        2.33333 ],
    "ImageOrientationPatientDICOM": [
        1,
        -0,
        0,
        -0,
        1,
        0   ],
    "InPlanePhaseEncodingDirectionDICOM": "COL",
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20211006"
}

To match the "SeriesDescription" field, a pattern like Axial EPI-FMRI* could match it. However, we need to make sure we will match only one acquisition. You can test it by looking manually at inside all sidecar files but it is now recommend. It is rather trivial for the computer to look in all the .json files for you with the grep command:

1
grep "Axial EPI-FMRI*" tmp_dcm2bids/helper/*.json
1
2
3
4
5
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "Axial EPI-FMRI*" tmp_dcm2bids/helper/*.json
tmp_dcm2bids/helper/004_In_DCM2NIIX_regression_test_20180918114023.json:    "SeriesDescription": "Axial EPI-FMRI (Interleaved I to S)",
tmp_dcm2bids/helper/005_In_DCM2NIIX_regression_test_20180918114023.json:    "SeriesDescription": "Axial EPI-FMRI (Sequential I to S)",
tmp_dcm2bids/helper/006_In_DCM2NIIX_regression_test_20180918114023.json:    "SeriesDescription": "Axial EPI-FMRI (Interleaved S to I)",
tmp_dcm2bids/helper/007_In_DCM2NIIX_regression_test_20180918114023.json:    "SeriesDescription": "Axial EPI-FMRI (Sequential S to I)",

Unfortunately, this criteria is not enough and it could match other 4 files.

In this situation, you can add another criteria to match the specific acquisition. Which one do you think would be more appropriate? Go back to the content of the fMRI sidecar file and find a another criteria that, in combination with the "SeriesDescription", will uniquely match the fMRI data.

Right, maybe instead of trying to look for another field, you could simply extend the criteria for the "SeriesDescription". How many files does it match if you extend it to the full value (Axial EPI-FMRI (Interleaved I to S)?

1
grep "Axial EPI-FMRI (Interleaved I to S)*" tmp_dcm2bids/helper/*.json
1
2
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "Axial EPI-FMRI (Interleaved I to S)*" tmp_dcm2bids/helper/*.json
tmp_dcm2bids/helper/004_In_DCM2NIIX_regression_test_20180918114023.json:    "SeriesDescription": "Axial EPI-FMRI (Interleaved I to S)",

🎉, there is only one match! It means you can now update your configuration file by adding a couple of necessary fields for which you can find a description in How to create a config file. Since it is a resting-stage fMRI acquisition, you want to specify it like this then make dcm2bids change your task name:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "descriptions": [
    {
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": "task-rest",
      "criteria": {
        "SeriesDescription": "Axial EPI-FMRI (Interleaved I to S)*"
      "sidecar_changes": {
        "TaskName": "rest"
      }
      }
    }
  ]
}
1
nano code/dcm2bids_config.json
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ nano code/dcm2bids_config.json
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ cat code/dcm2bids_config.json
{
  "descriptions": [
    {
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": "task-rest",
      "criteria": {
        "SeriesDescription": "*Axial EPI-FMRI (Interleaved I to S)*"
      },
      "sidecar_changes": {
        "TaskName": "rest"
      }
    }
  ]
}

Avoid using filename as criteria

While you can take file names to match as criteria, we do not recommend this as different versions of dcm2niix can lead to different file names (Refer to the release notes of version 17-March-2021 (v1.0.20210317) of dcmniix to now more, especially the GE file naming behavior changes (%p protocol name and %d description) section.

Use SeriesNumber with caution

It is not uncommon for runs to be repeated due to motion or the participant leaving the scanner to take a break (leading to an extra Scout acquisition). This will throw off the scan order for all subsequent acquisitions, potentially invalidating several matching criteria.

Moving to the fieldmaps, if you inspect their sidecar files (the same ones that were compared in the dcm2bids_helper section), you can see a pattern of "EPI PE=AP", "EPI PE=PA", "EPI PE=RL" and "EPI PE=LR" in the SeriesDescription once again.

You can test it, of course!

1
2
3
4
grep "EPI PE=AP" tmp_dcm2bids/helper/*.json
grep "EPI PE=PA" tmp_dcm2bids/helper/*.json
grep "EPI PE=RL" tmp_dcm2bids/helper/*.json
grep "EPI PE=LR" tmp_dcm2bids/helper/*.json

There are two matches per pattern but they come from the same file, so it is okay.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "EPI PE=AP" tmp_dcm2bids/helper/*.json
tmp_dcm2bids/helper/003_In_EPI_PE=AP_20180918121230.json:   "SeriesDescription": "EPI PE=AP",
tmp_dcm2bids/helper/003_In_EPI_PE=AP_20180918121230.json:   "ProtocolName": "EPI PE=AP",
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "EPI PE=PA" tmp_dcm2bids/helper/*.json
tmp_dcm2bids/helper/004_In_EPI_PE=PA_20180918121230.json:   "SeriesDescription": "EPI PE=PA",
tmp_dcm2bids/helper/004_In_EPI_PE=PA_20180918121230.json:   "ProtocolName": "EPI PE=PA",
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "EPI PE=RL" tmp_dcm2bids/helper/*.json
tmp_dcm2bids/helper/005_In_EPI_PE=RL_20180918121230.json:   "SeriesDescription": "EPI PE=RL",
tmp_dcm2bids/helper/005_In_EPI_PE=RL_20180918121230.json:   "ProtocolName": "EPI PE=RL",
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "EPI PE=LR" tmp_dcm2bids/helper/*.json
tmp_dcm2bids/helper/006_In_EPI_PE=LR_20180918121230.json:   "SeriesDescription": "EPI PE=LR",
tmp_dcm2bids/helper/006_In_EPI_PE=LR_20180918121230.json:   "ProtocolName": "EPI PE=LR",

Now, Dcm2bids new feature --auto_extract_entities will help you with this specific situations. Following BIDS naming scheme fieldmaps need to be named with a dir entity. If you take a look each json file you'll find in their respective sidecar PhaseEncodedDirection a different direction

1
grep "PhaseEncodedDirection\"" tmp_dcm2bids/helper/*_In_EPI_PE=*.json

There are four matches per pattern but they come from the same file, so it is okay.

1
2
3
4
5
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ grep "PhaseEncodedDirection\"" tmp_dcm2bids/helper/*_In_EPI_PE=*.json
tmp_dcm2bids/helper/003_In_EPI_PE=AP_20180918121230.json:   "PhaseEncodingDirection": "j-",
tmp_dcm2bids/helper/004_In_EPI_PE=PA_20180918121230.json:   "PhaseEncodingDirection": "j",
tmp_dcm2bids/helper/005_In_EPI_PE=RL_20180918121230.json:   "PhaseEncodingDirection": "i",
tmp_dcm2bids/helper/006_In_EPI_PE=LR_20180918121230.json:   "PhaseEncodingDirection": "i-",

This entity will be different for each fieldmap so there's no need to be more specific.

Please check the different use cases for this feature

Once you are sure of you matching criteria, you can update your configuration file with the appropriate info.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
  "descriptions": [
    {
      "id": "id_task-rest",
      "datatype": "func",
      "suffix": "bold",
      "custom_entities": "task-rest",
      "criteria": {
        "SeriesDescription": "Axial EPI-FMRI (Interleaved I to S)*"
      },
      "sidecar_changes": {
        "TaskName": "rest"
      }
    },
    {
      "datatype": "fmap",
      "suffix": "epi",
      "criteria": {
        "SeriesDescription": "EPI PE=*"
      },
      "sidecar_changes": {
        "intendedFor": ["id_task-rest"]
      }
    }
  ]
}

For fieldmaps, you need to add an "intendedFor" as well as id field to show that these fieldmaps should be used with your fMRI acquisition. Have a look at the explanation of intendedFor in the documentation or in the BIDS specification.

Use an online JSON validator

Editing JSON file is prone to errors such as misplacing or forgetting a comma or not having matched opening and closing [] or {}. JSON linters are useful to validate that we did enter all information successfully. You can find these tools online, for example https://jsonlint.com.

Now that you have a configuration file ready, it is time to finally run dcm2bids.

Running dcm2bids⚓︎

By now, you should be used to getting the --help information before running a command.

1
dcm2bids --help
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(dcm2bids) sam:~$ dcm2bids --help
usage: dcm2bids [-h] -d DICOM_DIR [DICOM_DIR ...] -p PARTICIPANT [-s SESSION]
                -c CONFIG [-o OUTPUT_DIR] [--auto_extract_entities]
                [--bids_validate] [--force_dcm2bids] [--skip_dcm2niix]
                [--clobber] [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-v]

Reorganising NIfTI files from dcm2niix into the Brain Imaging Data Structure

options:
  -h, --help            show this help message and exit
  -d DICOM_DIR [DICOM_DIR ...], --dicom_dir DICOM_DIR [DICOM_DIR ...]
                        DICOM directory(ies) or archive(s) (tar, tar.bz2, tar.gz or zip).
  -p PARTICIPANT, --participant PARTICIPANT
                        Participant ID.
  -s SESSION, --session SESSION
                        Session ID. []
  -c CONFIG, --config CONFIG
                        JSON configuration file (see example/config.json).
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        Output BIDS directory. [/home/runner/work/Dcm2Bids/Dcm2Bids]
  --auto_extract_entities
                        If set, it will automatically try to extract entityinformation [task, dir, echo] based on the suffix and datatype. [False]
  --bids_validate       If set, once your conversion is done it will check if your output folder is BIDS valid. [False]
                        bids-validator needs to be installed check: https://github.com/bids-standard/bids-validator#quickstart
  --force_dcm2bids      Overwrite previous temporary dcm2bids output if it exists.
  --skip_dcm2niix       Skip dcm2niix conversion. Option -d should contains NIFTI and json files.
  --clobber             Overwrite output if it exists.
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set logging level to the console. [INFO]
  -v, --version         Report dcm2bids version and the BIDS version.

Documentation at https://unfmontreal.github.io/Dcm2Bids/

As you can see, to run the dcm2bids command, you have to specify at least 3 required options with their argument.

1
dcm2bids -d path/to/source/data -p subID -c path/to/config/file.json --auto_extract_entities

dcm2bids will create a directory which will be named after the argument specified for -p, and put the BIDSified data in it.

For the tutorial, pretend that the subID is simply ID01.

Note that if you don't specify the -o option, your current directory will be populated with the sub-<label> directories.

Using the option --auto_extract_entities will allow dcm2bids to look for some specific entities without having to put them in the config file.

That being said, you can run the command:

1
dcm2bids -d sourcedata/dcm_qa_nih/In/ -p ID01 -c code/dcm2bids_config.json --auto_extract_entities
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ dcm2bids -d sourcedata/dcm_qa_nih/In/ -p ID01 -c code/dcm2bids_config.json
INFO    | --- dcm2bids start ---
INFO    | Running the following command: /home/sam/miniconda3/envs/dcm2bids/bin/dcm2bids -d sourcedata/dcm_qa_nih/In/ -p ID01 -c code/dcm2bids_config.json --auto_extract_entities
INFO    | OS version: Linux-5.19.0-45-generic-x86_64-with-glibc2.35
INFO    | Python version: 3.10.4 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
INFO    | dcm2bids version: 3.0.0
INFO    | dcm2niix version: v1.0.20230411
INFO    | Checking for software update
INFO    | Currently using the latest version of dcm2bids.
INFO    | Currently using the latest version of dcm2niix.
INFO    | participant: sub-ID01
INFO    | config: /home/sam/dcm2bids-tutorial/bids_project/code/dcm2bids_config.json
INFO    | BIDS directory: /home/sam/p/unf/t
INFO    | Auto extract entities: True
INFO    | Validate BIDS: False

INFO    | Running: dcm2niix -b y -ba y -z y -f %3s_%f_%p_%t -o /home/sam/dcm2bids-tutorial/bids_project/tmp_dcm2bids/sub-ID01 sourcedata/dcm_qa_nih/In
INFO    | Check log file for dcm2niix output

INFO    | SIDECAR PAIRING:

INFO    | sub-ID01_dir-AP_epi  <-  003_In_EPI_PE=AP_20180918121230
WARNING | {'task'} have not been found for datatype 'func' and suffix 'bold'.
INFO    | sub-ID01_task-rest_bold  <-  004_In_DCM2NIIX_regression_test_20180918114023
INFO    | sub-ID01_dir-PA_epi  <-  004_In_EPI_PE=PA_20180918121230
INFO    | No Pairing  <-  005_In_DCM2NIIX_regression_test_20180918114023
INFO    | No Pairing  <-  005_In_EPI_PE=RL_20180918121230
INFO    | No Pairing  <-  006_In_DCM2NIIX_regression_test_20180918114023
INFO    | No Pairing  <-  006_In_EPI_PE=LR_20180918121230
INFO    | No Pairing  <-  007_In_DCM2NIIX_regression_test_20180918114023
INFO    | MOVING ACQUISITIONS INTO BIDS FOLDER

INFO    | Logs saved in /home/sam/dcm2bids-tutorials/tmp_dcm2bids/log/sub-ID01_20230703-185410.log
INFO    | --- dcm2bids end ---

A bunch of information is printed to the terminal as well as to a log file located at tmp_dcm2bids/log/sub-<label>_<datetime>.log. It is useful to keep these log files in case you notice an error after a while and need to find which participants are affected.

You can see that dcm2bids was able to pair and match the files you specified at lines 14-16 in the previous output tab.

You can now have a look in the newly created directory sub-ID01 and discover your converted data!

1
tree sub-ID01/
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ tree sub-ID01/
sub-ID01/
├── fmap
│   ├── sub-ID01_dir-AP_epi.json
│   ├── sub-ID01_dir-AP_epi.nii.gz
│   ├── sub-ID01_dir-LR_epi.json
│   ├── sub-ID01_dir-LR_epi.nii.gz
│   ├── sub-ID01_dir-PA_epi.json
│   ├── sub-ID01_dir-PA_epi.nii.gz
│   ├── sub-ID01_dir-RL_epi.json
│   └── sub-ID01_dir-RL_epi.nii.gz
└── func
    ├── sub-ID01_task-rest_bold.json
    └── sub-ID01_task-rest_bold.nii.gz

2 directories, 6 files

Files that were not paired stay in a temporary directory tmp_dcm2bids/sub-<label>. In your case : tmp_dcm2bids/sub-ID01.

1
tree tmp_dcm2bids/
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(dcm2bids) sam:~/dcm2bids-tutorial/bids_project$ tree tmp_dcm2bids/
tmp_dcm2bids/
├── helper
│   ├── 003_In_EPI_PE=AP_20180918121230.json
│   ├── 003_In_EPI_PE=AP_20180918121230.nii.gz
│   ├── 004_In_DCM2NIIX_regression_test_20180918114023.json
│   ├── 004_In_DCM2NIIX_regression_test_20180918114023.nii.gz
│   ├── 004_In_EPI_PE=PA_20180918121230.json
│   ├── 004_In_EPI_PE=PA_20180918121230.nii.gz
│   ├── 005_In_DCM2NIIX_regression_test_20180918114023.json
│   ├── 005_In_DCM2NIIX_regression_test_20180918114023.nii.gz
│   ├── 005_In_EPI_PE=RL_20180918121230.json
│   ├── 005_In_EPI_PE=RL_20180918121230.nii.gz
│   ├── 006_In_DCM2NIIX_regression_test_20180918114023.json
│   ├── 006_In_DCM2NIIX_regression_test_20180918114023.nii.gz
│   ├── 006_In_EPI_PE=LR_20180918121230.json
│   ├── 006_In_EPI_PE=LR_20180918121230.nii.gz
│   ├── 007_In_DCM2NIIX_regression_test_20180918114023.json
│   └── 007_In_DCM2NIIX_regression_test_20180918114023.nii.gz
├── log
│   └── sub-ID01_2022-04-19T111537.459742.log
└── sub-ID01
    ├── 005_In_DCM2NIIX_regression_test_20180918114023.json
    ├── 005_In_DCM2NIIX_regression_test_20180918114023.nii.gz
    ├── 006_In_DCM2NIIX_regression_test_20180918114023.json
    ├── 006_In_DCM2NIIX_regression_test_20180918114023.nii.gz
    ├── 007_In_DCM2NIIX_regression_test_20180918114023.json
    └── 007_In_DCM2NIIX_regression_test_20180918114023.nii.gz

3 directories, 27 files

That is it, you are done with the tutorial! You can now browse through the documentation to find information about the different commands.

Go to the How-to guides section 📚

Acknowledgment

Thanks to @Remi-gau for letting us know that our tutorial needed an update, and for providing us with a clean and working configuration file through an issue #142 on GitHub 🙏.


Last update: 2023-09-13
Created: 2022-04-19