Skip to content

Input data layout

QSMxT reads BIDS datasets. If you convert your DICOMs with qsmxt dicom-convert the layout is handled for you, and this page is mostly reference. If you are assembling a dataset by hand, or wondering why an output did not appear, start here.

Terminal window
qsmxt validate study/bids

This reports every run it discovers, the echo times and field strength it read, and which outputs your data can support. Run it before a long job:

sub-01_acq-gre_MEGRE
Echoes: 4
Echo times: [0.004, 0.012, 0.02, 0.028] s
Field strength: 3.0 T
Magnitude: present
MESE (spin-echo): not found
Capabilities:
QSM reconstruction: yes
R2*/T2* mapping: yes
SWI: yes

The pipeline discovers a run from its phase images:

sub-*/[ses-*/]anat/*_part-phase_*.nii[.gz]

with matching JSON sidecars containing EchoTime and MagneticFieldStrength. A sidecar’s Manufacturer, when it has one, decides the phase sign of real/imaginary input and the recommendations that depend on the vendor (the Tukey window with χ-sepnet). Multi-echo data uses the BIDS echo-<N> entity. Magnitude images sit alongside as *_part-mag_*, and are optional for a basic QSM run but required by most other outputs.

Two further acquisitions are recognised when present:

Pattern Provides
sub-*/[ses-*/]anat/*_part-mag_*.nii[.gz] magnitude, for R2*/T2*, SWI and masking
sub-*/[ses-*/]anat/*_echo-*_MESE.nii[.gz] multi-echo spin-echo, for R2 and hence R2’

A MESE acquisition needs at least three echoes to fit R2. Fewer are ignored. It does not have to be on the same grid as the GRE — a 2D stack with thicker slices or a smaller matrix is resampled onto whatever grid the run reconstructs on, using its affine. R2 is reported only where the MESE’s field of view reaches.

Phase is what a run is discovered from, so it is present for everything below. This table lists what each output needs in addition to it.

Output Also requires
QSM nothing, though magnitude is recommended and some masking options need it. Some methods need more: see below
SWI (--do-swi), SMWI (--do-smwi) magnitude
Segmentation (--do-segmentation), and so --do-analysis and a region --qsm-reference magnitude, or a dseg via --use-custom-dseg
R2*/T2* (--do-r2starmap, --do-t2starmap) magnitude, at least 3 echoes with increasing echo times
R2 (--do-r2map) a MESE acquisition with at least 3 equally spaced echoes, the first at the echo spacing (TE₁ = ESP)
R2’ (--do-r2primemap) R2* and R2 (above). Reported only where the MESE reached; without one, predicted from R2* by R2PRIMEnet, which is 3 T only

The EPG fit behind R2 simulates a spin-echo train with echoes at multiples of the spacing. A MESE with uneven spacing would give wrong maps rather than noisy ones, so it is refused.

Some QSM methods need more of the data than phase:

Method Also requires
--qsm-algorithm medi, tfi, --bf-algorithm pdf the magnitude of every echo, and increasing, evenly spaced echoes: they weight the data by a noise map made from the echoes (MEDI toolbox Fit_ppm_complex)
--qsm-algorithm ndi, nltv, fansi, fansi-tgv, l1qsm, hdqsm, lsqr, heidi; whqsm with a magnitude weight magnitude: their data weight
--b0-estimation complex-fit the magnitude of every echo, and increasing, evenly spaced echo times: it fits the complex echoes per echo spacing (MEDI toolbox Fit_ppm_complex; with bipolar correction, its bipolar fit Fit_ppm_complex_bipolar)

Evenly spaced means each echo spacing is within 0.02 ms of the first, so echo times rounded to 0.01 ms in a sidecar (4.92, 9.84, 14.77, 19.68 ms) are accepted. | --qsm-algorithm medi with its CSF zero reference (--medi-csf, on by default) | at least 3 echoes for the CSF term (R2* finds the CSF); with fewer, MEDI runs without it, and the run says so | | --qsm-algorithm medi with --medi-msmv | also at least 3 echoes (R2* for its vessel mask) | | --chisep chi-sep-medi | the magnitude of every echo, and at least 3 increasing, evenly spaced echoes: it weights the data by a noise map made from the echoes, and finds its CSF mask from R2* | | --qsm-algorithm qsmart | what its inner inversion (--qsmart-inversion) needs; an inner medi or tfi only with a single echo, since QSMART gives its inner inversion one combined magnitude. With magnitude, every echo’s: QSMART detects vessels on their mean (--qsmart-vessel-magnitude mean-n4) | | --qsm-algorithm ndi, nltv, fansi, fansi-tgv, l1qsm | magnitude (the data weight) | | --qsm-algorithm star | nothing more, but with --star-te spacing the first two echo times in increasing order | | --qsm-algorithm whqsm with --whqsm-weight max-normalised or in-vivo | magnitude (the data weight) | | a method’s echo time (--medi-te and the others, see Echo time) | echo times it resolves from: with spacing, the first two in increasing order; a given time must be above 0 |

