Dicom to BIDS - GarzaLab/Documentation GitHub Wiki

How to convert DICOM files to BIDS format

config.json file necessary for the conversion:

{
    "descriptions": [
        {
            "dataType": "anat",
            "suffix": "T1w",
            "criteria": {
                "in": {"SeriesDescription": "sT1W_3D_TFE_32"}
            }
        },
        {
            "dataType": "dwi",
            "suffix": "dwi",
            "criteria": {
                "in": {"SeriesDescription": "DTI_136_2_SHELLS_AP"}
            }
        },       
        {
            "dataType": "func",
            "suffix": "bold",
            "customLabels": "task-rest",
            "criteria": {
                "equal": {"SeriesDescription": "FE_EPI_32chSHC_AP"}
            }
	}
    ]
}

Small script

#!/bin/bash

root=/media/egarza/INP_MRI_Backup/projects/INP/addimex_tms/data/mri
dcmdir=/media/egarza/INP_MRI_Backup/projects/INP/addimex_tms/data/mri/raw_dicom
bidsdir=/media/egarza/INP_MRI_Backup/projects/INP/addimex_tms/data/mri/bids

for i in 001 002 003 004 005 006 007 008 009; do 

subject=$i

echo "Subject ${subject}"

dcm2bids -d ${dcmdir}/${subject}/t0 -p ${subject} -s t0 -c ${root}/code/config.json
dcm2bids -d ${dcmdir}/${subject}/t1 -p ${subject} -s t1 -c ${root}/code/config.json
dcm2bids -d ${dcmdir}/${subject}/t1-4 -p ${subject} -s t14 -c ${root}/code/config.json
dcm2bids -d ${dcmdir}/${subject}/t2 -p ${subject} -s t2 -c ${root}/code/config.json

sleep 10

done