aslprep.workflows.asl.resampling module

Resampling workflows for ASLPrep.

TODO: Remove once fMRIPrep releases 23.2.0.

init_asl_surf_wf(*, mem_gb: float, surface_spaces: List[str], medial_surface_nan: bool, metadata: dict, cbf_3d: List[str], cbf_4d: List[str], att: List[str], output_dir: str, name: str = 'asl_surf_wf')[source]

Sample functional images to FreeSurfer surfaces.

For each vertex, the cortical ribbon is sampled at six points (spaced 20% of thickness apart) and averaged.

Outputs are in GIFTI format.

The two main changes for ASLPrep are: prepare_timing_parameters is dropped and DerivativesDataSink is imported outside the function. The former is because prepare_timing_parameters relies on fMRIPrep’s config, which will be uninitialized when called by ASLPrep. ASLPrep can work around this with a context manager though. The latter is because, when DerivativesDataSink is imported within the function, ASLPrep can’t use a context manager to override it with its own version. TODO: Replace with fMRIPrep workflow once DerivativesDataSink import is moved out.

I’ve made a bunch of further changes to write out CBF maps instead.

Workflow Graph

(Source code)

Parameters:
  • surface_spaces (list) – List of FreeSurfer surface-spaces (either fsaverage{3,4,5,6,} or fsnative) the functional images are to be resampled to. For fsnative, images will be resampled to the individual subject’s native surface.

  • medial_surface_nan (bool) – Replace medial wall values with NaNs on functional GIFTI files

Inputs:
  • source_file – Original BOLD series

  • subjects_dir – FreeSurfer SUBJECTS_DIR

  • subject_id – FreeSurfer subject ID

  • fsnative2t1w_xfm – ITK-style affine matrix translating from FreeSurfer-conformed subject space to T1w

Outputs:

surfaces – BOLD series, resampled to FreeSurfer surfaces

init_bold_fsLR_resampling_wf(grayord_density: Literal['91k', '170k'], omp_nthreads: int, mem_gb: float, name: str = 'bold_fsLR_resampling_wf')[source]

Resample BOLD time series to fsLR surface.

This is copied from fMRIPrep and can be replaced with an fMRIPrep import once 23.2.0 is released.

This workflow is derived heavily from three scripts within the DCAN-HCP pipelines scripts

Line numbers correspond to the locations of the code in the original scripts, found at: https://github.com/DCAN-Labs/DCAN-HCP/tree/9291324/

Workflow Graph
../_images/aslprep-workflows-asl-resampling-2.png

(Source code, png, svg, pdf)

Parameters:
  • grayord_density (str) – Either "91k" or "170k", representing the total grayordinates.

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

  • mem_gb (float) – Size of BOLD file in GB

  • name (str) – Name of workflow (default: bold_fsLR_resampling_wf)

Inputs:
  • bold_file (str) – Path to BOLD file resampled into T1 space

  • white (list of str) – Path to left and right hemisphere white matter GIFTI surfaces.

  • pial (list of str) – Path to left and right hemisphere pial GIFTI surfaces.

  • midthickness (list of str) – Path to left and right hemisphere midthickness GIFTI surfaces.

  • midthickness_fsLR (list of str) – Path to left and right hemisphere midthickness GIFTI surfaces in fsLR space.

  • sphere_reg_fsLR (list of str) – Path to left and right hemisphere sphere.reg GIFTI surfaces, mapping from subject to fsLR

  • cortex_mask (list of str) – Path to left and right hemisphere cortical masks.

  • volume_roi (str or Undefined) – Pre-calculated goodvoxels mask. Not required.

Outputs:

bold_fsLR (list of str) – Path to BOLD series resampled as functional GIFTI files in fsLR space