Choice for fMRI Data

373 views
Skip to first unread message

Görkem Akgül

unread,
May 24, 2024, 2:25:42 PM5/24/24
to HCP-Users

Hi everyone,

I am currently starting a deep-learning-based analysis of connectivity matrices derived from the resting-state fMRI data within the HCP1200 release. As I am relatively new to fMRI data analysis, I have a few questions regarding the dataset and would greatly appreciate your assistance.

  1. Based on my review of the Reference Manual and discussions within the community, it appears that the resting-state fMRI data located under "${Subject}/T1w/Results/" contains minimally-preprocessed fMRI data in the subject's native anatomical space. Conversely, the rfMRI data within "${Subject/MNINonLinear/Results/" is preprocessed using the ICA-FIX approach and registered to the MNI152 space. Could you kindly confirm if my understanding is accurate?
  2. Assuming the above is correct, it seems more appropriate to utilize the rfMRI data under "${Subject/MNINonLinear/Results/", given its alignment to a standard space. However, within this folder, there are various files such as PhaseOne_gdc_dc.nii.gz, PhaseTwo_gdc_dc.nii.gz, and several versions of grayordinates files (e.g., rfMRI_REST1_RL_Atlas_hp2000_clean.dtseries.nii, rfMRI_REST1_RL_Atlas_MSMAll.dtseries.nii). While I understand that all of these files are registered to MNI152 space, it appears that the versions differ in preprocessing steps; for instance, files with MSMAll have undergone Multimodal Surface Matching, while those with hp2000 have been high-pass filtered. Additionally, there is a timeseries file that combines both preprocessing steps (rfMRI_REST1_RL_Atlas_MSMAll_hp2000_clean.dtseries.nii).

Considering the above, I am uncertain which file would be most suitable for my analysis. I noticed that Dr. Matthew Glasser recommended the use of the combined version ( ${fMRIName}/${fMRIName}_Atlas_MSMAll_hp2000_clean.dtseries.nii). Do you think this recommendation would also apply in my case? 

Kind regards.

Glasser, Matt

unread,
May 24, 2024, 3:07:14 PM5/24/24
to hcp-...@humanconnectome.org

Yes, if you don’t know that you have a reason to use something else, start with:

 

${StudyFolder}/${Subject}/MNINonLinear/Results/${fMRIName}/${fMRIName}_Atlas_MSMAll_hp2000_clean.dtseries.nii

 

Matt.

--
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/92de0d3d-e12d-4dcc-adba-e7f1227466a9n%40humanconnectome.org.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Görkem Akgül

unread,
May 24, 2024, 6:44:43 PM5/24/24
to HCP-Users, glas...@wustl.edu

Hi Matt,

Thank you so much for your previous response. Could you also clarify if the volumetric rfMRI timeseries files (PhaseOne_gdc_dc.nii.gz and PhaseTwo_gdc_dc.nii.gz) in either /MNINonLinear/Results/ or T1w/Results/ are registered to MNI152?

Thanks.

24 Mayıs 2024 Cuma tarihinde saat 22:07:14 UTC+3 itibarıyla glas...@wustl.edu şunları yazdı:

Glasser, Matt

unread,
May 24, 2024, 6:54:54 PM5/24/24
to Görkem Akgül, HCP-Users

For subcortical structures, the data are registered to MNI space.  Those files are not fMRI timeseries.

Görkem Akgül

unread,
May 26, 2024, 7:51:05 PM5/26/24
to HCP-Users, glas...@wustl.edu, Görkem Akgül

I apologize for my misunderstanding regarding the files. I initially thought the PhaseOne_gdc_dc.nii.gz and PhaseTwo_gdc_dc.nii.gz files contained the fMRI timeseries. I plan to use the HCP MMP 1.0 atlas to create the connectivity matrix from the timeseries data, and working with the NIFTI format is much easier for me.

Yesterday, I created a connectivity matrix from the ${fMRIName}_hp2000_clean.nii.gz file. Additionally, I converted one of the ${fMRIName}_Atlas_MSMAll_hp2000_clean.dtseries.nii files from CIFTI to NIFTI using the Connectome Workbench, and then created another connectivity matrix from it. The connectivity matrices created from the converted ${fMRIName}_Atlas_MSMAll_hp2000_clean.dtseries.nii file and the ${fMRIName}_hp2000_clean.nii.gz file appear identical. Are these files essentially the same, with the only difference being that one is in CIFTI format and the other is in NIFTI?

Thank you for your assistance.


25 Mayıs 2024 Cumartesi tarihinde saat 01:54:54 UTC+3 itibarıyla glas...@wustl.edu şunları yazdı:

Glasser, Matt

unread,
May 26, 2024, 7:54:40 PM5/26/24
to hcp-...@humanconnectome.org, Görkem Akgül

