Warning: This document is for the development version of smriprep. The main version is master.

smriprep.workflows.outputs module

Writing outputs.

smriprep.workflows.outputs.init_anat_reports_wf(*, spaces, freesurfer, output_dir, sloppy=False, name='anat_reports_wf')[source]

Set up a battery of datasinks to store reports in the right location.

Parameters:
  • freesurfer (bool) – FreeSurfer was enabled

  • output_dir (str) – Directory in which to save derivatives

  • name (str) – Workflow name (default: anat_reports_wf)

Inputs:
  • source_file – Input T1w image

  • std_t1w – T1w image resampled to standard space

  • std_mask – Mask of skull-stripped template

  • subject_dir – FreeSurfer SUBJECTS_DIR

  • subject_id – FreeSurfer subject ID

  • t1w_conform_report – Conformation report

  • t1w_preproc – The T1w reference map, which is calculated as the average of bias-corrected and preprocessed T1w images, defining the anatomical space.

  • t1w_dseg – Segmentation in T1w space

  • t1w_mask – Brain (binary) mask estimated by brain extraction.

  • template – Template space and specifications

smriprep.workflows.outputs.init_ds_anat_volumes_wf(*, bids_root: str, output_dir: str, name='ds_anat_volumes_wf', tpm_labels=('GM', 'WM', 'CSF')) Workflow[source]
smriprep.workflows.outputs.init_ds_dseg_wf(*, output_dir: str, extra_entities: dict | None = None, name: str = 'ds_dseg_wf')[source]

Save discrete segmentations

Parameters:
  • output_dir (str) – Directory in which to save derivatives

  • extra_entities (dict or None) – Additional entities to add to filename

  • name (str) – Workflow name (default: ds_dseg_wf)

Inputs:
  • source_files – List of input anatomical images

  • anat_dseg – Segmentation in anatomical space

Outputs:

anat_dseg – The location in the output directory of the discrete segmentation

smriprep.workflows.outputs.init_ds_fs_registration_wf(*, output_dir: str, image_type: Literal['T1w', 'T2w'], name: str = 'ds_fs_registration_wf')[source]

Save rigid registration between subject anatomical template and either FreeSurfer T1.mgz or T2.mgz

Parameters:
  • output_dir (str) – Directory in which to save derivatives

  • name (str) – Workflow name (default: ds_fs_registration_wf)

Inputs:
  • source_files – List of input anatomical images

  • fsnative2anat_xfm – LTA-style affine matrix translating from FreeSurfer-conformed subject space to T1/T2

Outputs:
  • anat2fsnative_xfm – LTA-style affine matrix translating from T1/T2 to FreeSurfer-conformed subject space

  • fsnative2anat_xfm – LTA-style affine matrix translating from FreeSurfer-conformed subject space to T1w

smriprep.workflows.outputs.init_ds_fs_segs_wf(*, bids_root: str, output_dir: str, extra_entities: dict | None = None, name='ds_fs_segs_wf')[source]

Set up a battery of datasinks to store derivatives in the right location.

Parameters:
  • bids_root (str) – Root path of BIDS dataset

  • output_dir (str) – Directory in which to save derivatives

  • extra_entities (dict or None) – Additional entities to add to filename

  • name (str) – Workflow name (default: ds_anat_segs_wf)

Inputs:
  • anat_fs_aparc – FreeSurfer’s aparc+aseg segmentation, in native anatomical space

  • anat_fs_aseg – FreeSurfer’s aseg segmentation, in native anatomical space

  • source_files – List of input anatomical images

smriprep.workflows.outputs.init_ds_grayord_metrics_wf(*, bids_root: str, output_dir: str, metrics: list[str], cifti_output: Literal['91k', '170k'], name='ds_grayord_metrics_wf') LiterateWorkflow[source]

Save CIFTI-2 surface metrics

Parameters:
  • bids_root (str) – Root path of BIDS dataset

  • output_dir (str) – Directory in which to save derivatives

  • metrics (str) – List of metrics to generate DataSinks for

  • cifti_output (str) – Density of CIFTI-2 files to save

  • name (str) – Workflow name (default: ds_surface_metrics_wf)

Inputs:
  • source_files – List of input T1w images

  • ``<metric>`` – CIFTI-2 scalar file for each metric passed to metrics

  • ``<metric>_metadata`` – JSON file containing metadata for each metric passed to metrics

Outputs:

``<metric>`` – CIFTI-2 scalar file in output_dir for each metric passed to metrics

smriprep.workflows.outputs.init_ds_mask_wf(*, bids_root: str, output_dir: str, mask_type: Literal['brain', 'roi', 'ribbon'], extra_entities: dict | None = None, name='ds_mask_wf')[source]