A run that cannot give these is refused before processing.

Source separation (--do-chisep) splits into two groups. The r2star-qsm and decompose methods work from multi-echo GRE magnitude alone (r2star-qsm needs what R2* needs). The other six are based on R2’, so they need a MESE acquisition as well, or R2PRIMEnet at 3 T.

An uncombined-coil run needs at least two echoes for MCPC-3D-S, whatever is asked for.

QSMxT will use maps produced by other tools from <bids>/derivatives/<TOOL>/, following the same sub-*/[ses-*/]anat/ layout:

Option Supplies Filename
--use-custom-masks [TOOL] brain mask *_mask.nii*
--use-custom-qsm <TOOL> susceptibility map *_Chimap.nii*
--use-custom-r2 <TOOL> R2 map *_R2map.nii*
--use-custom-r2prime <TOOL> R2’ map *_R2primemap.nii*

A supplied map must be on the scan’s grid. When --axial-resampling resamples the run to a cardinal-aligned grid, a map on the acquired grid is resampled with the echoes. A susceptibility, R2 or R2’ map on any other grid is refused when the run starts, before anything is computed, with a message naming the file and both grids. So is a segmentation (--use-custom-dseg) that only the statistics or a region --qsm-reference read. A brain mask, or a segmentation with --do-segmentation, that is not on the scan’s grid is replaced by one the run makes, with a warning.

Supplying R2’ directly removes the MESE requirement for source separation, since R2 is only needed to compute it. qsmxt validate lists the derivative tools it can see for each run.

A bring-your-own R2 or R2’ map that only covers part of the brain carries the same caveat as a MESE slab: leave the uncovered voxels at zero rather than filling them, since a zero R2 is read as an absent measurement and excluded, while a small non-zero one is taken at face value.

Series Name in sub-*/[ses-*/]anat/
Gradient-echo magnitude / phase / real / imaginary, one echo *_part-mag_T2starw (part-phase, part-real, part-imag)
The same, several echoes *_echo-<N>_part-mag_MEGRE
T1-weighted structural (MPRAGE, SPACE/TFE T1, MP2RAGE UNI) *_T1w
MP2RAGE inversion images *_inv-<N>_MP2RAGE
Scanner susceptibility map *_rec-scanner_Chimap
Scanner T2* / R2* map *_rec-scanner_T2starmap, *_rec-scanner_R2starmap
Scanner T1 map *_T1map
Scanner SWI *_rec-swi_part-mag_T2starw
Scanner minimum-intensity projection *_rec-mip_T2starw
Another reconstruction of the same images *_rec-<label>_…, e.g. rec-filtered, rec-scanner

The plain original image of each kind is the one without a rec- label; that is the one qsmxt run uses. The magnitude follows the phase: when the phase comes from a particular reconstruction (ASPIRE’s coil combination, say), the magnitude from that reconstruction is the main one, and the scanner’s own combination is rec-scanner. A scanner map without a protocol name (Bruker’s parametric maps) is filed with the acquisition it was made from. A map made from a series that is kept in extra_data/ goes there too. When dcm2niix cannot separate the echoes of a series into files, QSMxT converts each echo time separately, or, when the echo tags are the same for every image, each volume (rec-…volN). Phase sidecars get the Units BIDS requires: rad when the phase is already in radians (as dcm2niix writes Philips phase), otherwise arbitrary. Any other series (scouts, reformats, FLAIR, diffusion, Dixon, other vendor maps) is kept in sub-*/[ses-*/]extra_data/ as dcm2niix names it. These are not BIDS files, and .bidsignore lists extra_data. The .bidsignore also lists the MP2RAGE inversion images, because BIDS requires sidecar fields for them (such as NumberShots) that DICOM headers do not carry.