You use wb_command -cifti-parcellate with the HCP’s multi-modal atlas obtained from here: https://balsa.wustl.edu/file/87B9N.  Then wb_command -cifti-correlation to make a connectivity matrix.  There is no reason to convert any files to NIFTI or to use NIFTI files at all. 

Görkem Akgül

unread,
May 27, 2024, 9:30:45 AM5/27/24
to HCP-Users, glas...@wustl.edu, Görkem Akgül

Hi again,

Thank you for the recommendation. In this case, how can I create the connectivity matrix using specific regions from the atlas?

For instance, I created a list of the regions in the atlas using the following command:

>> wb_command -cifti-label-export-table Q1-Q6_RelatedValidation210.CorticalAreas_dil_Final_Final_Areas_Group_Colors_with_Atlas_ROIs2.32k_fs_LR.dlabel.nii 1 labels.txt

Then get the first 40 regions into another txt file:

>> cat first_40_labels.txt

L_V1_ROI

181 67 10 255 255

L_MST_ROI

182 49 91 127 255

L_V6_ROI

183 49 85 168 255

L_V2_ROI

184 13 51 237 255

...

Then I ran the following code:

>> atlas_path="Q1-Q6_RelatedValidation210.CorticalAreas_dil_Final_Final_Areas_Group_Colors_with_Atlas_ROIs2.32k_fs_LR.dlabel.nii"

>> dtseries_path="rfMRI_REST2_LR_Atlas_MSMAll_hp2000_clean.dtseries.nii"

>> first_40_labels_path="first_40_labels.txt"

>> wb_command -cifti-label-import $atlas_path $first_40_labels_path first40.dlabel.nii

>> wb_command -cifti-parcellate $dtseries_path first40.dlabel.nii COLUMN first40_timeseries.ptseries.nii

>> wb_command -cifti-correlation first40_timeseries.ptseries.nii first_40_connmatrix.pconn.nii

However, the resulting connectivity matrix has the shape of 379x379 instead of the expected shape for the first 40 regions. It seems like the parcellation and correlation processes included additional regions beyond the specified first 40 regions.

Could you please advise on how to ensure that the connectivity matrix is computed only for the specified regions from the atlas?


27 Mayıs 2024 Pazartesi tarihinde saat 02:54:40 UTC+3 itibarıyla glas...@wustl.edu şunları yazdı:

Glasser, Matt

unread,
May 27, 2024, 9:44:27 AM5/27/24
to Görkem Akgül, HCP-Users

I would select the regions after the fact.

Görkem Akgül

unread,
May 28, 2024, 6:44:14 AM5/28/24
to HCP-Users, glas...@wustl.edu, Görkem Akgül
Hi there again,

I used two different methods to create the connectivity matrix:

1. Parcellate the data and convert it to a time series text file. Then creating the connectivity matrix using Python:

# Parcellate the time series 
wb_command -cifti-parcellate $dtseries_path $atlas_path COLUMN ${subject_session}_timeseries.ptseries.nii 
# Convert the parcellated time series to a text file 
wb_command -cifti-convert -to-text ${subject_session}_timeseries.ptseries.nii ${subject_session}_timeseries.txt  

This resulted in time series data with the shape of (379, 1200). Then, using Python, I selected the first 40 regions in the left cortex as an example and created the connectivity matrix.

2.  Create the connectivity matrix using Workbench. Then select the sub-matrix using Python:

# Parcellate the time series
wb_command -cifti-parcellate $dtseries_path $atlas_path COLUMN ${subject_session}_timeseries.ptseries.nii
# Generate the connectivity matrix
wb_command -cifti-correlation ${subject_session}_timeseries.ptseries.nii ${subject_session}_connmatrix.pconn.nii  

This resulted in a 379 x 379 connectivity matrix. Then, using Python, I extracted the sub-matrix for the first 40 regions in the left cortex.

The connectivity matrices generated by both methods seem almost identical (Pearson Correlation = 1.0, Cosine Similarity = 1.0, MSE = 0.000016). Therefore, I believe I created the matrix correctly using both methods.

However, I still wonder if it is possible to perform the sub-matrix selection within the connectivity matrix using Connectome Workbench directly. Do you have any suggestions?

Thank you so much for all the assistance. I really appreciate it. 

27 Mayıs 2024 Pazartesi tarihinde saat 16:44:27 UTC+3 itibarıyla glas...@wustl.edu şunları yazdı:

Tim Coalson

unread,
May 28, 2024, 3:07:16 PM5/28/24
to hcp-...@humanconnectome.org, glas...@wustl.edu, Görkem Akgül
The -*-label-import commands will create labels via the key values for any value in the input data file, unless you specify -discard-others to tell it not to create labels that aren't in the text file.

Tim


Tim Coalson

unread,
May 28, 2024, 3:16:28 PM5/28/24
to hcp-...@humanconnectome.org, glas...@wustl.edu, Görkem Akgül
It is possible to do this with -cifti-merge and -cifti-transpose, like so:

