<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div style="direction: ltr;">
<div><font size="2">Hi Fieldtrip list, </font>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">I'm trying to do group source analysis using MNE but have run into a bit of a snag. </div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">After running ft_sourceanalysis (data is 1600ms / 901 data points, source model has been made via SPM (8196 verticies), head model through segmentation of the individual's MRI - all looks
 to be aligned, similar to the output of SPM (see  and plots sensibly using ft_sourcemovie) I've tried running ft_sourceinterpolation using the data on an individual's MRI (freshly read in using ft_read_mri) or the SPM T1 template (also using <span style="font-size: 10pt;">ft_read_mri).</span></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">If using the individual's MRI (dimensions = 256 256 176), with or without downsampling, after an hour or so I get an out of memory error and that's that. Running it with the template works
 fine and is finished ~90 seconds. The results using ft_sourceplot (ortho method) however don't look right (see interp.jpg). Additionally there's no field in the interpolated's cfg about anatomy afterward.</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">So taking another route and just trying to use ft_sourcegrandaverage on the output of ft_sourcelocalisation I'm met with </div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">"<span style="font-size: 10pt;">??? Error using ==> ft_sourcegrandaverage at 111</span></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><span style="font-size: 10pt;">different grid locations in source reconstructions"</span> </div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">I have absolutely no idea what I'm doing wrong and would appreciate any help. An abridged version of the script I'm using for mass conversion to source space is below: </div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">
<div>    sourcemodel = ft_read_headshape(gii_list(i,:)); <b><-- this is the ...2cortex_8196.surf.gii mesh from spm</b></div>
<div>    </div>
<div>    mri = ft_read_mri([structdir mri_list(i,1:end-2)]); <b><--- individual participant's raw MRI in nii form. </b></div>
<div>    </div>
<div>    cfg = [];</div>
<div>    cfg.coordsys = 'spm';</div>
<div>    cfg.output = {'brain'};</div>
<div>    seg = ft_volumesegment(cfg, mri);</div>
<div>    </div>
<div>    cfg = [];</div>
<div>    cfg.method = 'singleshell'; </div>
<div>    conductionmodel = ft_prepare_headmodel(cfg, seg);</div>
<div>    </div>
<div>    conductionmodel = ft_convert_units(conductionmodel,'cm');</div>
<div>    conductionmodel = ft_convert_units(conductionmodel,'mm');</div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">
<div><br>
</div>
<div><u> %%Check everything's aligned correctly:  </u></div>
<div><br>
</div>
<div>    figure;hold on;</div>
<div>    subplot(1,2,1), ft_plot_vol(conductionmodel, 'facecolor', [0 0 1]);alpha 0.5;</div>
<div>    ft_plot_mesh(sourcemodel, 'edgecolor', [0 1 0]); camlight</div>
<div>    ft_plot_sens(sens, 'style', 'r*');</div>
<div>    subplot(1,2,2), ft_plot_vol(conductionmodel, 'facecolor', [0 0 1]);alpha 0.5;</div>
<div>    ft_plot_mesh(sourcemodel, 'edgecolor', [0 1 0]); camlight</div>
<div>    ft_plot_sens(sens, 'style', 'r*'); view([90 0]);</div>
<div>    view([90 0])</div>
<div>    gcf;</div>
<div>    suptitle([gii_list(i,2:5) ' source model']);</div>
<div>    saveas(gcf, [gii_list(i,2:6) 'source model.tiff']);</div>
<div>    close(gcf);</div>
<div>    </div>
<div>    assignin('base', [gii_list(i,2:6) 'sourcemodel'], sourcemodel); <--- rename hold variable to participant number</div>
<div>    assignin('base', [gii_list(i,2:6) 'conductionmodel'], conductionmodel); <--- ditto</div>
<div>    </div>
<div>    save([gii_list(i,2:6) 'model'], [gii_list(i,2:6) 'sourcemodel'], [gii_list(i,2:6) 'conductionmodel'], '-v6'); </div>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div>
<div><u>%% CREATE LEADFIELD & LOCALISED DATA</u></div>
<div>    </div>
<div>    load(sens_data_list(i,:)); <--- Load sensor space condition data</div>
<div>    conds_list = (who('*nback*av'))  <--- Create participant specific list </div>
<div>    </div>
<div>    datcm = eval(conds_list{1,1});</div>
<div>    dat = datcm;</div>
<div>    dat.grad = ft_convert_units(datcm.grad, 'mm');</div>
<div>        </div>
<div>    %Leadfield goes here <b><--- Mostly taken from the tutorial</b></div>
<div>    </div>
<div>    cfg = [];</div>
<div>    cfg.grad = dat.grad; % sensor positions</div>
<div>    cfg.channel = 'MEG'; % the used channels</div>
<div>   <i> cfg.grid.pos = sourcemodel.pnt; % source points </i><b><---Does this have something to do with the problem? </b></div>
<div><i>    cfg.grid.inside = 1:size(sourcemodel.pnt,1); % all source points are inside of the brain </i><b style="font-size: 10pt;"><--- Or this? </b></div>
<div>    cfg.vol = conductionmodel; % volume conduction model</div>
<div>    leadfield = ft_prepare_leadfield(cfg);</div>
<div>        </div>
<div>    assignin('base', [conds_list{1,1} '_leadfield'], leadfield);</div>
<div>    save([gii_list(i,2:6) 'model'], [conds_list{1,1} '_leadfield'], '-v6', '-append');</div>
<div>    </div>
<div>    clear dat;</div>
<div>    </div>
<div>    for k = 1:size(conds_list,1);</div>
<div>        disp('---');</div>
<div>        disp(['Creating source data for ' conds_list{k,1}]);</div>
<div>        disp('---');</div>
<div>        datcm = eval(conds_list{k,1});</div>
<div>        dat = datcm;</div>
<div>        dat.grad = ft_convert_units(datcm.grad, 'mm');</div>
<div>   </div>
<div>    %Inversion goes here  <span style="font-size: 10pt;"><b><--- Mostly taken from the tutorial</b></span></div>
<div>        cfg  = [];</div>
<div>        cfg.method = 'mne';</div>
<div>        cfg.grid = leadfield;</div>
<div>        cfg.vol = conductionmodel;</div>
<div>        cfg.mne.prewhiten = 'yes';</div>
<div>        cfg.mne.lambda = 3;</div>
<div>        cfg.mne.scalesourcecov = 'yes';</div>
<div>        sourcedat = ft_sourceanalysis(cfg,dat);</div>
<div><br>
</div>
<div>        assignin('base', [conds_list{k,1} '_source'], sourcedat);</div>
<div>        </div>
<div>        k = k + 1;</div>
<div>    end</div>
<div>        </div>
<div><u>%%General saving stuff</u></div>
<div><br>
</div>
<div>        a = who('*C_av_source');</div>
<div>        b = a(1:2:end,1);</div>
<div>    </div>
<div>        save([sourcedatadir gii_list(i,2:6) 'condep_conds'], char(b(1,1)), '-v6');</div>
<div>        </div>
<div>        for l = 2:size(b,1);</div>
<div>            save([sourcedatadir gii_list(i,2:6) 'condep_conds'], char(b(l,1)), '-append', '-v6');</div>
<div>            l = l + 1;</div>
<div>        end</div>
<div>        </div>
<div>       save([sourcedatadir gii_list(i,2:6) 'source'],  '*_source', '-v6');</div>
</div>
<div><br>
</div>
<div>Thanks again, </div>
<div><br>
</div>
<div>Peter</div>
<div><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div>
<div>
<div>
<div>
<div style="font-family:Tahoma; font-size:13px"><font size="2">__________________________</font></div>
<div><font size="2" style="font-family:Tahoma; font-size:13px">Peter Goodin,  </font>
<div>
<div>
<div style="font-family:Tahoma; font-size:13px">BSc (Hons), Ph.D Candidate.</div>
<div style="font-family:Tahoma; font-size:13px"><br>
</div>
<div style="font-family:Tahoma; font-size:13px"><font size="2">Brain and Psychological Sciences Research Centre (BPsych)</font></div>
<div style="font-family:Tahoma; font-size:13px">Swinburne University, </div>
<div style="font-family:Tahoma; font-size:13px">Hawthorn, Vic, 3122</div>
<div><a href="http://www.swinburne.edu.au/swinburneresearchers/index.php?fuseaction=profile&pid=4149" target="_blank">http://www.swinburne.edu.au/swinburneresearchers/index.php?fuseaction=profile&pid=4149</a><br>
</div>
</div>
<div style="font-family:Tahoma; font-size:13px"><br>
</div>
<div style="font-family:Tahoma; font-size:13px"><font size="2">Monash Alfred Psychiatry Research Centre (MAPrc)</font></div>
Level 4, 607 St Kilda Road, <br>
Melbourne 3004</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>