|
Size: 3112
Comment:
|
Size: 5066
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 4: | Line 4: |
| The raw data from the scanner are in `DICOM` format. To start working with the MIR data you first need to convert them to `NIfTI` format and organise them according to the [[https://bids-specification.readthedocs.io/en/stable/|BIDS standard]]. | 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 [[https://bids-specification.readthedocs.io/en/stable/|BIDS standard]]. |
| Line 9: | Line 9: |
| You can see all your participant scan directories, for example, with a command like this (replace 'MR21002' with your project code): | You can see all your participant scan directories with a command like this (replace 'MR21002' with your project code): |
| Line 62: | Line 62: |
| {{{ #!/bin/bash # Your project's root directory PROJECT_PATH='/imaging/correia/da05/wiki/BIDS_conversion/MRI' # Location of the raw data RAW_PATH='/mridata/cbu/CBU210700_MR21002/20211208_143530' # Location of the output data OUTPUT_PATH=$PROJECT_PATH/data/work/dicom_discovery/ # Subject ID subject="01" # Define the path to DICOM files under the project directory DICOM_PATH=$PROJECT_PATH/data/dicom # Define the path where to save the output data OUTPUT_PATH=$PROJECT_PATH/data/work/dicom_discovery/ # Which subject to process sid="01" # Load the apptainer module module load apptainer # Run the container apptainer run --cleanenv -B "${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 # ============================================================ # HeudiConv parameters: # --files: Files or directories containing files to process # --outdir: Output directory # --heuristic: Name of a known heuristic or path to the Python script containing heuristic # --subjects: Subject ID # --converter : dicom to nii converter (dcm2niix or none) # --bids: Flag for output into BIDS structure # --overwrite: Flag to overwrite existing files # ============================================================ # Unload the apptainer module module unload apptainer }}} |
|
| Line 71: | Line 122: |
| Line 72: | Line 124: |
{{{ [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 }}} |
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 'MR21002' with your project code):
ls -d /mridata/cbu/*_MR21002/* /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
...
# Your project's root directory
PROJECT_PATH='/imaging/correia/da05/wiki/BIDS_conversion/MRI'
# Location of the raw data
RAW_PATH='/mridata/cbu/CBU210700_MR21002/20211208_143530'
# Location of the output data
OUTPUT_PATH=$PROJECT_PATH/data/work/dicom_discovery/
# Subject ID
subject="01"
# Define the path to DICOM files under the project directory
DICOM_PATH=$PROJECT_PATH/data/dicom
# Define the path where to save the output data
OUTPUT_PATH=$PROJECT_PATH/data/work/dicom_discovery/
# Which subject to process
sid="01"
# Load the apptainer module
module load apptainer
# Run the container
apptainer run --cleanenv -B "${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
# ============================================================
# HeudiConv parameters:
# --files: Files or directories containing files to process
# --outdir: Output directory
# --heuristic: Name of a known heuristic or path to the Python script containing heuristic
# --subjects: Subject ID
# --converter : dicom to nii converter (dcm2niix or none)
# --bids: Flag for output into BIDS structure
# --overwrite: Flag to overwrite existing files
# ============================================================
# Unload the apptainer module
module unload apptainer
Step 2: Creating heuristics file
...
Example 1
...
Example 2
...
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
