Data2BIDS

Data2bids is a script based on the SIMEXP lab script to convert nifti MRI and EEG files into BIDS format. This script has been modified to also parse README data as well as include conversion of DICOM files to nifti. The script utilizes Chris Rorden’s Dcm2niix program for actual conversion.

This script takes one of two formats for conversion. The first is a se ries of DICOM files in sequence with an optional “medata” folder whi ch contains any number of single or multi-echo uncompressed nifti file s (.nii). Note that nifti files in this case must also have a correspo nding DICOM scan run, but not necessarily scan echo (for example, one DICOM scan for run 5 but three nifti files which are echoes 1, 2, and 3 of run 5). The other format is a series of nifti files and a README. txt file formatted the same way as it is in the example. Both formats are shown in the examples folder.

Both formats use a .json config file that maps either DICOM tags or te xt within the nifti file name to BIDS metadata. The syntax and formatt ing of this .json file can be found here https://github.com/SIMEXP/Data2Bids#heuristic.

The only thing this script does not account for is event files. If you have the 1D files that’s taken care of, but chances are you have some other format. If this is the case, I recommend https://bids-specification.readthedocs.io/en/stable/04-modality-specif ic-files/05-task-events.html so that you can make BIDS compliant event files.

Data2bids documentation at https://github.com/SIMEXP/Data2Bids Dcm2niix documentation at https://github.com/rordenlab/dcm2niix

usage: data2bids.py [-h] [-i INPUT_DIR] [-c CONFIG] [-o OUTPUT_DIR]
                    [-d DICOM_PATH] [-m [MULTI_ECHO ...]] [-ow]
                    [-ch [CHANNELS ...]] [-s STIM_DIR] [-v]

Named Arguments

-i, --input_dir

Input data directory(ies), must include a readme.txt file formatted lik e example under examples folder. Mutually exclusive with DICOM director y option. Default: current directory

-c, --config

JSON configuration file (see https://github.com/SIMEXP/Data2Bids/blob/master/example/config.json)

-o, --output_dir

Output BIDS directory, Default: Inside current directory

-d, --DICOM_path

Optional DICOM directory, Mutually exclusive with input directory option

-m, --multi_echo

indicator of multi-echo dataset. Only necessary if NOT converting DICOM s. For example, if runs 3-6 were all multi-echo then the flag should look like: -m 3 4 5 6 . Additionally, the -m flag may be called by itself if you wish to let data2bids auto-detect multi echo data, but it will not be able to tell you if there is a mistake.

-ow, --overwrite

overwrite preexisting BIDS file structures in destination location

Default: False

-ch, --channels

Indicator of channels to keep from edf files.

-s, --stim_dir

directory containing stimuli files

-v, --verbose

verbosity

Default: False

Made by Aaron Earle-Richardson (ae166@duke.edu)

Each task has its own specific needs, and therefore has extending guides. Each task has it’s own branch on github.