Converting DICOMs to BIDS (-ish)

Prerequisites:

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: https://github.com/Donders-Institute/bidscoin

TL;DR version below.


Four commands to know:

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

Steps

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:

dicomsort.py my_dicomsfolder/sub-01

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

Run bidsmapper.py:

bidsmapper.py ./my_dicomsfolder ./my_bidsfolder

This launches the bidseditor.py 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 bidseditor.py GUI as, anat, func, fmap, etc..
  • If you closed the GUI, open it again: bidseditor.py ./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: https://5k45h.wordpress.com/2020/03/17/installing-dcm2niix-on-ubuntu/
Change ”-b’ to ”-ba’ for BIDS anonymisation.

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

Finally, run:

bidscoiner.py ./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: https://github.com/Donders-Institute/bidscoin , https://github.com/bids-standard/bids-validator , https://github.com/rordenlab/dcm2niix/releases , https://bids.neuroimaging.io/get_involved.html

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 at WordPress.com
Get started
%d bloggers like this: