xcp_d.workflows.anatomical module

Anatomical post-processing workflows.

xcp_d.workflows.anatomical.init_ants_xfm_to_fsl_wf(mem_gb, omp_nthreads, name='ants_xfm_to_fsl_wf')[source]

Modify ANTS-style fMRIPrep transforms to work with Connectome Workbench/FSL FNIRT.

Workflow Graph

(Source code)

Parameters:
  • mem_gb (float) – Memory limit, in gigabytes.

  • omp_nthreads (int) – Maximum number of threads an individual process may use.

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

Inputs:
  • anat_to_template_xfm – ANTS/fMRIPrep-style H5 transform from T1w image to template.

  • template_to_anat_xfm – ANTS/fMRIPrep-style H5 transform from template to T1w image.

Outputs:
  • world_xfm – TODO: Add description.

  • merged_warpfield – TODO: Add description.

  • merged_inv_warpfield – TODO: Add description.

xcp_d.workflows.anatomical.init_generate_hcp_surfaces_wf(output_dir, mem_gb, omp_nthreads, name='generate_hcp_surfaces_wf')[source]

Generate midthickness, inflated, and very-inflated HCP-style surfaces.

Workflow Graph

(Source code)

Parameters:
  • output_dir (str) – Path to the output directory for xcp_d derivatives. This should not include the xcp_d folder. For example, “/path/to/dset/derivatives/”.

  • mem_gb (float) – Memory limit, in gigabytes.

  • omp_nthreads (int) – Maximum number of threads an individual process may use.

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

Inputs:
  • name_source (str) – Path to the file that will be used as the source_file for datasinks.

  • pial_surf (str) – The surface file to inflate.

  • wm_surf (str) – The surface file to inflate.

xcp_d.workflows.anatomical.init_postprocess_anat_wf(output_dir, input_type, t1w_available, t2w_available, target_space, dcan_qc, omp_nthreads, mem_gb, name='postprocess_anat_wf')[source]

Copy T1w, segmentation, and, optionally, T2w to the derivative directory.

If necessary, this workflow will also warp the images to standard space.

Workflow Graph

(Source code)

Parameters:
  • output_dir (str) – Path to the output directory for xcp_d derivatives. This should not include the xcp_d folder. For example, “/path/to/dset/derivatives/”.

  • input_type ({“fmriprep”, “dcan”, “hcp”, “nibabies”}) – The format of the incoming preprocessed BIDS derivatives. DCAN- and HCP-format derivatives will automatically be converted to a more BIDS-compliant format. fMRIPrep and Nibabies derivatives are assumed to be roughly equivalent in terms of file organization and naming.

  • t1w_available (bool) – True if a preprocessed T1w is available, False if not.

  • t2w_available (bool) – True if a preprocessed T2w is available, False if not.

  • target_space (str) – Target NIFTI template for T1w.

  • dcan_qc (bool) – This flag determines if DCAN-related QC steps will be taken. Enabling this flag will trigger the following steps:

    1. Brainsprite figures will be generated.

    2. The executive summary will be generated.

    3. DCAN QC files will be generated.

  • omp_nthreads (int) – Maximum number of threads an individual process may use.

  • mem_gb (float) – Memory limit, in gigabytes.

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

Inputs:
  • t1w (str) – Path to the preprocessed T1w file. This file may be in standard space or native T1w space.

  • t2w (str or None) – Path to the preprocessed T2w file. This file may be in standard space or native T1w space.

  • anat_dseg (str) – Path to the T1w segmentation file.

  • anat_to_template_xfm (str) – Path to the T1w-to-MNI transform file. May be “identity”, for testing purposes. We need to use MNI152NLin6Asym for the template.

  • template (str) – The target template.

Outputs:
  • t1w (str) – Path to the preprocessed T1w file in standard space.

  • t2w (str or None) – Path to the preprocessed T2w file in standard space.

xcp_d.workflows.anatomical.init_postprocess_surfaces_wf(fmri_dir, subject_id, dcan_qc, process_surfaces, mesh_available, standard_space_mesh, shape_available, output_dir, t1w_available, t2w_available, mem_gb, omp_nthreads, name='postprocess_surfaces_wf')[source]

Postprocess surfaces.

Workflow Graph

(Source code)

