neuromaps.stats.compare_images

neuromaps.stats.compare_images(src, trg, metric='pearsonr', ignore_zero=True, nulls=None, nan_policy='omit')[source]

Compares images src and trg

If src and trg represent data from multiple hemispheres the data are concatenated across hemispheres prior to comparison

Parameters
  • src (str or os.PathLike or nib.GiftiImage or niimg_like or tuple) – Images to be compared

  • trg (str or os.PathLike or nib.GiftiImage or niimg_like or tuple) – Images to be compared

  • metric ({'pearsonr', 'spearmanr', callable}, optional) – Type of similarity metric to use to compare src and trg images. If a callable function is provided it must accept two inputs and return a single value (the similarity metric). Default: ‘pearsonr’

  • ignore_zero (bool, optional) – Whether to perform comparisons ignoring all zero values in src and trg data. Default: True

  • nulls (array_like, optional) – Null data for src to use in generating a non-parametric p-value. If not specified a parameteric p-value is generated. Default: None

  • nan_policy ({'propagate', 'raise', 'omit'}, optional) – Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default: ‘omit’

Returns

  • similarity (float) – Comparison metric between src and trg

  • pvalue (float) – The p-value of similarity, if nulls is not None