# Processing pipeline details

*ASLPrep* [1][2]
adapts its pipeline depending on what data and metadata are available and are used as inputs.
It requires the input data to be BIDS-valid and include necessary ASL parameters.

## Structural Preprocessing

The anatomical sub-workflow is from sMRIPrep. It first constructs an average image by conforming all found T1w images to a common voxel size, and, in the case of multiple images, averages them into a single reference template.

See also *sMRIPrep*’s
`init_anat_preproc_wf()`

.

### Brain extraction, brain tissue segmentation and spatial normalization

Next, the T1w reference is skull-stripped using a Nipype implementation of
the `antsBrainExtraction.sh`

tool (ANTs), which is an atlas-based
brain extraction workflow:

An example of brain extraction is shown below:

Once the brain mask is computed, FSL `fast`

is used for brain tissue segmentation.

Finally, spatial normalization to standard spaces is performed using ANTs’ `antsRegistration`

in a multiscale, mutual-information based, nonlinear registration scheme.
See Standard and nonstandard spaces for more information on how standard and nonstandard spaces can
be set to resample the preprocessed data onto the final output spaces.

## ASL preprocessing

Preprocessing of ASL files is split into multiple sub-workflows described below.

### ASL reference image estimation

This workflow estimates a reference image for an
ASL series.
The reference image is then used to calculate a brain mask for the
ASL signal using *NiWorkflow’s*
`init_enhance_and_skullstrip_asl_wf()`

.
Subsequently, the reference image is fed to the head-motion estimation
workflow and the registration workflow to map the
ASL series onto the T1w image of the same subject.

### Head-motion estimation

Using the previously estimated reference scan,
FSL `mcflirt`

or AFNI `3dvolreg`

is used to estimate head-motion.
As a result, one rigid-body transform with respect to
the reference image is written for each ASL
time-step.
Additionally, a list of 6-parameters (three rotations and
three translations) per time-step is written and fed to the
confounds workflow,
for a more accurate estimation of head-motion.

### Confounds estimation

Calculated confounds include framewise displacement, 6 motion parameters, and DVARS.

### Susceptibility Distortion Correction (SDC)

One of the major problems that affects ASL data is the spatial distortion caused by the inhomogeneity of the field inside the scanner. Please refer to the SDCFlows documentation for details on the available workflows.

See also *SDCFlows*’ `init_sdc_estimate_wf()`

### Preprocessed ASL in native space

A new *preproc* ASL series is generated
from the original data in the original space.
All volumes in the ASL series are
resampled in their native space by concatenating the mappings found in previous correction workflows
(HMC and SDC, if executed)
for a one-shot interpolation process.
Interpolation uses a Lanczos kernel.

## CBF Computation in native space

ASL data consist of multiple pairs of labeled and control images.
*ASLPrep* first checks for proton density-weighted volume(s) (M0 scans).
In the absence of M0 images or an M0 estimate provided in the metadata,
the average of control images is used as the reference image.

After preprocessing, the pairs of labeled and control images are subtracted:

### Single-Delay ASL

The CBF computation of single-delay (post labeling delay) ASL data is done using a one-compartment model [3].

#### (Pseudo-)Continuous ASL

For (P)CASL ([pseudo-]continuous ASL), CBF is calculated using a general kinetic model [6].

\(\tau\), \(\lambda\), \(\alpha\), and \(w\) are labeling duration, brain-blood partition coefficient, labeling efficiency, and post-labeling delay (PLD), respectively.

In the absence of any of these parameters, standard values are used based on the scan type and scanning parameters.

The element which differentiates single-delay PCASL’s CBF calculation from the PASL equivalents is \(T1_{blood} \cdot (1 - e^{\frac{ - \tau }{ T1_{blood} } })\).

#### Pulsed ASL

Currently, ASLPrep does not support PASL data without a bolus cut-off technique applied.

##### QUIPSS Modification

For pulsed ASL (PASL) data with the QUIPSS bolus cut-off technique,
the formula from Wong *et al.*[7] is used.

where \(\Delta{TI}\) is the post-labeling delay (PLD) minus the bolus cutoff delay time.

Given that \(TI\) is equivalent to \(w\) in BIDS datasets
(i.e., as the `PostLabelingDelay`

field),
the formula for QUIPSS is the same as PCASL,
except \(\Delta{TI}\) replaces
\(T1_{blood} \cdot (1 - e^{\frac{ - \tau }{ T1_{blood} } })\).

##### QUIPSS II Modification

For PASL data with the QUIPSS II bolus cut-off technique,
the formula from Alsop *et al.*[3] is used.

where \(TI_{1}\) is the bolus cutoff delay time.

Note that the formula for QUIPSS II is the same as the one for QUIPSS, except \(TI_{1}\) replaces \(\Delta{TI}\).

##### Q2TIPS Modification

For PASL data with the Q2TIPS bolus cut-off technique,
the formula from the commercial Q2TIPS CBF calculation is used,
as described in Noguchi *et al.*[8].

where \(TI_{1}\) is the first bolus cutoff delay time and \(TI_{2}\) is the last bolus cutoff delay time.

Note that the formula for Q2TIPS is the same as QUIPSS II, except \(TI_{2}\) replaces \(TI\) in the numerator.

### Multi-Delay ASL

In multi-delay ASL, control-label pairs are acquired for multiple post-labeling delay values. This type of acquisition requires more complicated models, but it also results in more accurate CBF estimates. Also, multi-delay ASL allows for the estimation of arterial transit time (ATT).

#### Pseudo-Continuous ASL

For multi-delay PCASL data, the following steps are taken:

\(\Delta{M}\) values are first averaged over time for each unique post-labeling delay value. We shall call these \(\Delta{M}\) in the following equations for the sake of readability.

Arterial transit time is estimated on a voxel-wise basis according to Dai

*et al.*[9].Define a set of possible transit times to evaluate. The range is defined as the minimum PLD to the maximum PLD, at increments of 0.001.

Calculate the expected weighted delay (\(WD_{E}\)) for each possible transit time (\(\delta\)), across PLDs (\(w\)).

\[ \begin{align}\begin{aligned}WD_{E}(\delta_{t}, w_{i}) = e ^ \frac{ -\delta_{t} } { T_{1,blood} } \cdot \left[ e ^ {-\frac{ max( 0, w_{i} - \delta_{t} ) } { T_{1,tissue} }} - e ^ {-\frac{ max( 0, \tau + w_{i} - \delta_{t} ) } { T_{1,tissue} }} \right]\\WD_{E}(\delta_{t}) = \frac{ \sum_{i=1}^{|w|} w_{i} \cdot WD_{E}(\delta_{t},w_{i}) } { \sum_{i=1}^{|w|} WD_{E}(\delta_{t},w_{i}) }\end{aligned}\end{align} \]Calculate the observed weighted delay (\(WD_{O}\)) for the actual data, at each voxel \(v\).

\[WD_{O}(v) = \frac{ \sum_{i=1}^{|w|} w_{i} \cdot \Delta{M}( w_{i},v ) } { \sum_{i=1}^{|w|} \Delta{M}( w_{i},v ) }\]Truncate the observed weighted delays to valid delay values, determined based on the expected weighted delays.

\[WD_{O}(v) = max[min(WD_{O}(v), max[WD_{E}]), min(WD_{E})]\]Interpolate the expected weighted delay values to infer the appropriate transit time for each voxel, based on its observed weighted delay.

CBF is then calculated for each unique PLD value (\(w_{i}\)) using the 2-compartment model described in Fan

*et al.*[10].\[CBF_{i} = 6000 \cdot \lambda \cdot \frac{ \Delta{M}_{i} }{ M_{0} } \cdot \frac{ e ^ \frac{ \delta }{ T_{1,blood} } } { 2 \cdot \alpha \cdot T_{1,blood} \cdot \left[ e ^ { -\frac{ max(w_{i} - \delta, 0) }{ T_{1,tissue} } } - e ^ { -\frac{ max(\tau + w_{i} - \delta, 0) }{ T_{1,tissue} } } \right] }\]Note

Note that Equation 2 in Fan

