aslprep.interfaces.cbf module

Interfaces for calculating CBF.

class BASILCBF(**inputs)[source]

Bases: FSLCommand

Wrapped executable: oxford_asl.

Apply Bayesian Inference for Arterial Spin Labeling (BASIL).

This interface calculates: (1) arterial transit time, (2) CBF with spatial correction, (3) CBF with spatial partial volume white matter correction, and (4) CBF with spatial partial volume correction.

See https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/BASIL and https://asl-docs.readthedocs.io.

Mandatory Inputs:
  • bolus (a float or a list of items which are a float) – Bolus or tau: label duration. Maps to a command-line argument: --bolus %s.

  • deltam (a pathlike object or string representing an existing file) – ASL data after subtracting tag-control or control-tag. This matches with --iaf diff, which is the default. Maps to a command-line argument: -i %s (position: 0).

  • m0_scale (a float) – Calibration of asl. Maps to a command-line argument: --cgain %.2f.

  • mask (a pathlike object or string representing an existing file) – Mask in the same space as deltam. Maps to a command-line argument: -m %s.

  • out_basename (a pathlike object or string representing a file) – Base name of output files. Maps to a command-line argument: -o %s.

  • tis (a float or a list of items which are a float) – The list of inflow times (TIs), a comma separated list of values should be provided (that matches the order in the data).

    Note, the inflow time is the PLD plus bolus duration for pcASL (and cASL), it equals the inversion time for pASL. If the data contains multiple repeats of the same set of TIs then it is only necessary to list the unique TIs.

    When using the --tis= you can specify a full list of all TIs/PLDs in the data (i.e., as many entries as there are label-control pairs). Or, if you have a number of TIs/PLDs repeated multiple times you can just list the unique TIs in order and oxford_asl will automatically replicate that list to match the number of repeated measurements in the data. If you have a variable number of repeats at each TI/PLD then either list all TIs or use the --rpts=<csv> option (see below). Maps to a command-line argument: --tis %s.

Optional Inputs:
  • alpha (a float) – Inversion efficiency - [default: 0.98 (pASL); 0.85 (cASL)]. This is equivalent to the BIDS metadata field ‘LabelingEfficiency’. Maps to a command-line argument: --alpha %.2f.

  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value: {})

  • gm_tpm (a pathlike object or string representing an existing file) – Partial volume estimates for GM. This is just a GM tissue probability map. Maps to a command-line argument: --pvgm %s.

  • m0tr (a float) – The repetition time for the calibration image (the M0 scan). Maps to a command-line argument: --tr %.2f.

  • mzero (a pathlike object or string representing an existing file) – M0 scan. Maps to a command-line argument: -c %s.

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

  • pcasl (a boolean) – Data were acquired using cASL or pcASL labelling (pASL labeling is assumed by default). Maps to a command-line argument: --casl.

  • pvc (a boolean) – Do partial volume correction. Maps to a command-line argument: --pvcorr.

  • slice_spacing (a float) – Slice times. Maps to a command-line argument: --slicedt %s.

  • wm_tpm (a pathlike object or string representing an existing file) – Partial volume estimates for WM. This is just a WM tissue probability map. Maps to a command-line argument: --pvwm %s.

Outputs:
  • att_basil (a pathlike object or string representing an existing file) – Arterial transit time.

  • mean_cbf_basil (a pathlike object or string representing an existing file) – Cbf with spatial correction.

  • mean_cbf_gm_basil (a pathlike object or string representing an existing file) – Cbf with spatial correction.

  • mean_cbf_wm_basil (a pathlike object or string representing an existing file) – Cbf with spatial partial volume white matter correction.

class ComputeCBF(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Calculate CBF time series and mean control.

Notes

This interface calculates CBF from deltam and M0 data. It can handle single-delay and multi-delay data, single CBF volumes and CBF time series, and PASL and (P)CASL data.

Single-delay CBF, for both (P)CASL and QUIPSSII PASL is calculated according to Alsop et al.[1]. Multi-delay CBF is handled using a weighted average, based on Dai et al.[2], Wang et al.[3].

Multi-delay CBF is calculated according to Fan et al.[4], although CBF is averaged across PLDs according to the method in Juttukonda et al.[5]. Arterial transit time is estimated according to Dai et al.[2].

If slice timing information is detected, then PLDs will be shifted by the slice times.

References

Mandatory Inputs:
  • cbf_only (a boolean) – Whether data are deltam (False) or CBF (True).

  • deltam (a pathlike object or string representing an existing file) – NIfTI file containing raw CBF volume(s). These raw CBF values are the result of subtracting label volumes from control volumes, without any kind of additional scaling. This file may be 3D or 4D.

  • m0_file (a pathlike object or string representing an existing file) – M0 nifti file.

  • m0_scale (a float) – Relative scale between ASL and M0.

  • mask (a pathlike object or string representing an existing file) – Mask nifti file.

  • metadata (a dictionary with keys which are any value and with values which are any value) – Metadata for the raw CBF file, taken from the raw ASL data’s sidecar JSON file.

Outputs:
  • att (a pathlike object or string representing an existing file or None) – Arterial transit time map, in seconds. Only generated for multi-delay data.

  • cbf_ts (a pathlike object or string representing an existing file or None) – Quantitative CBF time series, in mL/100g/min. Only generated for single-delay data.

  • mean_cbf (a pathlike object or string representing an existing file) – Quantified CBF, averaged over time.

  • plds (a pathlike object or string representing an existing file or None) – Post-labeling delays. Only defined if slice-timing correction is applied.

class ExtractCBF(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Extract CBF time series by subtracting label volumes from control volumes.

TODO: Mock up test data and write tests to cover all of the branches in this interface.

Mandatory Inputs:
  • asl_file (a pathlike object or string representing an existing file) – Preprocessed asl file.

  • aslcontext (a pathlike object or string representing an existing file) – Aslcontext TSV file for run.

  • in_mask (a pathlike object or string representing an existing file) – Mask.

  • m0scan_metadata (a dictionary with keys which are any value and with values which are any value or None) – Metadata for M0 scan. Only defined if M0Type is ‘Separate’.

  • metadata (a dictionary with keys which are any value and with values which are any value) – Metadata for ASL file.

  • name_source (a pathlike object or string representing an existing file) – Raw asl file.

Optional Inputs:
  • dummy_scans (an integer) – Remove first n volumes. (Nipype default value: 0)

  • fwhm (a float) – Fwhm. (Nipype default value: 5)

  • m0scan (a pathlike object or string representing an existing file or None) – M0scan file associated with the ASL file. Only defined if M0Type is ‘Separate’.

Outputs:
  • m0_file (a pathlike object or string representing a file) – Mean M0 image, after smoothing.

  • m0tr (a float or None) – RepetitionTimePreparation for M0 scans.

  • metadata (a dictionary with keys which are any value and with values which are any value) – Metadata for the ASL run. The dictionary may be modified to only include metadata associated with the selected volumes.

  • out_file (a pathlike object or string representing a file) – Either CBF or deltaM time series.

class RefineMask(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Reduce the ASL-derived brain mask using the associated T1w mask and possibly an M0 mask.

Mandatory Inputs:
  • asl_mask (a pathlike object or string representing an existing file) – Asl mask.

  • t1w_mask (a pathlike object or string representing an existing file) – T1 mask.

Optional Inputs:

m0_mask (a pathlike object or string representing an existing file) – M0 mask (if available).

Outputs:

out_mask (a pathlike object or string representing a file) – Output mask.

class ScoreAndScrubCBF(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Apply the SCORE and SCRUB algorithms.

The Structural Correlation-based Outlier Rejection (SCORE) algorithm is applied to the CBF time series to discard CBF volumes with outlying values [6] before computing the mean CBF. The Structural Correlation with RobUst Bayesian (SCRUB) algorithm is then applied to the CBF maps using structural tissue probability maps to reweight the mean CBF [7].

References

Mandatory Inputs:
  • cbf_ts (a pathlike object or string representing an existing file) – Computed CBF from ComputeCBF.

  • csf_tpm (a pathlike object or string representing an existing file) – CSF tissue probability map.

  • gm_tpm (a pathlike object or string representing an existing file) – Gray matter tissue probability map.

  • mask (a pathlike object or string representing an existing file) – Mask.

  • wm_tpm (a pathlike object or string representing an existing file) – White matter tissue probability map.

Optional Inputs:
  • tpm_threshold (a float) – Tissue probability threshold for binarizing GM, WM, and CSF masks. (Nipype default value: 0.7)

  • wavelet_function (a string) – Wavelet function. (Nipype default value: huber)

Outputs:
  • cbf_ts_score (a pathlike object or string representing a file) – Score timeseries data.

  • mean_cbf_score (a pathlike object or string representing a file) – Average score.

  • mean_cbf_scrub (a pathlike object or string representing a file) – Average scrub.

  • score_outlier_index (a pathlike object or string representing a file) – Index of volume remove .