func processing

This module performs all pre-processing of a subject’s task or resting-state functional MRI (fMRI) scans, in preparation for the sampling of regional timeseries and construction of functional connectomes. This pipeline is optimized for spin-echo images with reverse phase encoding used for distortion correction and multi echo acquisitionstions. The pipeline is mainly based on tools from FSL and AFNI for volumetric processing, and FreeSurfer and Workbench for surface-based mapping. For increased functionality, micapipe can also handle protocols in which a single fieldmap is acquired.

../../_images/sankey_proc_func.png

-proc_func

Prerequisites 🖐🏼

You need to run -proc_structural, -proc_surf and -post_structural before this stage

../../_images/proc_rsfmri.png

Important

There is NO inherent smoothing applied to the fMRI data. If the user desires smoothing, they should customize it according to their preferences and requirements.

Warning

Nuisance Regression Only the functional connectomes and time series containing the string clean include these confound regressors. All other time series mapped to the surface do not have nuisance regression applied.

  1. Drop initial volumes: Remove the first five TRs (optional, only if -dropTR flag is specified).

  2. Reorient images: Reorient input fMRI data to LPI orientation.

  3. Motion correction: Register each fMRI volume to the scan’s own mean image and apply correction using within-run motion estimates and provided fieldmaps.

  4. Motion outliers: Detect framewise motion outliers (spikes), and save outlier regressors for later nuisance regression.

  5. Distortion correction: Apply distortion correction to motion-corrected images.

  6. Masking: Compute a binary brain mask from motion- and distortion-corrected volume.

  7. Multi-echo denoising (if applicable): If data are multi-echo, run TEDANA for echo combination and denoising.

  8. Temporal filtering: High-pass filter functional timeseries to remove frequencies below 0.01 Hz.

  9. Independent component analysis (optional): Run MELODIC (ICA) on filtered timeseries.

  10. Nonlinear registration: Compute nonlinear transforms between fMRI space and T1-nativepro space.

  11. ICA-based denoising (optional): Run ICA-FIX with specified training file. If ICA-FIX is not found, or MELODIC failed, skip ICA-FIX and continue using the high-pass filtered timeseries.

  12. Transform timeseries to functional space: Apply transformations to resample minimally preprocessed timeseries (T1nativepro_2mm) into functional space.

  13. Extract global and tissue-specific signals: Compute mean timeseries from CSF, gray matter, and white matter probability maps. Compute global signal from the brain mask. Save each as text files.

  14. Compute motion confounds: Detect additional motion spikes (framewise reference metrics). Save spike regressors.

  15. Map to native surface (fsnative): Register subject’s cortical surface to functional space. Map functional timeseries from volume to fsnative surface (L/R hemispheres).

  16. Resample to standard surfaces: Resample fsnative timeseries to fsLR-5k, fsLR-32k, and fsaverage5.

  17. Temporal SNR (tSNR): Compute volumetric tSNR (mean ÷ std). Project tSNR to fsnative surface (per hemisphere).

  18. Subcortical timeseries: Transform subcortical segmentation to functional space. Extract mean timeseries for each subcortical structure.

  19. Cerebellar timeseries: Transform cerebellar segmentation to functional space. Extract mean timeseries for each cerebellar structure (excluding very small nuclei). Compute ROI statistics.

  20. Concatenate timeseries: Align and concatenate cerebellar, subcortical, and cortical parcellated timeseries.

  21. Nuisance regression: Always regress motion spikes.
    • Optional flags:

    • -NSR → regress tissue-specific signals and six motion parameters.

    • -GSR → regress global signal.

  22. Save outputs: Save cleaned timeseries in two formats Vertexwise cortical timeseries (fsLR-32k) + cerebellar + subcortical and Parcellated cortical timeseries + cerebellar + subcortical.

  23. Functional connectivity: Cross-correlate parcellated timeseries across all regions. Save the resulting correlation matrix. If -noFC flag is set, skip this step.