mne_rsa.rdm_nifti#
- mne_rsa.rdm_nifti(image, spatial_radius=0.01, dist_metric='correlation', dist_params={}, y=None, n_folds=1, roi_mask=None, brain_mask=None, n_jobs=1, verbose=False)[source]#
Generate RDMs in a searchlight pattern on Nibabel Nifty-like images.
RDMs are computed using a patch surrounding each voxel.
New in version 0.4.
- Parameters:
- image4D Nifti-like image
The Nitfi image data. The 4th dimension must contain the images for each item.
- spatial_radiusfloat
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.
- dist_metricstr
The metric to use to compute the RDM for the data. This can be any metric supported by the scipy.distance.pdist function. See also the
dist_params
parameter to specify and additional parameter for the distance function. Defaults to ‘correlation’.- dist_paramsdict
Extra arguments for the distance metric used to compute the RDMs. Refer to
scipy.spatial.distance
for a list of all other metrics and their arguments. Defaults to an empty dictionary.- yndarray of int, shape (n_items,) | None
For each source estimate, a number indicating the item to which it belongs. When
None
, each source estimate is assumed to belong to a different item. Defaults toNone
.- n_foldsint | sklearn.model_selection.BaseCrollValidator | None
Number of cross-validation folds to use when computing the distance metric. Folds are created based on the
y
parameter. SpecifyNone
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).- roi_mask3D Nifti-like image | None
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. Defaults to
None
, in which case patches for all voxels are generated.- brain_mask3D Nifti-like image | None
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. Defaults to
None
, in which case all voxels are included in the analysis.- n_jobsint
The number of processes (=number of CPU cores) to use. Specify -1 to use all available cores. Defaults to 1.
- verbosebool
Whether to display a progress bar. In order for this to work, you need the tqdm python module installed. Defaults to False.
- Yields:
- rdmndarray, shape (n_items, n_items)
A RDM for each searchlight patch.