qsiprep.workflows.anatomical.volume module
Anatomical reference preprocessing workflows.
Anatomical reference preprocessing workflows
- qsiprep.workflows.anatomical.volume.init_anat_preproc_wf(num_anat_images, num_additional_t2ws, has_rois, anatomical_template, do_biascorr=True, t2w_do_biascorr=True, name='anat_preproc_wf')[source]
Build a workflow that runs the anatomical preprocessing stages of qsiprep.
This includes:
Creation of a structural template (AC-PC aligned)
Skull-stripping and bias correction
Tissue segmentation
Normalization
- Parameters:
num_anat_images (int) – Number of anatomical images available in the chosen modality
num_additional_t2ws (int) – If anat modality is T1w and there are available T2ws that can be used by DRBUDDI, how many are there?
has_rois (bool) – Are there lesion ROI files?
anatomical_template (str) – Template specification of the form <template>[+<cohort>].
do_biascorr (bool, optional) – Whether to apply N4 bias correction to the T1w(?) or not. Default is True.
t2w_do_biascorr (bool, optional) – Whether to apply N4 bias correction to the T2w or not. Default is True.
name (str, optional) – Name of workflow (default:
anat_preproc_wf)
- Inputs:
t1w – List of T1-weighted structural images
t2w – List of T2-weighted structural images
roi – A mask to exclude regions during standardization (as list)
subjects_dir – FreeSurfer SUBJECTS_DIR
- Outputs:
t1_preproc – Bias-corrected structural template, defining T1w space
t1_brain – Skull-stripped
t1_preproct1_mask – Mask of the skull-stripped template image
t1_seg – Segmentation of preprocessed structural image, including gray-matter (GM), white-matter (WM) and cerebrospinal fluid (CSF)
t1_tpms – List of tissue probability maps in T1w space
t2_preproc – List of preprocessed t2w files
t1_2_mni – T1w template, normalized to MNI space
t1_2_mni_forward_transform – ANTs-compatible affine-and-warp transform file
t1_2_mni_reverse_transform – ANTs-compatible affine-and-warp transform file (inverse)
to_template_affine_transform – The full affine to the anatomical template that
acpc_transform(its rigid component) was extracted from. Maps the pre-AC-PC anatomical reference; compose withacpc_inv_transformto map AC-PC space linearly into the template space (used by SyNb0).t1_resampling_grid – Image of the preprocessed t1 to be used as the reference output for dwis
- qsiprep.workflows.anatomical.volume.anat_biascorrect_enabled(image_files=None)[source]
Decide whether N4 bias correction should run on these anatomical images.
--anat-biascorrectgoverns anatomicals only;--dwi-biascorrectgoverns the DWIs and never reaches this path.autoinspects the BIDSImageTypemetadata forNORM, which is how Siemens (among others) flags that intensity normalization was already applied on the console. Console normalization does not necessarily remove the need for N4, which is whyn4stays the default;autoandnoneare for deliberately skipping it.N4 is skipped only when EVERY input image is marked normalized. A mixed set still needs correction to be merged sensibly, and an image whose metadata is missing is treated as un-normalized – the conservative direction, since running N4 unnecessarily is milder than skipping it when it was needed.
- qsiprep.workflows.anatomical.volume.init_anat_derivatives_wf(anatomical_template, has_t2w=False) LiterateWorkflow[source]
Set up a battery of datasinks to store derivatives in the right location.
- qsiprep.workflows.anatomical.volume.init_anat_normalization_wf(anatomical_template, has_rois=False) LiterateWorkflow[source]
Build a workflow that registers the anatomical reference to the template.
This workflow performs registration from the original anatomical reference to the template anatomical reference.
- Parameters:
anatomical_template (str) – Name of the template the anatomical reference is registered to.
has_rois (bool, optional) – Whether Registration should account for regions to exclude
- Inputs:
anatomical_reference – Bias-corrected anatomical reference image (head)
brain_mask – Brain mask restricting the affine registration that the AC-PC transform is extracted from
nonlinear_brain_mask – Brain mask restricting the nonlinear registration to the template. The same as
brain_maskunless--force no-csf-synthstripis set.roi – A mask to exclude regions during standardization (as list)
- Outputs:
to_template_nonlinear_transform – Composite transform (SyN warp and affine) to the template
to_template_rigid_transform – Rigid (AC-PC) component of the full affine to the template
to_template_affine_transform – The full affine to the template that the AC-PC transform was extracted from (maps the pre-AC-PC anatomical reference; compose with
from_template_rigid_transformto map AC-PC space linearly into the template space)from_template_nonlinear_transform – Inverse of
to_template_nonlinear_transformfrom_template_rigid_transform – Inverse of
to_template_rigid_transformout_report – Reportlet visualizing the spatial normalization
- qsiprep.workflows.anatomical.volume.init_anat_preproc_wf(num_anat_images, num_additional_t2ws, has_rois, anatomical_template, do_biascorr=True, t2w_do_biascorr=True, name='anat_preproc_wf')[source]
Build a workflow that runs the anatomical preprocessing stages of qsiprep.
This includes:
Creation of a structural template (AC-PC aligned)
Skull-stripping and bias correction
Tissue segmentation
Normalization
- Parameters:
num_anat_images (int) – Number of anatomical images available in the chosen modality
num_additional_t2ws (int) – If anat modality is T1w and there are available T2ws that can be used by DRBUDDI, how many are there?
has_rois (bool) – Are there lesion ROI files?
anatomical_template (str) – Template specification of the form <template>[+<cohort>].
do_biascorr (bool, optional) – Whether to apply N4 bias correction to the T1w(?) or not. Default is True.
t2w_do_biascorr (bool, optional) – Whether to apply N4 bias correction to the T2w or not. Default is True.
name (str, optional) – Name of workflow (default:
anat_preproc_wf)
- Inputs:
t1w – List of T1-weighted structural images
t2w – List of T2-weighted structural images
roi – A mask to exclude regions during standardization (as list)
subjects_dir – FreeSurfer SUBJECTS_DIR
- Outputs:
t1_preproc – Bias-corrected structural template, defining T1w space
t1_brain – Skull-stripped
t1_preproct1_mask – Mask of the skull-stripped template image
t1_seg – Segmentation of preprocessed structural image, including gray-matter (GM), white-matter (WM) and cerebrospinal fluid (CSF)
t1_tpms – List of tissue probability maps in T1w space
t2_preproc – List of preprocessed t2w files
t1_2_mni – T1w template, normalized to MNI space
t1_2_mni_forward_transform – ANTs-compatible affine-and-warp transform file
t1_2_mni_reverse_transform – ANTs-compatible affine-and-warp transform file (inverse)
to_template_affine_transform – The full affine to the anatomical template that
acpc_transform(its rigid component) was extracted from. Maps the pre-AC-PC anatomical reference; compose withacpc_inv_transformto map AC-PC space linearly into the template space (used by SyNb0).t1_resampling_grid – Image of the preprocessed t1 to be used as the reference output for dwis
- qsiprep.workflows.anatomical.volume.init_anat_reports_wf(anatomical_template) LiterateWorkflow[source]
Set up a battery of datasinks to store reports in the right location.
- qsiprep.workflows.anatomical.volume.init_anat_template_wf(num_images, do_biascorr=True) LiterateWorkflow[source]
Build a workflow that generates a canonically oriented structural template.
This workflow generates a canonically oriented structural template from input anatomical images.
- Parameters:
num_images (int) – Number of anatomical images
do_biascorr (bool, optional) – Whether or not to apply N4 bias correction. Default is True.
- Inputs:
anatomical_images – List of structural images
- Outputs:
template – Structural template, defining T1w space
template_transforms – List of affine transforms from
templateto original imagesout_report – Conformation report
- qsiprep.workflows.anatomical.volume.init_dl_prep_wf(name='dl_prep_wf') LiterateWorkflow[source]
Prepare images for use in the FreeSurfer deep learning functions.
- qsiprep.workflows.anatomical.volume.init_output_grid_wf() LiterateWorkflow[source]
Generate a non-oblique, uniform voxel-size grid around a brain.
- qsiprep.workflows.anatomical.volume.init_synthstrip_wf(do_padding=False, unfatsat=False, no_csf=False, name='synthstrip_wf') LiterateWorkflow[source]
Skull strip an image with SynthStrip, or with niimath’s surface stripper under –sloppy.
no_csfselects SynthStrip’s--no-csfmodel, which trims CSF and dura from the brain border. Ventricular CSF stays inside the mask either way.Under
--sloppythe node isniimath -skullstrip(AFNI’s surface method, 1.5 s, 90 MB, Dice 0.96 against SynthStrip on a 1 mm T2w) instead of the torch runtime;no_csfhas no counterpart there and is ignored.