Skip to content

Fast & real time pRF mapping (Matlab)

mario.senden edited this page Jun 23, 2020 · 7 revisions

Fast / real time pRF mapping is a regression-based approach. Specifically, the BOLD signal is predicted from a linear combination of a set of basis functions encoding the effective stimulus. These basis functions are hashed Gaussians. This means that it essentially utilizes randomly placed isotropic Gaussians for encoding the stimulus but rather than using individual Gaussians, several of those are hashed together to form a single feature.

To find the weight of each feature, the tool can either use ridge regression (most useful for an offline scenario) or gradient descent (most useful for an online scenario).

Instantiation

The tool needs to be instantiated with a number of parameters:

  • f_sampling - sampling frequency of data acquisition (1 / TR)
  • n_voxels - number of voxels in data set
  • n_features - number of features
  • n_gaussians - number of Gaussian hashed together for each feature
  • fwhm - full width at half maximum of Gaussian
  • eta = learning rate (inverse of ridge regularization parameter)
parameters.f_sampling = sampling_frequency;
parameters.r_stimulus = stimulus_resolution;
parameters.n_voxels = number_of_voxels;
parameters.n_features = number_of_features;
parameters.n_gaussians = number_of_Gaussians;
parameters.fwhm = full_width_half_max;
parameters.eta = learning_rate;

hgr = HGR(parameters);

Usage

Ridge regression & gradient descent To find the weights for each feature in each voxel, it is possible to use ridge regression or gradient descent. The former can quite simply be carried out by calling the ridge function and passing all data and the effective stimulus hgr.ridge(data, stimulus);. For gradient descent, the update function needs to be called repeatedly for each time point hgr.update(data(t,:), stimulus(t,:));. Note that in contrast to the pRF tool, the stimulus needs to have dimensions time-by-pixels rather than pixels-by-time.

Voxel selection The tool has an in-built voxel selection function which performs blocked cross-validation for time-series data.