Anatomical processing
qsiprep.workflows.anatomical.volume.init_anat_preproc_wf()
QSIPrep uses the anatomical reference for three things: a brain mask, a
tissue segmentation that the reports draw over the distortion correction
results, and the definition of the subject’s ACPC space that every
output is written in. It also normalizes the reference to a template,
so that atlases can be brought into the subject’s space later.
The reference can be the T1w or the T2w (--anat-modality). Whichever is
chosen, the steps are:
Conform. Every image of the reference contrast is reoriented to LPS+ and resampled to a common voxel size.
Merge. If there are several images, they are N4-corrected and aligned to one another. With
--subject-anatomical-reference first-lex(the default) they are registered to the first image in lexical order; withunbiasedan unbiased mid-point template is built instead. The extra cost of the unbiased template is small for two images and about an order of magnitude for three or more.Brain extraction with SynthStrip [1].
Tissue segmentation with SynthSeg [2], giving the tissue-class
dsegand the regionaldesc-aseg_dsegderivatives.The SynthSeg tissue classes drawn over the anatomical reference, as shown in the report.
If the other contrast is present too (a T2w alongside a T1w reference), it is registered to the reference with an affine
antsRegistration, initialized by anantsAIrotation search, and written as an additional derivative.AC-PC alignment. The reference is rigidly registered to the template, and the rigid transform defines
ACPCspace: the origin at the anterior commissure and the axes aligned with the template’s, but with the subject’s own brain shape and size. All outputs are written in this space.Spatial normalization.
antsRegistrationregisters the reference to the template in a multi-scale, mutual-information based, nonlinear scheme. The forward and inverse transforms are written with the anatomical derivatives.--skip-anat-based-spatial-normalizationskips this step.The subject’s brain mask restricts this registration. The default SynthStrip mask keeps CSF and dura at the brain border, whereas the template’s brain mask is tight around the brain, so in atrophied brains the registration can pull the dura, rather than the cortex, onto the template’s brain edge.
--force no-csf-synthstripruns a second SynthStrip with its--no-csfmodel and uses that tighter mask for the nonlinear registration only. The AC-PC alignment, the saveddesc-brain_maskimages and the DWI workflows keep the default mask, so the flag changes thefrom-ACPC_to-<template>transforms and nothing downstream of the masks.The report’s normalization figure alternates between the template and the normalized T1w while the pointer is over it.
The preprocessed reference defines ACPC space. With several input
images, that space is not exactly aligned with any one of them; the
from-orig_to-anat transforms map each input into it.
(Source code, png, svg, pdf)
Lesions
For patients with focal lesions (stroke, tumor resection), a binary lesion
mask (1 inside the lesion) in the same space and resolution as the T1w,
named sub-<label>_label-lesion_roi.nii.gz in anat/, is used as a
mask during spatial normalization [3], so that healthy
tissue is not warped into the lesion or the other way around.
Sessions
By default the anatomical images of all sessions are merged into one
reference and one ACPC space per subject. --subject-anatomical-reference
sessionwise processes each session with its own reference, its own space
and its own report, which is required with --infant and appropriate
whenever the anatomy changes between sessions.
Infant data
--infant replaces the adult template with the MNIInfant cohort matching
the participant’s age (see Running QSIPrep for where the age is read from).
The cohort selection follows Nibabies. Brain extraction and segmentation are
the same as for adults.
No anatomical image
With --anat-modality none there is no anatomical workflow. The b=0
reference is registered directly to the template and only the rigid part of
that registration is kept, which gives an AC-PC aligned b=0 that keeps the
shape and size of the original. There is no tissue segmentation in the
reports and no template normalization.