Parameters:
  • fmri_dir

  • subject_id

  • dcan_qc (bool) – This flag determines if DCAN-related QC steps will be taken. Enabling this flag will trigger the following steps:

    1. Brainsprite figures will be generated.

    2. The executive summary will be generated.

    3. DCAN QC files will be generated.

  • process_surfaces (bool)

  • mesh_available (bool)

  • standard_space_mesh (bool)

  • shape_available (bool)

  • output_dir (str) – Path to the output directory for xcp_d derivatives. This should not include the xcp_d folder. For example, “/path/to/dset/derivatives/”.

  • t1w_available (bool) – True if a T1w image is available.

  • t2w_available (bool) – True if a T2w image is available.

  • mem_gb (float) – Memory limit, in gigabytes.

  • omp_nthreads (int) – Maximum number of threads an individual process may use.

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

Inputs:
  • t1w – Preprocessed T1w file. May be in native or standard space.

  • t2w – Preprocessed T2w file. May be in native or standard space.

  • anat_to_template_xfm (str) – Path to the T1w-to-MNI transform file. May be “identity”, for testing purposes.

  • template_to_anat_xfm (str) – Path to the MNI-to-T1w transform file. May be “identity”, for testing purposes.

  • lh_pial_surf, rh_pial_surf

  • lh_wm_surf, rh_wm_surf

  • lh_sulcal_depth, rh_sulcal_depth

  • lh_sulcal_curv, rh_sulcal_curv

  • lh_cortical_thickness, rh_cortical_thickness

xcp_d.workflows.anatomical.init_warp_one_hemisphere_wf(participant_id, hemisphere, mem_gb, omp_nthreads, name='warp_one_hemisphere_wf')[source]

Apply transforms to warp one hemisphere’s surface files into standard space.

Workflow Graph

(Source code)

Parameters:
  • hemisphere ({“L”, “R”})

  • mem_gb (float) – Memory limit, in gigabytes.

  • omp_nthreads (int) – Maximum number of threads an individual process may use.

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

Inputs:
  • hemi_files (list of str) – A list of surface files for the requested hemisphere, in fsnative space.

  • world_xfm

  • merged_warpfield

  • merged_inv_warpfield

  • freesurfer_path – Path to FreeSurfer derivatives. Used to load the subject’s sphere file.

  • participant_id – Set from parameters.

Outputs:

warped_hemi_files

xcp_d.workflows.anatomical.init_warp_surfaces_to_template_wf(fmri_dir, subject_id, output_dir, omp_nthreads, mem_gb, name='warp_surfaces_to_template_wf')[source]

Transform surfaces from native to standard fsLR-32k space.

Workflow Graph

(Source code)

Parameters:
  • fmri_dir (str) – Path to the preprocessed derivatives dataset. For example, “/path/to/dset/derivatives/fmriprep/”.

  • subject_id (str) – The participant ID. This SHOULD NOT include the sub- prefix.

  • output_dir (str) – Path to the output directory for xcp_d derivatives. This should not include the xcp_d folder. For example, “/path/to/dset/derivatives/”.

  • omp_nthreads (int) – Maximum number of threads an individual process may use.

  • mem_gb (float) – Memory limit, in gigabytes.

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

Inputs:
  • anat_to_template_xfm (str) – Path to the T1w-to-MNI transform file. May be “identity”, for testing purposes. The template in question should match the volumetric space of the BOLD CIFTI files being processed by the main xcpd workflow. For example, MNI152NLin6Asym for fsLR-space CIFTIs.

  • template_to_anat_xfm (str) – Path to the MNI-to-T1w transform file. May be “identity”, for testing purposes. The template in question should match the volumetric space of the BOLD CIFTI files being processed by the main xcpd workflow. For example, MNI152NLin6Asym for fsLR-space CIFTIs.

  • lh_pial_surf, rh_pial_surf (str) – Left- and right-hemisphere pial surface files in fsnative space.

  • lh_wm_surf, rh_wm_surf (str) – Left- and right-hemisphere smoothed white matter surface files in fsnative space.

Outputs:
  • lh_pial_surf, rh_pial_surf (str) – Left- and right-hemisphere pial surface files, in standard space.

  • lh_wm_surf, rh_wm_surf (str) – Left- and right-hemisphere smoothed white matter surface files, in standard space.