mbfmri.utils.coef2map

mbfmri.utils.coef2map.reconstruct(array, mask)

reconstruct flattened array to 3D with the given mask.

Parameters
  • array (numpy.ndarray) – array with shape of (N,) or (N,1)

  • mask (numpy.ndarray) – 3D binary mask where sum(mask)==N

Returns

numpy.ndarray – Reconstructed 3D array

mbfmri.utils.coef2map.cluster_level_correction(brainmap, threshold, cluster_threshold)

thresholding and cluster-level correction

Parameters
  • brainmap (nibabel.nifti1.Nifti1Image) – Nii image to be thresholded and cluster-level corrected.

  • threshold (float) – Threshold value to cutoff the image Both negative and positie values will be zero if abs(v) <= threshold

  • cluster_threshold (int) – Threshold for the number of points in a cluster to be cutoff

Returns

nibabel.nifti1.Nifti1Image – Thresholded and cluster-level corrected nii image.

mbfmri.utils.coef2map.get_map(coefs, voxel_mask, experiment_name, standardize=True, save_path='.', smoothing_fwhm=0, threshold=0, cluster_threshold=0)

make nii image file from coefficients of model.

Parameters
  • coefs (list of numpy.array or numpy.array) – List of coefficients extracted from MVPA models

  • voxel_mask (nibabel.nifti1.Nifti1Image) – Nii image of mask

  • experiment_name (str) – Name of experiment. It will be used to name the resulting image.

  • standardize (bool, default=False) – Indicate if resulting brain map is required to be standardized.

  • save_path (str or pathlib.PosixPath) – Path to save created map.

  • smoothing_fwhm (float, default=0) – Size in millimeters of the spatial smoothing of each reconstructed map.

  • threshold (float, default=0) – Threshold value for thresholding resulting image.

  • cluster_threshold (int, default=0) – Threshold for the number of points in a cluster to be cutoff resulting image.

Returns

  • nibabel.nifti1.Nifti1Image – Nii file for resulting brain map.

  • pathlib.PosixPath – Path where the resulting image is saved.