All checks were successful
Deploy on webserver / Build site with hugo and deploy on success (push) Successful in 6m53s
84 lines
4.4 KiB
Markdown
84 lines
4.4 KiB
Markdown
---
|
|
title: BIDS conversion
|
|
---
|
|
|
|
Converting the heterogeneous, site-specific raw MRI data acquisitions into a standardized dataset is an essential precondition for the collaborative work in TRR379.
|
|
It readies the data for processing with established pipelines, and applies a pseudonymization as a safeguard for responsible use of this personal data.
|
|
|
|
TRR379 uses the [Brain Imaging Data Structure](bids.neuroimaging.io) (BIDS) as the standard for its datasets.
|
|
|
|
|
|
## Conversion to BIDS
|
|
|
|
The conversion of raw MRI data in DICOM format to a BIDS-compliant dataset is a largely automated process.
|
|
The recommended software to be used for conversion is [Heudiconv](https://heudiconv.readthedocs.io).
|
|
|
|
Heudiconv uses [dcm2niix](https://github.com/rordenlab/dcm2niix) as the actual DICOM→NIfTI converter.
|
|
In our experience, `dcm2niix` is the most robust and most correct tool available for this task.
|
|
|
|
Heudiconv does the job of mapping DICOM series to BIDS entities (ie. determine BIDS-compliant file names).
|
|
A key heudiconv concept is a **heuristic**: a Python program (function) which looks at the DICOM series properties and matches it with a file naming pattern.
|
|
A heuristic typically relies on DICOM series naming (set at the scanner console), but it can also use other properties such as number of images or acquisition parameters.
|
|
|
|
Because TRR379 uses its own conventions, a matching heuristic needs to be provided (possibly one for each TRR379 site).
|
|
An [implementation of such a heuristic](https://hub.trr379.de/q02/phantom-mri-bids/src/branch/main/code/heuristic-q01.py) has been created, and was tested on phantom MRI acquisitions from all sites (see below).
|
|
Using this heuristic, MRI data from all sites can be BIDS-standardized.
|
|
As with any automation, caution and oversight is needed for edge cases (e.g. repeated / discarded acquisitions).
|
|
|
|
[Heudiconv tutorials](https://heudiconv.readthedocs.io/en/latest/tutorials.html) further illustrate the process and capabilities of the software.
|
|
|
|
### Good practices
|
|
|
|
- Use heudiconv as a containerized application. Q02 provides a [readily usable utility dataset with a
|
|
configured container](https://hub.trr379.de/q02/heudiconv-container). See that repository for
|
|
an example usage.
|
|
- DICOMs as subdatasets helps with provenance, even if those DICOMs are never accessed outside
|
|
- Heudiconv takes paths and (optionally) intended subject IDs as input
|
|
- if paths contain identifying information, this would leak into DataLad run records
|
|
- having a helper script / lookup table in the (private) DICOM dataset can hide this information
|
|
|
|
### Caveats
|
|
|
|
- https://hub.trr379.de/q02/phantom-mri-bids used dcm2niix v1.0.20240202
|
|
- current latest is v1.0.20250506
|
|
- potential impact discussed in https://hub.trr379.de/q02/phantom-mri-bids/issues/8
|
|
|
|
## Demonstrators and resources
|
|
|
|
### TRR phantom DICOMs
|
|
|
|
Scans of MRI phantoms were carried out using the intended sequences (presumably - see caveats section below).
|
|
These were shared with Q02 and uploaded to the TRR Hub forgejo instance:
|
|
|
|
- https://hub.trr379.de/q01/phantom-mri-dicom-aachen
|
|
- https://hub.trr379.de/q01/phantom-mri-dicom-frankfurt
|
|
- https://hub.trr379.de/q01/phantom-mri-dicom-heidelberg
|
|
- https://hub.trr379.de/q01/phantom-mri-dicom-mannheim
|
|
|
|
Note: Aachen did a re-scan which was shared by e-mail / cloud (June 03, 2025).
|
|
This has not been uploaded to forgejo (permissions + size).
|
|
|
|
### TRR phantom BIDS
|
|
|
|
- A BIDS-compliant dataset from these dicoms (3/4 sites): https://hub.trr379.de/q02/phantom-mri-bids
|
|
- The heuristic used: https://hub.trr379.de/q02/phantom-mri-bids/src/branch/main/code/heuristic-q01.py
|
|
- Issue tracker: https://hub.trr379.de/q02/phantom-mri-bids/issues
|
|
|
|
Conversion of re-scanned Aachen phantom is in https://hub.trr379.de/q02/tmp-phantom-bids (separate from the above
|
|
because input data is not available as a DataLad dataset)
|
|
|
|
### Data consistency
|
|
|
|
- the phantom datasets are not the same: https://hub.trr379.de/q02/phantom-mri-bids/issues/6
|
|
- re-scan from Aachen has more sequences than the initial scan, but lacks T2w
|
|
- heudiconv fails to parse some Heidelberg dicoms, and dcm2niix raises warnings;
|
|
unclear whether this is data issue or software issue: https://hub.trr379.de/q02/phantom-mri-bids/issues/5
|
|
|
|
### Conversion: technical issues
|
|
|
|
These are open questions:
|
|
|
|
- Technical: BIDS validator errors https://hub.trr379.de/q02/phantom-mri-bids/issues/7
|
|
- Technical: re-run with the latest dcm2niix https://hub.trr379.de/q02/phantom-mri-bids/issues/8
|
|
|
|
|