XYZ Coordinates of Subcortical Voxels

30 views
Skip to first unread message

amirhussein.a

unread,
Dec 7, 2022, 7:26:16 AM12/7/22
to HCP-Users
Dear all,

We are currently working on the preprocessed resting-state fMRI data of the HCP (rfMRI_REST*_*_Atlas_MSMAll_hp2000_clean.dtseries.nii) and XYZ coordinates of each vertex/voxel (in the processed data) is required for our analysis.

I used midthickness surf.gii files (Subject.*.midthickness_MSMAll.32k_fs_LR.surf.gii) for cortical vertices but I do not know how to derive XYZ coordinates for the subcortical volumes.

Using cifti-matlab, I found 3 values (probably some sort of MNI voxel indices in space?) for each voxel in diminfo{1,1}.models{1,*}.voxlist, however, I do not know how to associate these to the XYZ coordinates of the subcortical areas in the rest fMRI analyzed space (btw, is it MNI or is it T1w_acpc_dc_restore?)

Thanks in advance!

Best,
Amir

Tim Coalson

unread,
Dec 7, 2022, 5:32:18 PM12/7/22
to hcp-...@humanconnectome.org
The diminfo{1} will also have a .vol element that contains dims and sform fields.  The sform field works like a nifti-1 sform (note: it is 0-index based, unlike spm's returned sforms).  You can also use "cifti_diminfo_dense_get_volume_all_info(mycifti.diminfo{1})" (or the similar per-structure function) to get 1-based voxel indices, and a 1-indexing adjusted sform (like spm).

This information is in the cifti XML (the "Volume" child element of the "MatrixIndicesMap" with the Brain Models type), and is used to make the volume header for the volume outputs of wb_command -cifti-separate.  Hopefully whatever language you are using gives you enough access to the information in the cifti XML that you can use it directly.  Otherwise, you may need to use matlab or similar to generate a volume file that contains the coordinates of its own voxels, and then use wb_command -cifti-replace-structure to put it into a matched cifti file.

Tim


--
You received this message because you are subscribed to the Google Groups "HCP-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hcp-users+...@humanconnectome.org.
To view this discussion on the web visit https://groups.google.com/a/humanconnectome.org/d/msgid/hcp-users/be4f4e9f-5b64-4ac3-a9ad-34963c93c1b5n%40humanconnectome.org.

amirhussein.a

unread,
Dec 14, 2022, 11:22:11 AM12/14/22
to HCP-Users, tim.c...@gmail.com
Dear Tim,

Thank you for your reply. So, for finding mm coordinates of a specific voxel coordinate in the preprocessed rest fMRI data (ciftiopened as 'fmri' into MATLAB):

sform = fmri.diminfo{1,1}.vol.sform;
xyz = sform(1:3,:)*[voxX voxY voxZ 1]' 

right?

Best,
Amir

Tim Coalson

unread,
Dec 14, 2022, 2:28:42 PM12/14/22
to amirhussein.a, HCP-Users
If voxX, etc are 0-based voxel indices, yes.  Or, you can do:

volinfo = cifti_diminfo_dense_get_all_info(fmri.diminfo{1});
allcoords = volinfo.sform1 * [volinfo.voxlist1; ones(1, size(volinfo.voxlist1, 2)];

to get the coordinates of all voxels that the cifti file has data for.  This method uses 1-based indexing, matching matlab array indexing, but will give the same answer when both are done correctly.

Tim

Reply all
Reply to author
Forward
0 new messages