<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#000000"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">Hi FieldTrip community,</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">I've
 been trying to perform a connectivity analysis using a 66 eeg recording
 database. So far, I've being able to solve the sourceanalysis 
(following the tutorial <a href="http://www.fieldtriptoolbox.org/tutorial/networkanalysis/" target="_blank">http://www.fieldtriptoolbox.org/tutorial/networkanalysis/</a>)
 and plot the source activity. However, the problem starts when I'm 
trying the connectivity analysis. Any grid dimension lower than 20 mm in
 the sourcemodel calculation results in a matlab error (Out of memory) 
in the connectivity analysis. I guess that a grid dimension lower than 
20 mm conveys to huge matrix sizes, not manageable by my OS (linux + 
Matlab). <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">%% This is how I compute the sourcemodel (run ok)<br>    cfg                 = [];<br>    cfg.elec            = data.elec;<br>    cfg.elec.unit = 'mm';                   % unit in cm<br>    cfg.headmodel       = headmodel;<br>    cfg.grid.resolution = 20;     % use a 3-D grid with a 20 mm resolution<br>    [lf] = ft_prepare_leadfield(cfg);</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">After
 computing the sourcemodel using the 20 mm grid, I have issues to 
parcellate my data. My main concern is about the mismatch size between 
the connectivity matrix and the atlas. <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">source_conn =<br>          dim: [7 9 8]<br>       inside: [504×1 logical]<br>          pos: [504×3 double]<br>    cohspctrm: [5544×5544 double]<br>       dimord: 'pos_pos_freq'<br>         freq: 10<br>          cfg: [1×1 struct]</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br>atlas = <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">            dim: [91 109 91]<br>            hdr: [1×1 struct]<br>      transform: [4×4 double]<br>           unit: 'mm'<br>         tissue: [91×109×91 double]<br>    tissuelabel: {1×116 cell}<br>       coordsys: 'mni'</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">I'd
 tried to interpolate and parcellate the matrix, but I must be missing 
or confusing something... Below is the code to calculate the 
connectivity and the parcellation. </div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">%% connectivity<br>    cfg         = [];<br>    cfg.method  = 'coh';<br>    cfg.complex = 'absimag';<br>    source_conn = ft_connectivityanalysis(cfg, SourceData);<br>    <br>    %The conectome<br>    figure;imagesc(source_conn.cohspctrm); %5544x5544 double<br>    <br>    %Parcellation<br>    atlas = ft_read_atlas('/fieldtrip-master/template/atlas/aal/ROI_MNI_V4.nii');<br>    <br>    cfg = [];<br>    cfg.interpmethod='nearest';<br>    cfg.parameter='tissue';<br>    [int_atlas] = ft_sourceinterpolate(cfg, atlas, source_conn);<br>    int_atlas.pos = source_conn.pos; % otherwise the parcellation won't work<br>    <br>    % and call ft_sourceparcellate:<br>    cfg = [];<br>    cfg.parcellation = 'tissue';<br>    cfg.parameter    = 'cohspctrm';<br>    parc_conn = ft_sourceparcellate(cfg, source_conn, int_atlas);<br><br>    figure;imagesc(parc_conn.cohspctrm);<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">++Error in command windows matlab <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">there are in total 504 positions, 230 positions are inside the brain, 181 positions have a label<br>168 of the positions inside the brain have a label<br>168 of the labeled positions are inside the brain<br>62 of the positions inside the brain do not have a label<span style="color:rgb(255,0,0)"><span style="background-color:rgb(255,0,0)"><br><span style="background-color:rgb(255,255,255)">Error using ft_notification (line 340)<br>unsupported dimord unknown_unknown_freq<br><br>Error in ft_error (line 39)<br>  ft_notification(varargin{:});<br><br>Error in ft_sourceparcellate (line 309)<br>    ft_error('unsupported dimord %s', dimord{i})</span></span></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">Two questions <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">-Is 20 mm the min grid size to calculate connectivity?</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">-What I'm missing in the parcellation process?</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">I would really appreciate any advice, I've been scratching my head for a while on this one.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">Best,</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(0,0,0)">Christian  </div></div></div>