Perform RSA in a searchlight pattern on Nibabel Nifti-like images.
The output is a 3D Nifti image where the data at each voxel is is the RSA, computed for a patch surrounding the voxel.
New in version 0.4.
The Nitfi image data. The 4th dimension must contain the images for each item.
The model DSM, see
compute_dsm(). For efficiency, you can give it
in condensed form, meaning only the upper triangle of the matrix as a
scipy.spatial.distance.squareform(). To perform RSA
against multiple models at the same time, supply a list of model DSMs.
compute_dsm() to compute DSMs.
The spatial radius of the searchlight patch in meters. All source points within this radius will belong to the searchlight patch. Defaults to 0.01.
The metric to use to compute the DSM for the data. This can be
any metric supported by the scipy.distance.pdist function. See also the
image_dsm_params parameter to specify and additional parameter for
the distance function. Defaults to ‘correlation’.
Extra arguments for the distance metric used to compute the DSMs.
scipy.spatial.distance for a list of all other metrics
and their arguments. Defaults to an empty dictionary.
The RSA metric to use to compare the DSMs. Valid options are:
‘spearman’ for Spearman’s correlation (the default)
‘pearson’ for Pearson’s correlation
‘kendall-tau-a’ for Kendall’s Tau (alpha variant)
‘partial’ for partial Pearson correlations
‘partial-spearman’ for partial Spearman correlations
‘regression’ for linear regression weights
Defaults to ‘spearman’.
Whether to treat NaN’s as missing values and ignore them when computing
the distance metric. Defaults to
New in version 0.8.
For each source estimate, a number indicating the item to which it
None, each source estimate is assumed to belong to a
different item. Defaults to
Number of cross-validation folds to use when computing the distance
metric. Folds are created based on the
y parameter. Specify
None to use the maximum number of folds possible, given the data.
Alternatively, you can pass a Scikit-Learn cross validator object (e.g.
sklearn.model_selection.KFold) to assert fine-grained control over
how folds are created.
Defaults to 1 (no cross-validation).
When set, searchlight patches will only be generated for the subset of
voxels with non-zero values in the given mask. This is useful for
restricting the analysis to a region of interest (ROI). Note that while
the center of the patches are all within the ROI, the patch itself may
extend beyond the ROI boundaries.
None, in which case patches for all voxels are
When set, searchlight patches are restricted to only contain voxels
with non-zero values in the given mask. This is useful for make sure
only information from inside the brain is used. In contrast to the
roi_mask, searchlight patches will not use data outside of this mask.
None, in which case all voxels are included in the
The number of processes (=number of CPU cores) to use. Specify -1 to use all available cores. Defaults to 1.
Whether to display a progress bar. In order for this to work, you need the tqdm python module installed. Defaults to False.
The correlation values for each searchlight patch. When multiple models have been supplied, a list will be returned containing the RSA results for each model.