Nifti surface FC matrix analyses


Importage

# KF Tools and related imports
from kftools.data import fetch_file
from kftools.nifti import run_surf_parcbasedfc_ana

import nibabel as nib
from matplotlib import pyplot as plt
import seaborn as sns

Grab the data

data_dir='.'

fetch_file(data_dir=data_dir, filetype='kp-nii-hbo',
            site='snic', task='rec', subid='sub008', sesid='ses02')
nii_hbo_f = 'snic_sub008_rec_ses02_0920-1711_kp-nii-hbo.nii.gz'

Analysis and viz

Run analyses

img = nib.load(nii_hbo_f)
res = run_surf_parcbasedfc_ana(vol_dat_img=img)

surf_dat_lhrh_r,surf_dat_lhrh_roi_fc,surf_dat_lhrh_roi_fc_reorderv2,coms_order_lhrhv2,unroi_lhrh = res

Out:

/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/nilearn/surface/surface.py:684: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  return np.asarray([arr.data for arr in gifti_img.darrays]).T.squeeze()
/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/numpy/lib/function_base.py:2853: RuntimeWarning: invalid value encountered in divide
  c /= stddev[:, None]
/opt/hostedtoolcache/Python/3.8.13/x64/lib/python3.8/site-packages/numpy/lib/function_base.py:2854: RuntimeWarning: invalid value encountered in divide
  c /= stddev[None, :]



Brain plots

fig, ax = plt.subplots()
sns.heatmap(surf_dat_lhrh_roi_fc_reorderv2,cmap='cold_hot',vmin=-1,vmax=1,axes=ax)#, cmap='hot');
eg011r  nifti surf fcmat

Out:

<AxesSubplot:>

Total running time of the script: ( 0 minutes 17.621 seconds)

Gallery generated by Sphinx-Gallery