skbold.core.mvp_within module¶
-
class
MvpWithin
(source, read_labels=True, remove_contrast=[], invert_selection=None, ref_space='epi', statistic='tstat', remove_zeros=True, X=None, y=None, mask=None, mask_threshold=0)[source]¶ Bases:
skbold.core.mvp.Mvp
Extracts and stores subject-specific single-trial multivoxel-patterns The MvpWithin class allows for the extraction of subject-specific single-trial, multivoxel fMRI patterns from a FSL feat-directory.
Parameters: - source (str) – An absolute path to a subject-specific first-level FEAT directory.
- read_labels (bool) – Whether to read the labels/targets (i.e.
y
) from the contrast names defined in the design.con file. - remove_contrast (list) – Given that all contrasts (COPEs) are loaded from the FEAT-directory, this argument can be used to remove irrelevant contrasts (e.g. contrasts of nuisance predictors). Entries in remove_contrast do not have to literal; they may be a substring of the full name of the contrast.
- invert_selection (bool) – Sometimes, instead of loading in all contrasts and excluding some, you might want to load only a single or a couple contrasts, and exclude all other. By setting invert_selection to True, it treats the remove_contrast variable as a list of contrasts to include.
- ref_space (str) – Indicates in which ‘space’ the patterns will be stored. The default is ‘epi’, indicating that the patterns will be loaded and stored in subject-specific (native) functional space. The other option is ‘mni’, which indicates that MvpWithin will first transform contrasts to MNI152 (2mm) space before it loads them. This option assumes that a ‘reg’ directory is present in the .feat-directory, including warp-files from functional to mni space (i.e. example_func2standara.nii.gz).
- statistic (str) – Which statistic (beta = (CO)PE, tstat, zstat, etc.) from FEAT directories to use as patterns.
- remove_zeros (bool) – Whether to remove features (i.e. voxels) which are 0 across all trials (due to, e.g., being located outside the brain).
- X (ndarray) – Not necessary to pass MvpWithin, but needs to be defined as it is needed in the super-constructor.
- y (ndarray or list) – Labels or targets corresponding to the samples in
X
. This can be used when read_labels is set to False. - mask (str) – Absolute path to nifti-file that will be used as mask.
- mask_threshold (int or float) – Minimum value to binarize the mask when it’s probabilistic.
Variables: - mask_shape (tuple) – Shape of mask that patterns will be indexed with.
- nifti_header (Nifti1Header object) – Nifti-header from corresponding mask.
- affine (ndarray) – Affine corresponding to nifti-mask.
- voxel_idx (ndarray) – Array with integer-indices indicating which voxels are used in the patterns relative to whole-brain space. In other words, it allows to map back the patterns to a whole-brain orientation.
- X (ndarray) – The actual patterns (2D: samples X features)
- y (list or ndarray) – Array/list with labels/targets corresponding to samples in X.
- contrast_labels (list) – List of names corresponding to the y-values.