Table of contents:
Contents
Converting MRI DICOM data to BIDS format
To start working with your MRI data, you need to convert the raw DICOM format data to NIfTI format and organise them according to the BIDS standard.
Where is your raw data
The raw data that come from the MRI scanner are stored at /mridata/cbu/[your project code]. You can see all your participant scan directories with a command like this (replace 'MR09029' with your project code):
ls -d /mridata/cbu/*_MR09029/* /mridata/cbu/CBU210700_MR21002/20211208_143530/ /mridata/cbu/CBU210711_MR21002/20211213_103712/ /mridata/cbu/CBU220006_MR21002/20220106_115411/ /mridata/cbu/CBU220011_MR21002/20220107_125238/ ...
The first part of the folder name which follows the project code, is the acquisition date. E.g., the data of the first subject in the example above was acquired on 08/12/2021 ('20211208'). Each subject's folder contains data like this:
ls /mridata/cbu/CBU210700_MR21002/20211208_143530 Series001_64_Channel_Localizer/ Series002_CBU_MPRAGE_64chn/ Series003_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series004_bold_mbep2d_3mm_MB2_AP_2/ Series005_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series006_bold_mbep2d_3mm_MB2_AP_2/ Series007_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series008_bold_mbep2d_3mm_MB2_AP_2/ Series009_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series010_bold_mbep2d_3mm_MB2_AP_2/ Series011_bold_mbep2d_3mm_MB2_PA_2_SBRef/ Series012_bold_mbep2d_3mm_MB2_PA_2/ Series013_fieldmap_gre_3mm_mb/ Series014_fieldmap_gre_3mm_mb/
Each Series### folder contains DICOM files of the particular scan. The name of the folder is the same as what a radiographer named the scan in the MRI console. Usually, the name is very indicative of what type of scan it is. Ideally, you'd also know yourself what type of scans were acquired for your project. In the example above, we acquired a T1w anatomical/structural scan (MPRAGE), five multi-band functional scans with single-band reference scans for each of them, and two field maps.
.. need to convert .. Several conversion tools exist (see a full list here). We recommend using HeuDiConv.
DICOM to BIDS using HeuDiConv
HeuDiConv is available on our computing system as an Apptainer image
/imaging/local/software/singularity_images/heudiconv/heudiconv_latest.sif
Converting DICOM data to BIDS using HeuDiConv involves 3 main steps:
- Discovering what type of scans there are in your data
- Creating a heuristics file specifying how to translate the scans into BIDS format
- Converting the data
Step 1: Discovering your scans
...
# ============================================================
# Discovering DICOM files using HeuDiConv
# ============================================================
# Your project's root directory
PROJECT_PATH='/imaging/correia/da05/wiki/BIDS_conversion/MRI'
# Location of the raw data
RAW_PATH='/mridata/cbu/CBU090942_MR09029'
# Location of the output data (it will be created if it doesn't exist)
OUTPUT_PATH=$PROJECT_PATH/data/work/dicom_discovery/
# Subject ID
subject="01"
# Load the apptainer module
module load apptainer
# Run the container
apptainer run --cleanenv \
--bind "${PROJECT_PATH},${RAW_PATH}" \
/imaging/local/software/singularity_images/heudiconv/heudiconv_latest.sif \
--files "${RAW_PATH}"/*/*/*.dcm \
--outdir "$OUTPUT_PATH" \
--heuristic convertall \
--subjects "${subject}" \
--converter none \
--bids \
--overwrite
# Unload the apptainer module
module unload apptainer
Step 2: Creating heuristics file
...
Step 3: Converting the data
...
[da05@login-j05 MRI]$ squeue -u da05
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
3246338_0 Main heudicon da05 R 0:06 1 node-k08
3246338_1 Main heudicon da05 R 0:06 1 node-k08
3246338_2 Main heudicon da05 R 0:06 1 node-k08
3246338_3 Main heudicon da05 R 0:06 1 node-k08
More examples
...
Functional scans with `sbref`
...
ls /mridata/cbu/CBU210700_MR21002/20211208_143530 Series001_64_Channel_Localizer/ Series002_CBU_MPRAGE_64chn/ Series003_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series004_bold_mbep2d_3mm_MB2_AP_2/ Series005_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series006_bold_mbep2d_3mm_MB2_AP_2/ Series007_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series008_bold_mbep2d_3mm_MB2_AP_2/ Series009_bold_mbep2d_3mm_MB2_AP_2_SBRef/ Series010_bold_mbep2d_3mm_MB2_AP_2/ Series011_bold_mbep2d_3mm_MB2_PA_2_SBRef/ Series012_bold_mbep2d_3mm_MB2_PA_2/ Series013_fieldmap_gre_3mm_mb/ Series014_fieldmap_gre_3mm_mb/
In this example, researchers acquired a T1w anatomical/structural scan (MPRAGE), five multi-band functional scans with single-band reference scans for each of them, two field maps, and ...
Multiple sessions per subject
...
