open-discussion > Extract Adjacency Matrix from Human Connectom Project MSMAll.dscalar.nii-file
Showing 1-2 of 2 posts
Display:
Results per page:
Jan 17, 2023  03:01 PM | basmats - Leiden University
Extract Adjacency Matrix from Human Connectom Project MSMAll.dscalar.nii-file
Dear All,

For my master's thesis I am using R to fit a model to the working memory task fMRI dataset of the Human Connectome Project. To do so, I will need an adjacency matrix that marks the neighbors of each voxel. My supervisors and I have chosen to use the MSMAll.dscalar.nii files from the dataset. How can I extract this adjacency matrix from the file using ciftiTools? Or perhaps another package?

Best,

Bas
Jul 27, 2023  06:07 PM | Damon Pham
RE: Extract Adjacency Matrix from Human Connectom Project MSMAll.dscalar.nii-file

Hi Bas,


Thanks and sorry for the terribly delayed reply; I didn't know we had a Forums here!


With CIFTI data, spatial information is contained in a GIFTI file (*.surf.gii) which is separate from the CIFTI file having the measurements (*.dtseries.nii, *.dscalar.nii, *.dlabel.nii).


For HCP surface data at 32k, if you just want the vertex adjacency matrix, since all subjects are registered to a mesh with the same topology, you just need one file--and we've included it in ciftiTools: see `load_surf`. It will give a surface with the same topology as the ones used with the HCP. The `faces` component of the surface object returned by `load_surf` will give the three vertices in each face. To make an adjacency matrix: if a vertex shares a face with another vertex, it's adjacent, so collect for each vertex set adjacency to 1 for all other vertices it shares faces with, 0 otherwise. I might look into adding a function for this in our package.