This repo contains 2 scripts to convert NIFTI files (output of dcm2niix) into BIDS compatible folder scaffold.
It's using mainly couple of functions from two repos (see Dependencies) and can create the scaffold of folders for multiple participants/datasets at once.
For more in depth info on BIDS, please do visit the website
Make sure that the following softwares are installed. For instructions see the following links:
Most of the dependencies should be taken care of by the conda environment.yml
.
conda env create -f environment.yml
source activate dcm2bids
In general for more information check the Dcm2Bids tutorial.
GOALS
- DICOM to NIfTI conversion
- extracting the content of the DICOM headers into json files
- Open the shell script
dicom2nii_BIDS_Step1.sh
in your preferred text editor. - Change your desired BIDS output directory.
- Add the different groups of subjects and their names, and DICOM locations
- Run the
dicom2nii_BIDS_Step1.sh
in the terminal
`./sh dicom2nii_BIDS_Step1.sh`
- Go to your BIDS output directory and then to the
tmp_dcm2bids
folder - Open the
json
files of the different conditions and get the_SERIES DISCRIPTION_
, for example:SeriesDescription: "Motion"
--> here the Series description is Motion. - Create a new
json
file calledconfig.json
in the BIDS output directory. Add the conditions indicating the series description. Check theconfig.json
for examples and theconfig_json_template_different_modalities.json
for all possible modalities
-
Open the shell script
dicom2nii_BIDS_Step2.sh
in your preferred text editor. -
Change your desired BIDS output directory, add the different groups of subjects and their names, and DICOM locations. MAKE SURE IT MATCHS Step 1
-
repeat the blocks of code for each condition in your experiment (eg. anatomical, functional exp1, functional exp2, etc.)
-
Make sure that the dicom location in each experimental condition is correct.
-
Run the
dicom2nii_BIDS_Step2.sh
in the terminal:./sh dicom2nii_BIDS_Step2.sh
-
move the produced subject folders in a folder called
raw
to kept as the untouched raw data. -
copy the contents of the raw folder in the
derivatives
folder -
Check the dataset whether its compatible with the BIDS validator
-
fix the errors until it's compatible. :-)