ThomasYeoLab / CBIG

MIT License
586 stars 384 forks source link

Possible to get the MNI coordinates for the regions for the 7 resting state networks? #16

Closed Reine0017 closed 3 years ago

Reine0017 commented 3 years ago

Hello! Sorry if this is a silly question but I've been stuck on this for a few days already and I'd really appreciate it if someone can help me out :)

From this link: https://sites.google.com/view/yeolab/software, for the resting state networks and under the Cortical Resting Networks, I was able to download Resting State Cortical Parcellation in nonlinear MNI152 space and then view it in freeview. I'm trying to get the MNI coordinates for each of these 7 regions so I can recreate it (build a network model) in Python.

So far I've tried using Mango and MatLab to open the files as well but it's not giving me the MNI coordinates. May I get some advice?

rubykong commented 3 years ago

@Reine0017 We have the RAS coordinates for the centroids here: https://github.com/ThomasYeoLab/CBIG/tree/master/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/MNI152/Centroid_coordinates

But I guess what you want is not only the centroids?

Reine0017 commented 3 years ago

Yeah hahaa I kinda want to plot out the points of each MNI coordinate by colour of each region. Thanks so much for replying though! :)

ahpxue commented 3 years ago

@Reine0017 Hi if you want to know the coordinates, you can use MRIread function (matlab) to read the nii file. input=MRIread(<nii file>); And the 3d matrix input.vol are the labels. Note that vox [a, b, c] in freeview correspond to [b+1, a+1, c+1] in matlab.

Reine0017 commented 3 years ago

Hello @ahpxue! Thanks so much for replying me :)

I've tried to extract xyz coordinates from Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii using two methods in matlab - mri_read and spm_read_vols, but the coordinates I got from each method is different. I'm trying to get the coordinates in MNI space..may I ask which of the following two methods are correct?

Method 1 (in matlab): >> volumeInfo=spm_vol('Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii');

>> [intensityVal,xyzCoor]=spm_read_vols(volumeInfo);

Method 2 (in matlab): >> yeoinfo=mri_read('Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii');

Additionally, I've then tried using Method 1 in matlab and then with the xyzCoors I plotted out the diagram with python. Am I supposed to swap and offset the x, y, z coordinates to [y+1, x+1, z+1]?

Really sorry for the long question, but it'll really really help if you'd be willing to help me out! Thank you so much!!

ahpxue commented 3 years ago

@Reine0017 Hi I'm not familiar with spm. I'm refering to MRIread which is a freesurfer function under <your freesurfer folder>/matlab. Can you try this function?

For example, if you open Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii.gz in freeview (I'm using 5.3.0, other versions might be the same, just for your reference), voxel [168, 115, 150] is labeled 6, 7networks_6.

Then you load it in matlab: input=MRIread('Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii.gz');, you can find input.vol(116,169,151) is also 6.

Reine0017 commented 3 years ago

@ahpxue Thanks so much for your help! :100: