Skip to content

BOLD signal deconvolution based on ridge regression. Can be used to calculate psycho-physiological interaction (PPI) at the neuronal level. Python and MATLAB functions recover neuronal time series, similar to the Parametric Empirical Bayes (PEB) approach implemented in SPM12 (spm_peb_ppi.m).

License

Notifications You must be signed in to change notification settings

IHB-IBR-department/BOLD_deconvolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fMRI BOLD signal deconvolution

This repository provides Python and MATLAB functions to perform hemodynamic deconvolution of preprocessed BOLD signals into estimated neuronal time series. The deconvolution process is based on temporal basis set (dy default: discrete cosine set) and ridge regression. More details can be found in the Masharipov et al. "Comparison of whole-brain task-modulated functional connectivity methods for fMRI task connectomics." Commun Biol 7, 1402 (2024). If you employ this code, please cite the referenced study.

Python function: ridge_regress_deconvolution

The ridge_regress_deconvolution function deconvolves a preprocessed BOLD signal into neuronal time series without using confound regressors (e.g., motion) and without performing whitening and temporal filtering. The input BOLD signal must already be preprocessed.

Parameters

BOLD(np.ndarray): Preprocessed BOLD signal (numpy array).
TR (float): Time repetition in seconds.
alpha (float, optional, default=0.005): Regularization parameter for ridge regression.
NT (int, optional, default=16): Microtime resolution (number of time bins per scan).
xb (np.ndarray, optional, default: discrete cosine set): Temporal basis set in microtime resolution.
Hxb (np.ndarray, optional, default: discrete cosine set convolved with canonical HRF): Convolved temporal basis set in scan resolution.

Returns: Deconvolved neuronal time series (np.ndarray)

Basic usage

import numpy as np
from bold_deconvolution import ridge_regress_deconvolution,  compute_xb_Hxb


# Example usage
preprocessed_BOLD = np.load('path_to_preprocessed_BOLD.npy')
TR = 2.0
NT = 16
alpha = 0.005

neuronal_activity = ridge_regress_deconvolution(BOLD=preprocessed_BOLD, TR=TR, alpha=alpha, NT=NT)

# If we deconvolve multiple BOLD-time series from the same session,
# we can precompute cosine basis set to speed up computations 
# (since we are using the same basis set for all time series)
xb, Hxb = compute_xb_Hxb(len(preprocessed_BOLD), NT, TR)

neural_time_series = ridge_regress_deconvolution(preprocessed_BOLD, TR, alpha, NT, xb=xb, Hxb=Hxb)

Jupyter notebook examples

See usage example in usage_example.ipynb

MATLAB function: bold_deconvolution

The bold_deconvolution function deconvolves a preprocessed BOLD signal into neuronal time series without using confound regressors (e.g., motion) and without performing whitening and temporal filtering. The input BOLD signal must already be preprocessed.

Parameters

BOLD - Preprocessed BOLD signal (time points X ROIs)
TR - Time repetition, [s]

Optional:

alpha - Regularization parameter (default: 0.005)
NT - Microtime resolution (number of time bins per scan)(default: 16)
par - Parallel or sequential computations (default: 0)
xb - Temporal basis set in microtime resolution (default: discrete cosine set)
Hxb - Convolved temporal basis set in scan resolution (default: discrete cosine set convolved with canonical HRF)

Basic usage

% Load preprocessed BOLD signal
BOLD = load(preprocessed_BOLD.mat).

% Setup variables
TR = 2;                          % Time repetition, [s]
NT = 16;                         % Microtime resolution (number of time bins per scan)
alpha = 0.005;                   % Regularization parameter

%% Run BOLD deconvolution function
neuro = bold_deconvolution(BOLD,TR,alpha,NT);

MATLAB examples

See usage example in usage_example.m

About

BOLD signal deconvolution based on ridge regression. Can be used to calculate psycho-physiological interaction (PPI) at the neuronal level. Python and MATLAB functions recover neuronal time series, similar to the Parametric Empirical Bayes (PEB) approach implemented in SPM12 (spm_peb_ppi.m).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages