Predict brain network disruption from a lesion mask. Original concept described in Kuceyeski 2013.
NEW! Cloud interface for this tool can be used here: https://kuceyeski-wcm-web.s3.amazonaws.com/nemo/index.html
The general workflow for this tool consists of a database generation stage and a lesion disconnectivity stage:
$FSLDIR/data/standard/MNI152_T1_1mm.nii.gz
, or website/atlases/MNI152_T1_1mm_brain.nii.gz)
We have created a user-friendly web interface to run this tool in the cloud (AWS):
chacoconn
and 420-subject *_allref.pkl
chacovol_allref
can be as large as 700MB, and chacoconn_allref
can be 10s of GBchacovol
= voxelwise or regionwise ChaCo ratio
chacoconn
= pairwise ChaCo ratio of loss of connections between pairs of voxels and/or ROIs
_chacovol_(mean|stdev)
= mean and stdev of all 420 HCP-subject ChaCo ratio maps (for voxelwise outputs, these are .nii.gz files)
_chacoconn_(mean|stdev)
= mean and stdev of all 420 HCP-subject pairwise disconnectivity maps
_nemoSC[_sift2][volnorm]\(mean|stdev)
= mean and stdev of predicted pairwise structural connectivity after removing disconnected streamlines for all 420 HCP-subject.
_sift2
and _volnorm
indicate whether SIFT2 weighting and/or volume normalization was applied to the estimated connectomes.chacovol_allref.pkl
= ChaCo ratio map for each of the 420 HCP reference subjects
chacoconn_allref.pkl
= ChaCo ratio map for each of the 420 HCP reference subjects
*_allref_denom.pkl
= denominator of the ChaCo ratio for each subject (useful when recomputing ChaCo numerator and denominator for reparcellating ratios)
*.pkl
are Python pickle format that can be read using:
import pickle; data = pickle.load(open("filename.pkl","rb"))
*.npz
are SciPy sparse matrices that can be read using:
import numpy as np; from scipy import sparse; data = sparse.load_npz("filename.npz")
To convert outputs to another format, you will need to use Python. See examples below.
import pickle
import numpy as np
data = pickle.load(open("mylesion_chacovol_mean.pkl","rb"))
#data contains a single ROIxROI matrix
np.savetxt("mylesion_chacovol_mean.txt",data,delimiter="\t")
#or save as .mat
from scipy.io import savemat
savemat("mylesion_chacovol_mean.mat",{"data":data})
# (load in matlab with M=load("mylesion_chacovol_mean.mat"); data=M.data;)
#NOTE: chacoconn files are *SPARSE* format and must be converted to *DENSE* before saving to text using data.toarray()
import pickle
import numpy as np
data = pickle.load(open("mylesion_chacoconn_mean.pkl","rb"))
np.savetxt("mylesion_chacoconn_mean.txt",data.toarray(),delimiter="\t")
#or save dense/full matrix to matlab .mat:
from scipy.io import savemat
savemat("mylesion_chacoconn_mean.mat",{"data":data.toarray()})
# (load in matlab with M=load("mylesion_chacoconn_mean.mat"); data=M.data;)
#sparse chacoconn outputs *CAN* be saved as sparse format in .mat files *ONLY IF* you convert them to np.double:
from scipy.io import savemat
savemat("mylesion_chacoconn_mean_sparse.mat",{"data":data.astype(np.double)})
# (load in matlab with M=load("mylesion_chacoconn_mean_sparse.mat"); data=M.data; or data=full(M.data); ... )
#These files contain SPARSE matrices, so we need to either convert them to dense:
import pickle
import numpy as np
from scipy.io import savemat
data = pickle.load(open("mylesion_chacovol_fs86subj_allref.pkl","rb"))
savemat("mylesion_chacovol_fs86subj_allref.mat",{"allref":data.toarray()})
# (load in matlab with M=load("mylesion_chacovol_fs86subj_allref.mat"); allref=M.allref;)
#or save as sparse after converting to np.double:
savemat("mylesion_chacovol_fs86subj_allref_sparse.mat",{"allref":data.astype(np.double)})
# (load in matlab with M=load("mylesion_chacovol_fs86subj_allref.mat"); allref=M.allref; or allref=full(M.allref); ...)
#These files contain LISTS of SPARSE matrices, so we need to either
#a) convert them all to dense and stack them into 3D:
import pickle
import numpy as np
from scipy.io import savemat
data = pickle.load(open("mylesion_chacoconn_fs86subj_allref.pkl","rb"))
allref=np.stack([x.toarray() for x in data], axis=2) #creates an 86x86x420 3D matrix
savemat("mylesion_chacoconn_fs86subj_allref.mat",{"allref":allref})
# (load in matlab with M=load("mylesion_chacoconn_fs86subj_allref.mat"); allref=M.allref;)
#or b) save as a cell array of of sparse matrices to save space, but you MUST convert to np.double:
allref=[x.astype(np.double) for x in data]
savemat("mylesion_chacoconn_fs86subj_allref_sparse.mat",{"allref":allref})
# (load in matlab with M=load("mylesion_chacoconn_fs86subj_allref.mat"); allref=M.allref; allref_subj1=M.allref{1}; allref_subj1_full=full(M.allref{1}); ...)
#chacoconn_mean is a VOXELSxVOXELS pairwise matrix, where chacoconn_mean[i,:] represents
# a VOLUME of disconnectivity to from voxel i to all other voxels
import pickle
import numpy as np
import nibabel as nib
from nilearn import plotting
#read the corresponding chacovol_resXmm_mean.nii.gz output which defines the output dimensions
Vref = nib.load("mylesion_chacovol_res5mm_mean.nii.gz")
data = pickle.load(open("mylesion_chacoconn_res5mm_mean.pkl","rb"))
#for this demonstration, find the voxel with the largest total disconnectivity, convert that row
#of the chacoconn output to a volume, and visualize that volume
data_sum=np.sum(data,axis=0)+np.sum(data,axis=1).T #data is upper triangular so we need to sum across both dimensions
voxel_index=np.argmax(data_sum)
newdata=data[voxel_index,:]+data[:,voxel_index].T
Vnew=nib.Nifti1Image(np.reshape(newdata.toarray(),Vref.shape),affine=Vref.affine, header=Vref.header)
#convert voxel index to coordinates we can include the position in the output filename
voxel_ijk=np.unravel_index(voxel_index,Vref.shape) #convert to (i,j,k) coords
voxel_xyz=(Vref.affine @ np.array(voxel_ijk+(1,)).T)[:3] #can also convert to x,y,z mm using Vref affine
voxel_ijk_string="%d_%d_%d" % (voxel_ijk)
#save glassbrain image of this volume using nilearn plotting tools
plotting.plot_glass_brain(Vnew,output_file="mylesion_chacoconn_res5mm_voxel_%s.png" % (voxel_ijk_string),colorbar=True)
#save volume as nii.gz so you can view it in nifti-viewing software (eg: fsleyes)
nib.save(Vnew,"mylesion_chacoconn_res5mm_voxel_%s.nii.gz" % (voxel_ijk_string))
#just for fun, save a second volume with JUST that seed voxel highlighted so we can overlay it later
cursordata=np.zeros(data.shape[0])
cursordata[voxel_index]=1
Vcursor=nib.Nifti1Image(np.reshape(cursordata,Vref.shape),affine=Vref.affine, header=Vref.header)
nib.save(Vcursor,"mylesion_chacoconn_res5mm_voxel_%s_cursor.nii.gz" % (voxel_ijk_string))
5ttgen
, dwi2response dhollander
, dwi2fod msmt_csd
tcksift2
)$SUBJID/MNINonLinear/xfms/standard2acpc_dc.nii.gz
(Note this is the MNI->T1 volume warp that is used to map streamlines from T1->MNI)FreeSurfer86-subj
: 86-region FreeSurfer Desikan-Killiany (DKT) cortical atlas with "aseg" subcortical regions(ie: aparc+aseg.nii.gz) Desikan 2006, Fischl 2002
FreeSurferSUIT111-subj
: 111-region atlas with 68 DKT cortical + 16 aseg subcortical + 27 cerebellar subregions from the SUIT atlas Diedrichsen 2009
FreeSurferSUIT191-subj
: 191-region atlas with 148 Destrieux (aparc.a2009s) cortical + 16 aseg subcortical + 27 cerebellar subregions from the SUIT atlas Destrieux 2010
CocoMMP438-subj
: 438-region atlas combining parts of several atlases:
CocoMMPsuit439-subj
: 439-region atlas from CocoMMP438, but with 27 SUIT cerebellar subregions instead of 26 from AAL3v1
CocoYeo143-subj
: 143-region atlas combining Schaefer100 cortical ROIs + 16 aseg subcortical + 27 cerebellar subregions from SUIT Schaefer 2018CocoYeo243-subj
: 243-region atlas combining Schaefer200 cortical ROIs + 16 aseg subcortical + 27 cerebellar subregions from SUIT Schaefer 2018CocoYeo443-subj
: 243-region atlas combining Schaefer400 cortical ROIs + 16 aseg subcortical + 27 cerebellar subregions from SUIT Schaefer 2018CocoLaus157-subj
: 157-region atlas combining Lausanne116 (114 cortical ROIs) + 16 aseg subcortical + 27 cerebellar subregions from SUIT Daducci 2012
CocoLaus262-subj
: 262-region atlas combining Lausanne221 (219 cortical ROIs) + 16 aseg subcortical + 27 cerebellar subregions from SUIT Daducci 2012
CocoLaus491-subj
: 491-region atlas combining Lausanne450 (448 cortical ROIs) + 16 aseg subcortical + 27 cerebellar subregions from SUIT Daducci 2012
FreeSurfer86-avg
, FreeSurferSUIT111-avg
, CocoMMP438-avg
, CocoMMPsuit439-avg
: Same regions as -subj but defined as a single group-level MNI volume
AAL
: 116-region Automated Anatomical Labeling atlas from Tzourio-Mazoyer 2002AAL3
: 166-region AAL3v1 atlas from Rolls 2020.
CC200
: 200-region whole-brain cortical+subcortical parcellation from Craddock 2012CC400
: 400-region (actually 392) cortical+subcortical parcellation from Craddock 2012Shen268
: 268-region cortical+subcortical atlas from Shen 2013Yeo7
: 7-network CORTICAL-ONLY parcellation from Yeo 2011Yeo17
: 17-network CORTICAL-ONLY parcellation from Yeo 2011Custom
: Any 1mm MNI (182x218x182) parcellation volume