most of time when we finish the source reconstruction or connecivity, we are always facing the problem how we know which grid pioint belonging to which part of brain, even you have all the matrix or source model on hand.

in filedtrip, we have lots of functions to carry on different things , sometime it has to depend on the different model or toturial, some altlas is not as you see in toturial, here I mean the parcellation of brain regions, we take template file in this blog and show you some what I have learn for this things.

1. load the template headmodel and generate the leadfiled for foward problems


%% Compute lead field
cfg                 = [];
cfg.normalize       ='yes' ;
cfg.elec            = elec;
cfg.headmodel       = bem;
cfg.grid.resolution = 10;   % use a 3-D grid with a 1 cm resolution
cfg.grid.unit       = 'mm';
lfgrids                = ft_prepare_leadfield(cfg);

lfgrids 实际上已经包含一个分辨率为10mm的sourcemodel

2. use the lfgrid to calculate the source and connecivity ,then we have the source data or connecivity matrix,later for network analysis . here we interpolte

% and call ft_sourceinterpolate:
cfg = [];
cfg.interpmethod = 'nearest';
cfg.parameter = 'tissue';
sourcemodel2 = ft_sourceinterpolate(cfg, aal, lfgrids);

sourcemodel2.pos = concon{1,3}.pos; % otherwise the parcellation won't work

cfg = [];
cfg.parcellation = 'tissue';
cfg.parameter    = 'cohspctrm';
parc_conn = ft_sourceparcellate(cfg, concon{1,3}, sourcemodel2);

before parcellation

after paracellation

though above the pics , we could see the imagery part of cohence matrix in voxsel wise ,
the next figure is tissue based. seems more reasonable.

By the way, after we have got the connecivity , we need plot the matrix with imagesc function,
however in filedtrip the data represention is highly intergrated , you need to do some tricks to plot the voxel wise connecitivyt as follows :

idx=find(concon{1,2}.inside==1); 找出内脑的数据点

% b=concon{1,1}.pos(idx,1:3);

c=concon{1,2}.cohspctrm(idx,idx);   提取内脑点和点之间的coh
conmatrix_fix = weight_conversion(c, 'autofix'); 自动处理数据比如 nan换成0
conmatrix_fixth=threshold_proportional(conmatrix_fix, 0.3);保留30%的强度链接

% replace NAN with 0 ;
sourcemodel2.tissue(isnan(sourcemodel2.tissue)) =0;

ids  =find(sourcemodel2.tissue);          %  all interpolate regions

id     =sourcemodel2.tissue(ids); %  all interpolate regions index

ROI     =atlas.tissuelabel(id);

occid   =find(strncmpi(ROI,'Occipital',9));  %  indice

OCC     =ROI(occid);  % label