Converting DICOMs to BIDS (-ish)


Create a conda virtual environment:

conda create --name bidscoin python=3.7

Enter the virtual environment:

conda activate bidscoin

Install BIDScoin:

pip install bidscoin

For details, visit the BIDScoin Github repo:

TL;DR version below.

Four commands to know:

  • – Sorts and/or renames DICOMs in my_dicomsfolder into sub-directories my_dicomsfolder/SeriesNumber-SeriesDescription
  • – Creates a bidsmap.yaml YAML file in my_bidsfolder/code/bidscoin
  • – Launches a GUI for editing the bidsmap.yaml
  • – Converts mapped data into BIDS


DICOMs from the study are in folders, e.g. sub-01 , …. If not, rename them as such.

These sub-0* folders are in the parent (study-level) directory my_dicomsfolder

Activate conda environment:

conda activate bidscoin

Sort DICOMs: my_dicomsfolder/sub-01

Sub-directories with SeriesNumber-SeriesDescription created: my_dicomsfolder/sub-01/001- , my_dicomsfolder/sub-01/002- , etc..

Run ./my_dicomsfolder ./my_bidsfolder

This launches the GUI that shows recognised (green) and unrecognised (red) data-modalities. A bidsmap.yaml file is created in my_bidsfolder/code/bidscoin/.

If you use (thus far) BIDS incompatible sequences in your study such as MP2RAGE , ASL , VASO , even 3D-EPI:

  • Manually assign the modality category in the GUI as, anat, func, fmap, etc..
  • If you closed the GUI, open it again: ./my_bidsfolder
Click EDIT to manually assign the modality category (adapted from bidseditor_main.png)
Select the required modality classification from the dropdown menu and click OK (adapted from bidseditor_edit.png)
  • The other fields can be modified in the bidsmap.yaml file using VScode.
  • The naming scheme can be modified for each sequence a.k.a. provenance: by adding the labels under bids: such as acq: , mod: etc. or removing labels and replacing them with empty quotes (” “).
  • Tip from Alex: Make sure to select the suffix that best describes the data from the dropdown menu or in the YAML file. Important if one plans to use fMRIPrep down the line.

Exact specs for (thus far) BIDS incompatible sequences are still unclear, however, some suggestions are available. For instance: MP2RAGE , ASL , SWI , pre-processing derivatives (anatomy) , pre-processing derivatives (functional) , pre-processing derivatives (resting-state) etc..

Make the following changes to the my_bidsfolder/code/bidscoin/bidsmap.yaml file:

This needs to be changed to the output of whereis dcm2niix
If you followed:
Change ”-b’ to ”-ba’ for BIDS anonymisation.

Once the bidsmap.yaml is edited appropriately, execute ./my_bidsfolder to ensure its read correctly.

Finally, run: ./my_dicomsfolder/ ./my_bidsfolder/

After successful completion, validate using bids-validator online or locally.

Tip from Alex: BIDS validators will complain if you acquired (currently) unsupported data modalities.

Reference: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with
Get started
%d bloggers like this: