-
Notifications
You must be signed in to change notification settings - Fork 0
BIDS
BIDS is the Brain Imaging Data Structure. It is a way of organising your directory/data structure according to set principles.
Why does BIDS matter? If your data are not in BIDS format
- It will likely be incredibly annoying for other people to try to understand your data structure if you have organised things according to your own arbitrary principles
- You may not be able to share your data on certain repositories because they require BIDS formatting
- Some containers such as fMRIPrep and QSIPrep require your data to be BIDS formatted - if the data is not BIDS organised, then fMRIPrep and QSIPrep may behave unpredictably, or they may fail to run in the first place
An example:
- Data is organised into anat, func, dwi data for every participant
- All participants folders situated in the project folder must be named
sub-{subject_number}
- All participants files situated in the participant folder must be prefaced with
sub-{subject_number}
- All T1 data needs to end with the suffix
_T1w
and be situated in the anat folder, all bold data needs to end with the suffix_bold
- If your data is organised into sessions, the data must be nested within the appropriate session folder (ie. as in example above). All files within the session folder must also specify that they belong to that session in their name (e.g. all files in the ses-preop/func folder have ses-preop in their names). If the data is not organised into sessions, do not organise a session folder or include session information in the file naming.
So how do we BIDS-ify your data? Let’s start from the beginning - converting your DICOM files.
Let’s say you collect some T1 image for subject 10 - you will receive a series of DICOM files that represents that person’s T1. Each of the individual DICOM files contain pockets of information and metadata about that person’s T1. These DICOM files can be “flattened” into one file called a Nifti file using conversion software (which has a *.nii extension - BIDS also allows the *.nii to be zipped, so, ending in *.nii.gz).
Software available for DICOM to Nifti conversion (where you can label the output according to BIDS principles):
- SPM
- Dcm2niix (*_Note _- as of 08/2023, all multiecho data will be named with a _e{echo_number} suffix, which you will need to change. You will also need to change the json sidecar for the fieldmaps you convert to include an IntendedFor field - I discuss this below)
- Dcm2bids
When you run the DICOM to Nifti conversion, these kinds of software will also create a json file from the DICOM metadata. This includes information like slice timing, echo number, and direction of field for data collection.
A note on multiecho data: DCM2niix renames things in an annoying way - i.e. sub-7_task-res_bold_e1 should be named sub-7_dir-RL_task-rest_echo-1_bold
Use this kind of script to change this:
for echo in 1 2 3 4; do
cd "/path/to/sub-${s}/func";
mv sub-${s}_task-rest_dir-RL_bold_e${echo}.nii.gz sub-${s}_task-rest_dir-RL_echo-${echo}_bold.nii.gz;
done
A note on fmap data: DCM2niix will not add the all important IntendedFor field in the json sidecars for your fieldmaps. These need to point to the relevant file the fieldmap is intended to correct. Lets look at correcting an fmap file called sub-10_acq-bold_dir-LR_epi
cd "/path/to/sub-${s}/fmap";
for f in *acq-bold*.json; do
if ! grep -q "IntendedFor" "$f"; then
sed -i '1s#{#{\n "IntendedFor": ["func/sub-'"${s}"'_task-rest_dir-RL_echo-1_bold.nii.gz"],#' "$f"
fi
done
Where can you get more information about BIDS directories? https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html)
BIDS specification is available online.
- I highly recommend consulting the BIDS specification as you set out your data!!
- E.g. how to organise your fieldmap folder when you collect magnitude and phase maps - this is all detailed in the BIDS specification
- If your data is not BIDS, and you try to run a container like fMRIPrep, you will get warnings - these warnings can be used to help you restructure your data to be BIDS compatible.
- 0.0 Home
- 0.1 Neuroscience fundamentals
- 0.2 Reproducible Science
- 0.3 MRI Physics, BIDS, DICOM, and data formats
- 0.4 Introduction to Diffusion MRI
- 0.5 Introduction to Functional MRI
- 0.6 Measuring functional and effective connectivity
- 0.7 Connectomics, graph theory, and complexity
- 0.8 Statistical and Mathematical Tidbits
- 0.9 Introduction to Psychopathology
- 0.10 Introduction to Genetics and Bioinformatics
- 0.11 Introduction to Programming
- 1.0 Working on the Cluster
- 2.0 Programming Languages
- 2.1 Python
- 2.2 MATLAB
- 2.3 R and RStudio
- 2.4 Programming Intro Exercises
- 2.5 git and GitHub
- 2.6 SLURM and Job Submission
- 3.0 Neuroimaging Tools and Packages
- 3.1 BIDS
- 3.2 FreeSurfer
- 3.2.1 Qdec
- 3.3 FSL
- 3.3.1 ICA-FIX
- 3.4 Connectome Workbench/wb_command
- 3.5 fMRIPrep
- 3.6 QSIPrep
- 3.7 HCP Pipeline
- 3.8 tedana
- 4.0 Quality control
- 4.1 MRIQC
- 4.2 Common Artefacts
- 4.3 T1w
- 4.4 rs-fMRI
- 5.0 Specialist Tools
- 6.0 Putting it all together