How can I extract fMRI time courses for specific MNI-coordinated voxels from HCP data subjects?

Submitted by longhongquan on

Hi,

I am new in fMRI and the associated tools and I would like to ask a very entry level question.

I am using the HCP database subjects and trying to get time courses for specific voxels. Now I have ther voxels in MNI coordinates. (an excel file containing many voxels identified by x,y,z coordinate).

eg:

ROI#XYZ
1-15-28-32
222-37-53
31222-48
4-36-42-24

Do I have to firstly convert this into an ROI file? if so, how? (Assume we use 10mm boundaries and construct a cubic for each point).

Then, how could I extract the time course for each voxel? For example if I have a pre-processed 100307_3T_Structural_preproc.zip and resting state 100307_3T_rfMRI_REST1_preproc.zip?I know I should extract data from file like rfMRI_REST1_LR_Atlas.dtseries.nii, and use gifti in matlab to do the job, but how?

I followed the steps here HCP: extracting timecourses from the surface files, it basically did this:

//in Connectome Workbench

wb_command -cifti-separate in.dtseries.nii COLUMN -metric CORTEX_LEFT out.func.gii 

wb_command -volume-to-surface-mapping roi.nii.gz atlas.surf.gii roi.func.gii -enclosing

//in Matlab:

addpath 'C:/Program Files/MATLAB/gifti-1.4';   % path to GIFTI library
roi = gifti(['d:/temp/roi.func.gii']);   % load the ROI GIFTI
inds = find(roi.cdata > 0);    % find is like which: get the vertex indices
wm = gifti(['out.func.gii']);  % load the functional GIFTI
tmp = wm.cdata(inds,:);    % get those indices' timcourses
csvwrite(['d:/temp/out.csv'], tmp);   % write as a csv text file

But it seemed out.func.gii was too big and I can never load it into Matlab.

I actually used rfMRI_REST1_LR_Atlas.dtseries.nii to perform -cifti-separate on CORTECT_LEFT,  is it correct?

I am an undergraduate student who is interested in this area and have just started to explore. I know my questions look naive and sometimes messy, I am sorry but I have tried many ways and did not get any clue.

Thank you.

 

 

 

YAN Chao-Gan

Thu, 08/20/2015 - 08:55

Hi,

1. If you want to get voxel IJK index from the xyz coordinates, you can refer to #9 in http://rfmri.org/faq

2. If you want to generate ROIs form the coordinates, you can use y_Sphere.m in DPABI. Or you can use DPABI->Utilities->ROI Signal Extractor by setting the center coordinates, time series extraction will be performed from those ROIs.

3. If you want to extract time series of every voxel of a .nii file, you don't need to use any tool. Simply use Data = y_Read('XX.nii'); you will get a 4D matrix of the time series.

Best,

Chao-Gan

 

longhongquan

Fri, 08/21/2015 - 16:05

In reply to by YAN Chao-Gan

Thank you Professor,

The suggestions are trully very helpful and I have successfully generated some results that I am looking for. I really appreciate your help. However, I have one follow-up question and I would appreciate if you could clear my doubt.

I used [Data Header]= y_Read('XX.nii') as you said to read the whole time series file. Like following:

[Data Header]= y_Read('tfMRI_EMOTION_LR_Atlas.dtseries.nii');

However, instead of 4D matrix, I got 6D matrix. The dimention of the 6D matrix is actually:

Data(1,1,1,1,176,91282). -- It is essentially a 2D data as the first 4 colums are all 1-D.  176 is the timeseries, and 91282 is the number of Voxels here, inclusing Cortex and Volume.

The question is: how do I convert the IJK coordinate[91,109,91] to VertexIndex number? Or even directly convert MNI coordinates into the index? Is there any method? 

Thank you! Again I trully appreciate for your previes help.

 

 

Hi, 

The 6th dimension indicates grayordinates (defined in Cifti). It's cortical surface vertex + subcortical volume voxel. 

To get MNI coordinates, please see http://lists.humanconnectome.org/pipermail/hcp-users/2013-August/000129.html

"If you use the surface ${StudyFolder}/${SubjectID}/MNINonLinear/fsaverage_LR32k/${SubjectID}.${Hemisphere}.midthickness.32k_fs_LR.surf.gii, then you will have surface coordinates in MNI space as well. " 

Best,

Chao-Gan

longhongquan

Sun, 08/23/2015 - 10:43

In reply to by YAN Chao-Gan

Dear Professor Yan,

Thank you a lot! You are so nice and I trully appreciate for your patience and help.

I have done what you said and get data for *.midthickness.32k_fs_LR.surf.gii. But I don't understand how I could make use of this.

data = 

       faces: [64980x3 int32]
         mat: [4x4 double]
    vertices: [32492x3 single]
 

Actually I don't need surface coordinates, because I at current stage I am only interested in volume voxels.

Simply speaking, I now have some voxels in MNI, and I have successfully converted them into IJK coordinate(Thank you!). How do I get time course for one volume voxel? For example MNI[-25,-98,-12] / IJK[58.5,15,31] ? from CITIF file tfMRI_EMOTION_LR_Atlas.dtseries.nii?

Now what I can do is: open *.dtseries.nii in Text Editor -> Manually locate the voxel according to the IJK and IndexOffset(for example, IJK 50 65 29 is 59412+8 = 59420) -> get the time course for index 59420 using Data(1,1,1,1,:,59420)(Data is the 6-D matrix I get using y_read(*.dtseries.nii)).

However, it is impossible for me to manually get all points like this. So is there a way such that I can directly convert IJK 50 65 29 to Index 59420?

Actually I tried to implement another way to read *dtseries.nii using gifti in matlab. 

wb_command -cifti-separate tfMRI_EMOTION_LR_Atlas.dtseries.nii COLUMN -volume out.func.gii

wm = gifti(['out.func.gii']);% load the functional GIFTI

However, I never get to see whether it works or not as the seperated(using volume) GIFTI file was too big such that my Matlab loads it forever. (for example, if the original dtseries.nii file is 60MB, the seperated GIFTI file will be 400MB if I seperate it using volume).

I am extremely sorry for bothering you again. I have tried my best to investigate but failed to have further outcomes due to my limited knowledge. Please forgive me as it might seem very intuitive to you but might be confusing to me.

So, in summary the simplest question is: how do I get time course for a MNI coordinated voxel? As I actually now find that there could be floating point numbers if we translate an integer MNI into IJK. 

Thank you. Have a nice weekend. 

Very Best Regards,

Hongquan

Forums