*et al.*[10] uses different notation. \(T_{1,blood}\) is referred to as \(T_{1a}\), \(T_{1,tissue}\) is referred to as \(T_{1t}\), \(\Delta{M}\) is referred to as \(M\), \(w\) is referred to as \(PLD\), \(\delta\) is referred to as \(ATT\), \(\tau\) is referred to as \(LD\), and \(\alpha\) is referred to as \(\epsilon\).CBF is then averaged over PLDs according to Juttukonda

*et al.*[11], in which an unweighted average is calculated for each voxel across all PLDs (\(w\)) in which \(w + \tau \gt \delta\).

#### Pulsed ASL

Warning

As of 0.3.0, ASLPrep has disabled multi-delay support for PASL data. We plan to properly support multi-delay PASL data in the near future.

### Additional Denoising Options

For cases where data may be especially noisy (e.g., due to motion or a low-SNR protocol), ASLPrep includes options to additionally denoise CBF estimates.

The two current options are SCORE/SCRUB and BASIL.

#### SCORE and SCRUB

ASLPrep includes the ability to denoise CBF with SCORE and SCRUB.

Structural Correlation based Outlier Rejection (SCORE) [12] detects and discards extreme outliers in the CBF volume(s) from the CBF time series. SCORE first discards CBF volumes whose CBF within grey matter (GM) means are 2.5 standard deviations away from the median of the CBF within GM. Next, it iteratively removes volumes that are most structurally correlated to the intermediate mean CBF map unless the variance within each tissue type starts increasing (which implies an effect of white noise removal as opposed to outlier rejection).

The mean CBF after denoising by SCORE is plotted below

After discarding extreme outlier CBF volume(s) (if present) by SCORE, SCRUB (Structural Correlation with RobUst Bayesian) uses robust Bayesian estimation of CBF using iterative reweighted least square method [13] to denoise CBF. The SCRUB algorithm is described below:

\(CBF_{t}\), \(\mu\), \(\theta\), and \(p\) equal CBF time series (after any extreme outliers are discarded by SCORE), mean CBF, ratio of temporal variance at each voxel to overall variance of all voxels, and probability tissue maps, respectively. Other variables include \(\lambda\) and \(\rho\) that represent the weighting parameter and Tukey’s bisquare function, respectively.

An example of CBF denoised by SCRUB is shown below.

#### BASIL

*ASLPrep* also includes the option to compute CBF using BASIL.

Bayesian Inference for Arterial Spin Labeling (BASIL) is an FSL tool for CBF estimation.

BASIL implements a simple kinetic model as described above, but uses Bayesian inference principles [14]. BASIL is mostly suitable for multi-delay ASL data. It includes bolus arrival time estimation with spatial regularization [15] and the correction of partial volume effects [16].

A sample of BASIL CBF with spatial regularization is shown below:

The CBF map shown below is the result of partial volume corrected CBF computed by BASIL.

## Quality control measures

Quality control (QC) measures such as FD (framewise displacement), coregistration, normalization index, and quality evaluation index (QEI) are included for all CBF maps. The QEI [17] evaluates the quality of the computed CBF maps considering three factors: structural similarity, spatial variability, and percentage of voxels in GM with negative CBF.

## ASL and CBF to T1w registration

*ASLPrep* uses the `FSL BBR`

routine to calculate the alignment between each run’s
ASL reference image and the reconstructed subject using the
gray/white matter boundary.

FSL `flirt`

is run with the BBR cost function, using the
`fast`

segmentation to establish the gray/white matter boundary.
After BBR is run,
the resulting affine transform will be compared to the initial transform found by `flirt`

.
Excessive deviation will result in rejection of the BBR refinement and acceptance
of the original affine registration.
The computed CBF is registered to T1w using the transformation from ASL-T1w
registration.

### Resampling ASL and CBF runs onto standard spaces

This sub-workflow concatenates the transforms calculated upstream
(see Head-motion estimation, Susceptibility Distortion Correction (SDC))
if fieldmaps are available, and an anatomical-to-standard transform from
Structural Preprocessing to map the ASL and CBF images to the standard spaces is given by the
`--output-spaces`

argument (see Standard and nonstandard spaces).
It also maps the T1w-based mask to each of those standard spaces.

Transforms are concatenated and applied all at once, with one interpolation (Lanczos) step, so as little information is lost as possible.