-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathLoadParcellatedDataInMatlab_Example.m
31 lines (22 loc) · 1.27 KB
/
LoadParcellatedDataInMatlab_Example.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
%Make sure to have this in your shell path:
%wb_command
addpath('code/')
addpath('code/gifti-1.6/')
%Setting the parcel files to be the 718 parcels (cortical + subcortical)
parcelCIFTIFile='CortexSubcortex_ColeAnticevic_NetPartition_wSubcorGSR_parcels_LR.dlabel.nii';
parcelTSFilename='Output_Atlas_CortSubcort.Parcels.LR.ptseries.nii';
%Set this to be your input fMRI data CIFTI file
inputFile='HCPS1200MSMAll/100206/MNINonLinear/Results/rfMRI_REST1_LR/rfMRI_REST1_LR_Atlas_MSMAll.dtseries.nii';
eval(['!wb_command -cifti-parcellate ' inputFile ' ' parcelCIFTIFile ' COLUMN ' parcelTSFilename ' -method MEAN'])
%Load parcellated data (requires the ciftiopen function from the HCP website, FieldTrip)
LR_dat = ciftiopen(parcelTSFilename,'wb_command');
NUMPARCELS=718;
tseriesMatSubj=LR_dat.cdata;
%Loading other relevant files
load('cortex_subcortex_community_order.mat');
netorder=readtable('network_labelfile.txt','ReadVariableNames',false);
netassignments=table2array(readtable('cortex_subcortex_parcel_network_assignments.txt','ReadVariableNames',false));
%Computing Pearson correlation-based functional connectivity and vizualizing the data (assuming preprocessing has already been done)
FCmat=corrcoef(tseriesMatSubj');
FCmat_sorted=FCmat(indsort,indsort);
figure;imagesc(FCmat_sorted)