4.5. Preprocess#

4.5.1. Description#

The Preprocess is an object meant for pre-processing before or after Marker step depending on the use-case. For example, you might want to perform confound removal on BOLD data before feature extraction.

Note

This step is optional for the pipeline to work.

4.5.2. Confound Removal#

This step is meant to remove confounds from the BOLD data. The confounds are extracted from the BOLD_confounds data (must be provided by the Data Grabber). The confounds are then regressed out from the BOLD data using nilearn.image.clean_img().

Currently, junifer supports only one confound removal class: fMRIPrepConfoundRemover. This class is meant to remove confounds as described before, using the output of fMRIPrep as reference.

Strategy#

This confound remover uses the nilearn API from nilearn.interfaces.fmriprep.load_confounds(). That is, define a strategy to extract the confounds from the BOLD_confounds data. The strategy is defined by choosing the noise components to be used and the confounds to be extracted from each noise components. The noise components currently supported are:

  • motion

  • wm_csf

  • global_signal

The confounds options for each noise component are:

  • basic: the basic confounds for each noise component. For example, for motion, the basic confounds are the 6 motion parameters (3 translations and 3 rotations). For wm_csf, the basic confounds are the mean signal of the white matter and CSF regions. For global_signal, the basic confound is the mean signal of the whole brain.

  • power2: the basic confounds plus the square of each basic confound.

  • derivatives: the basic confounds plus the derivative of each basic confound.

  • full: the basic confounds, the derivative of each basic confound, the square of each basic confound and the square of each derivative of each basic confound.

The strategy is defined as a dictionary, with the noise components as keys and the confounds as values.

Example in python format:

strategy = {
    "motion": "basic",
    "wm_csf": "full",
    "global_signal": "derivatives"
}

or in YAML format:

strategy:
    motion: basic
    wm_csf: full
    global_signal: derivatives

The default value is to use all the noise components with the full confounds:

strategy = {
    "motion": "full",
    "wm_csf": "full",
    "global_signal": "full"
}

Other Parameters#

Additionally, the fMRIPrepConfoundRemover supports the following parameters:

Parameter

Description

Default

spike

Add a spike regressor in the timepoints when the framewise
displacement exceeds this threshold.

deactivated

detrend

Apply detrending on timeseries, before confound removal.

activated

standardize

Scale signals to unit variance.

activated

low_pass

Low cutoff frequencies, in Hertz.

deactivated

high_pass

High cutoff frequencies, in Hertz.

deactivated

t_r

Repetition time, in second (sampling period).

from NIfTI header

mask

If provided, signal is only cleaned from voxels inside the mask.
If not, a mask is computed using

compute

4.5.3. Warping or Transformation to other spaces#

junifer can also warp or transform any supported data type from the template space provided by the dataset (e.g., MNI152NLin6Asym) to either the subject’s native space or to any other template space (e.g., MNI152NLin2009cAsym). This functionality is provided by SpaceWarper and depends on external tools like FSL and / or ANTs.

Warping to subject’s native space#

To warp to subject’s native space, the dataset needs to provide T1w and Warp data types and the DataGrabber needs to at least have ["BOLD", "T1w", "Warp"] (if you are warping BOLD) as the types parameter’s value. The SpaceWarper’s reference parameter needs to be set to T1w, which means that the BOLD data will be transformed using the T1w as reference (it’s resampled internally to match the resolution of the BOLD). The Warp data type is new and it’s only purpose is to provide the warp or transformation file (can be linear, non-linear or linear + non-linear transform) for the purpose. For using parameter, you can pass either "fsl" or "ants" depending on the warp or transformation file format.

An example YAML might look like this:

preprocess:
   - kind: SpaceWarper
     using: fsl
     reference: T1w

Warping to other template space#

In a situation where your dataset might provide the BOLD data (or any other data type that you want to work on) in MNI152NLin6Asym template space but you would like to compute features in MNI152NLin2009cAsym template space, you can also use the SpaceWarper by setting the reference parameter to the template space’s name, in this case, reference="MNI152NLin2009cAsym". The using parameter needs to be set to "ants" as we need it to warp the data.

Note

We only support template spaces provided by templateflow and the naming is similar except that we omit the tpl- prefix used by templateflow.

For an YAML example:

preprocess:
   - kind: SpaceWarper
     using: ants
     reference: MNI152NLin2009cAsym