Skip to contents

Given the path to a preprocessed NIfTI file from fMRIPrep or fMRIPost, this function identifies and returns associated derivative files in the same directory. This includes the corresponding brain mask, confound regressors, ICA-AROMA melodic mixing matrix, AROMA classification metrics, and a list of rejected noise components (if available).

Usage

get_fmriprep_outputs(in_file)

Arguments

in_file

A character string giving the path to a preprocessed NIfTI .nii.gz file generated by fMRIPrep (e.g., with suffix _desc-preproc_bold.nii.gz).

Value

A named list containing the following elements:

bold

The input BOLD file path (returned if found).

brain_mask

The corresponding brain mask file (or NULL if not found).

confounds

The path to the confounds .tsv file (or NULL).

melodic_mix

Path to the melodic mixing matrix from ICA-AROMA (if present).

aroma_metrics

Path to the AROMA classification metrics file (if present).

noise_ics

A vector of rejected ICA components based on AROMA classification (or NULL).

prefix

A string encoding the core BIDS identifier used to construct expected filenames.

Details

This function assumes filenames follow BIDS Derivatives conventions and uses the extracted BIDS entities to reconstruct expected filenames via construct_bids_filename().

The function checks for two possible confounds files (desc-confounds_timeseries.tsv and desc-confounds_regressors.tsv), and attempts to resolve AROMA-rejected ICs from the AROMA classification metrics file (_desc-aroma_metrics.tsv) if present.

Examples

if (FALSE) { # \dontrun{
f <- "/path/to/sub-01_task-rest_space-MNI152NLin6Asym_desc-preproc_bold.nii.gz"
outputs <- get_fmriprep_outputs(f)
outputs$brain_mask
} # }