Save the subject brain mask

Parameters:
  • bids_root (str) – Root path of BIDS dataset

  • output_dir (str) – Directory in which to save derivatives

  • extra_entities (dict or None) – Additional entities to add to filename

  • name (str) – Workflow name (default: ds_mask_wf)

Inputs:
  • source_files – List of input anat images

  • mask_file – Mask to save

Outputs:

mask_file – The location in the output directory of the mask

smriprep.workflows.outputs.init_ds_surface_metrics_wf(*, bids_root: str, output_dir: str, metrics: list[str], name='ds_surface_metrics_wf') LiterateWorkflow[source]

Save GIFTI surface metrics

Parameters:
  • bids_root (str) – Root path of BIDS dataset

  • output_dir (str) – Directory in which to save derivatives

  • metrics (str) – List of metrics to generate DataSinks for

  • name (str) – Workflow name (default: ds_surface_metrics_wf)

Inputs:
  • source_files – List of input T1w images

  • ``<metric>`` – Left and right GIFTIs for each metric passed to metrics

Outputs:

``<metric>`` – Left and right GIFTIs in output_dir for each metric passed to metrics

smriprep.workflows.outputs.init_ds_surfaces_wf(*, output_dir: str, surfaces: list[str], entities: dict[str, str] | None = None, name='ds_surfaces_wf') LiterateWorkflow[source]

Save GIFTI surfaces

Parameters:
  • bids_root (str) – Root path of BIDS dataset

  • output_dir (str) – Directory in which to save derivatives

  • surfaces (str) – List of surfaces to generate DataSinks for

  • entities (dict of str) – Entities to include in outputs

  • name (str) – Workflow name (default: ds_surfaces_wf)

Inputs:
  • source_files – List of input anatomical images

  • ``<surface>`` – Left and right GIFTIs for each surface passed to surfaces

Outputs:

``<surface>`` – Left and right GIFTIs in output_dir for each surface passed to surfaces

smriprep.workflows.outputs.init_ds_template_registration_wf(*, output_dir: str, image_type: Literal['T1w', 'T2w'], name: str = 'ds_template_registration_wf')[source]

Save template registration transforms

Parameters:
  • output_dir (str) – Directory in which to save derivatives

  • image_type (str) – Anatomical image type (T1w, T2w, etc)

  • name (str) – Workflow name (default: anat_derivatives_wf)

Inputs:
  • template – Template space and specifications

  • source_files – List of input anatomical images

  • anat2std_xfm – Nonlinear spatial transform to resample imaging data given in anatomical space into standard space.

  • std2anat_xfm – Inverse transform of anat2std_xfm

smriprep.workflows.outputs.init_ds_template_wf(*, num_anat: int, output_dir: str, image_type: Literal['T1w', 'T2w'], name: str = 'ds_template_wf')[source]

Save the subject-specific template

Parameters:
  • num_anat (int) – Number of anatomical images

  • output_dir (str) – Directory in which to save derivatives

  • image_type – MR image type (T1w, T2w, etc.)

  • name (str) – Workflow name (default: ds_template_wf)

Inputs:
  • source_files – List of input anatomical images

  • anat_ref_xfms – List of affine transforms to realign input anatomical images

  • anat_preproc – The anatomical reference map, which is calculated as the average of bias-corrected and preprocessed anatomical images, defining the anatomical space.

Outputs:

anat_preproc – The location in the output directory of the preprocessed anatomical image

smriprep.workflows.outputs.init_ds_tpms_wf(*, output_dir: str, extra_entities: dict | None = None, name: str = 'ds_tpms_wf', tpm_labels: tuple = ('GM', 'WM', 'CSF'))[source]

Save tissue probability maps

Parameters:
  • output_dir (str) – Directory in which to save derivatives

  • extra_entities (dict or None) – Additional entities to add to filename

  • name (str) – Workflow name (default: anat_derivatives_wf)

  • tpm_labels (tuple) – Tissue probability maps in order

Inputs:
  • source_files – List of input anatomical images

  • anat_tpms – Tissue probability maps in anatomical space

Outputs:

anat_tpms – The location in the output directory of the tissue probability maps

smriprep.workflows.outputs.init_template_iterator_wf(*, spaces: SpatialReferences, sloppy: bool = False, name='template_iterator_wf')[source]

Prepare the necessary components to resample an image to a template space

This produces a workflow with an unjoined iterable named “spacesource”.

It takes as input a collated list of template specifiers and transforms to that space.

The fields in outputnode can be used as if they come from a single template.