xcp_d.workflows.postprocessing module

Workflows for post-processing BOLD data.

xcp_d.workflows.postprocessing.init_denoise_bold_wf(TR, mem_gb, name='denoise_bold_wf')[source]

Denoise BOLD data.

Workflow Graph

(Source code)

Parameters:
  • TR (float) – Repetition time of the BOLD run, in seconds.

  • mem_gb (dict) – Memory size in GB to use for each of the nodes.

  • name (str, optional) – Name of the workflow. This is used for working directories and workflow graphs. Default is “denoise_bold_wf”.

Inputs:
  • preprocessed_bold

  • temporal_mask (str) – Temporal mask; all values above fd_thresh set to 1. This is a TSV file with one column: ‘framewise_displacement’.

  • mask

  • confounds_file

Outputs:
  • denoised_interpolated_bold (str) – Path to the censored, denoised, interpolated, and filtered BOLD file. This file is the result of denoising the censored preprocessed BOLD data, followed by cubic spline interpolation and band-pass filtering.

    This output should not be used for analysis. It is primarily for DCAN QC plots.

  • censored_denoised_bold (str) – Path to the censored, denoised, interpolated, filtered, and re-censored BOLD file. This file is the result of denoising the censored preprocessed BOLD data, followed by cubic spline interpolation, band-pass filtering, and re-censoring.

    This output is the primary derivative for analysis.

  • smoothed_denoised_bold (str) – Path to the censored, denoised, interpolated, filtered, re-censored, and smoothed BOLD file. This file is the result of denoising the censored preprocessed BOLD data, followed by cubic spline interpolation, band-pass filtering, re-censoring, and spatial smoothing.

xcp_d.workflows.postprocessing.init_despike_wf(TR, name='despike_wf')[source]

Despike BOLD data with AFNI’s 3dDespike.

Despiking truncates large spikes in the BOLD times series. Despiking reduces/limits the amplitude or magnitude of large spikes, but preserves those data points with an imputed reduced amplitude. Despiking is done before regression and filtering to minimize the impact of spikes. Despiking is applied to whole volumes and data, and different from temporal censoring. It can be added to the command line arguments with --despike.

Workflow Graph

(Source code)

Parameters:
  • TR (float) – Repetition time of the BOLD run, in seconds.

  • name (str, optional) – Name of the workflow. This is used for working directories and workflow graphs. Default is “despike_wf”.

Inputs:

bold_file (str) – A NIFTI or CIFTI BOLD file to despike.

Outputs:

bold_file (str) – The despiked NIFTI or CIFTI BOLD file.

xcp_d.workflows.postprocessing.init_prepare_confounds_wf(TR, exact_scans, head_radius, custom_confounds_file, name='prepare_confounds_wf')[source]

Prepare confounds.

This workflow loads and consolidates confounds, removes dummy volumes, filters motion parameters, calculates framewise displacement, and flags outlier volumes.

Workflow Graph

(Source code)

Parameters:
  • TR (float) – Repetition time of the BOLD run, in seconds.

  • exact_scans (list of int, optional) – If used, this parameter will produce correlation matrices limited to each requested amount of time. If there is more than the required amount of low-motion data, then volumes will be randomly selected to produce denoised outputs with the exact amounts of time requested. If there is less than the required amount of ‘good’ data, then the run will not be post-processed.

  • head_radius (float or “auto”) – Radius of the head, in millimeters, for framewise displacement calculation.

    xcp_d’s default head radius is 50. The recommended value for infants is 35. A value of ‘auto’ is also supported, in which case the brain radius is estimated from the preprocessed brain mask. This will already be estimated before this workflow.

  • custom_confounds_file (str or None) – Path to custom nuisance regressors.

  • name (str, optional) – Name of the workflow. This is used for working directories and workflow graphs. Default is “prepare_confounds_wf”.

Inputs:
  • name_source (str) – Path to the file that will be used as the source_file for derivatives. This is generally the preprocessed BOLD file. This file does not need to exist (e.g., in the case of a concatenated version of the filename).

  • preprocessed_bold (str)

  • fmriprep_confounds_file (str) – Confounds TSV file from preprocessing derivatives.

  • fmriprep_confounds_json (str) – JSON file associated with the fMRIPrep confounds TSV.

  • custom_confounds_file (str or None) – Path to custom nuisance regressors.

  • dummy_scans (int or “auto”) – Number of volumes to remove from the beginning of each run. If set to ‘auto’, xcp_d will extract non-steady-state volume indices from the preprocessing derivatives’ confounds file. Set from the parameter.

Outputs:
  • preprocessed_bold (str)

  • fmriprep_confounds_file (str) – Confounds TSV file from preprocessing derivatives.

  • confounds_file (str) – The selected confounds, potentially including custom confounds, after dummy scan removal.

  • confounds_metadata (dict)

  • dummy_scans (int or “auto”) – Number of volumes to remove from the beginning of each run. If set to ‘auto’, xcp_d will extract non-steady-state volume indices from the preprocessing derivatives’ confounds file. If originally set to “auto”, this output will have the actual number of dummy volumes.

  • filtered_motion (str) – Framewise displacement timeseries, potentially after bandstop or low-pass filtering. This is a TSV file with one column: ‘framewise_displacement’.

  • motion_metadata (dict)

  • temporal_mask (str) – Temporal mask; all values above fd_thresh set to 1. This is a TSV file with one column: ‘framewise_displacement’.

  • temporal_mask_metadata (dict)

xcp_d.workflows.postprocessing.init_resd_smoothing_wf(mem_gb, name='resd_smoothing_wf')[source]

Smooth BOLD residuals.

Workflow Graph

(Source code)

Parameters:
  • mem_gb (dict) – Memory size in GB to use for each of the nodes.

  • name (str, optional) – Name of the workflow. This is used for working directories and workflow graphs. Default is “resd_smoothing_wf”.

Inputs:

bold_file

Outputs:

smoothed_bold