wb_command -cifti-merge halfrestrict.pconn.nii -cifti full.pconn.nii -column 1 -up-to 40
#transpose the halfrestrict file
#do the same -cifti-merge on the transposed halfrestrict file

For a more useful construct, you can also do "-cifti full.pconn.nii -column L_V1_ROI -column L_V2_ROI", etc, without needing to specify the input file more than once.

Parcellated files are small though, so I don't know why you would want to make such an incomplete parcellated connectome file.  You can just ignore the parcels you don't care about in whatever later code.

Tim


Görkem Akgül

unread,
May 30, 2024, 5:02:20 PM5/30/24
to HCP-Users, tim.c...@gmail.com, glas...@wustl.edu, Görkem Akgül

Hi Tim,

I hope you're doing well.

Thank you for your response. By specifying "-discard-others", I successfully created the connectivity matrix for selected ROIs using solely Workbench. On the other hand, when attempting the second approach you suggested, I encountered the following error: "ERROR: row mapping type must be series, scalars, or labels". Here's the code I used:

>> wb_command -cifti-parcellate $dtseries_path $atlas_path COLUMN ${subject_session}_timeseries.ptseries.nii

>> wb_command -cifti-correlation ${subject_session}_timeseries.ptseries.nii ${subject_session}_full_connmatrix.pconn.nii
>> wb_command -cifti-merge ${subject_session}_connmatrix_181_to_221.pconn.nii -cifti ${subject_session}_full_connmatrix.pconn.nii -column 181 -up-to 221
>> wb_command -cifti-transpose ${subject_session}_connmatrix_181_to_221.pconn.nii ${subject_session}_connmatrix_181_to_221_transposed.pconn.nii
>> wb_command -cifti-merge ${subject_session}_final_connmatrix_181_to_221.pconn.nii -cifti ${subject_session}_connmatrix_181_to_221_transposed.pconn.nii -column 181 -up-to 221

I also attempted to use ROI Names in the third line with the following code:  

>> roi_columns="" while IFS= read -r line; do roi_columns+="-column $line " done < "$roi_names_file"

>> wb_command -cifti-merge ${output_path}/${subject_session}_connmatrix_selected_rois.pconn.nii -cifti ${output_path}/${subject_session}_full_connmatrix.pconn.nii $roi_columns

Unfortunately, it resulted in the same error. I am probably missing something here.

And for anybody trying to do something similar, you can use the following code for reference:

>> wb_command -cifti-label-import $atlas_path $first_40_labels_path ${atlas_name}_first40.dlabel.nii -discard-others
>> wb_command -cifti-parcellate $dtseries_path ${atlas_name}_first40.dlabel.nii COLUMN ${subject_session}_first40_timeseries.ptseries.nii
>> wb_command -cifti-correlation ${subject_session}_first40_timeseries.ptseries.nii ${subject_session}_first40_connmatrix.pconn.nii  

As you mentioned, the connectivity files are quite small so I can ignore the parcels in my code but I just wanted to learn how I can do it using Workbench directly.

Thank you so much once again for your invaluable help.

Kind regards,

Görkem.  



28 Mayıs 2024 Salı tarihinde saat 22:16:28 UTC+3 itibarıyla tim.c...@gmail.com şunları yazdı:

Tim Coalson

unread,
May 30, 2024, 5:20:31 PM5/30/24
to Görkem Akgül, HCP-Users, glas...@wustl.edu
Ah, I didn't remember whether I allowed -cifti-merge on parcels.  It would be easy to get overlapping parcel definitions, so I guess I just blocked it entirely.  You can work around it with -cifti-change-mapping to reset it to scalars, but I still think the cleanest solution is to only generate the full pconn file, and have the analysis code decide what areas to focus on.

Tim

Richard Yuan

unread,
Nov 5, 2024, 11:06:43 PM11/5/24
to HCP-Users, gorkem....@gmail.com, tim.c...@gmail.com, glas...@wustl.edu
Dear Gorkem,

Thanks for your reference code of making the connectivity matrix, it is very inspiring and really helps! 

I also follow your step on the parameter estimate dtseries files from one subject in tfMRI. But I am struggling to extract the value from the outcome file  connmatrix.pconn.nii.

I see you utilise python to extract the correlational matrix. It would be great and appreciative if you could kindly give me some advice on how to extract the matrix from the file. I used the following codes in python, but I failed to extract any meaningful value with nan in the matrix(I attached the image of my code in this email).

Thanks for your time and best regards! 
Richard

code.png

Tim Coalson

unread,
Nov 5, 2024, 11:22:09 PM11/5/24
to Richard Yuan, HCP-Users, gorkem....@gmail.com, glas...@wustl.edu
If you are getting NaN somewhere, you should check your input data for NaNs or constant value.

Tim

Reply all
Reply to author
Forward
0 new messages