<div dir="ltr">Hi Julian,<div><br></div><div>Thank you so much for your reply. </div><div><br></div><div>I've pasted the commented code below (I apologize for the code dump). I've also attached an m-file to this email if you'd prefer to download it that way. If relevant, you can download the leadfield, headmodel and electrode locations <a href="https://www.dropbox.com/s/8w99ejwrzmwc5pt/Source_fitting_dump.mat?dl=0">here</a> (that file also includes the raw data stored in variables A and U that I am attempting to source-fit).</div><div><br></div><div>As per your questions: I do indeed have a contrast between attended (A) and unattended (U) conditions. I've written the code below to source-fit both conditions and create the contrast. However, despite that the raw topographies (see attached images) are different, the source-fits are the same (...?). As a consequence, the contrast has no non-zero values. If instead, I normalize to noise (i.e. generate the <a href="http://www.fieldtriptoolbox.org/tutorial/beamformer#neural_activity_index">Neural Activity Index</a>) and look at a contrast there, we again see no non-zero values.</div><div><br></div><div>Outside of the contrast, I've implemented your other suggestions. I've rescaled the original ft_sourceplot such that you can see the extent of it (see attached image). To my mind, it shouldn't look like this, but having never done this before, I'm not quite sure what to expect. I've also included an image of the ft_sourceplot for the Neural Activity Index of sourceA which also appears to me to be artefactual. More to the point, I'd expect that since the topographies for A and U are different, the NAIs should be different, which is not the case.</div><div><br></div><div>I'm sort of at a loss about how to proceed here. So, thank you very much for taking the time to look into this. If I can supply anything else to help, please don't hesitate to let me know.</div><div><br></div><div>Best,</div><div><br></div><div>Tommy Wilson</div><div><br></div><div>--- CODE ---</div><div><br></div><div><div>%% Source fitting protocol</div><div>% Fieldtrip path (to find template MRI)</div><div>ftdir = 'your\path\here\';</div><div><br></div><div>% Equate covariance matrices for now to rule out any differences in the</div><div>% source fit due to differences in covariances</div><div>U.cov = A.cov;</div><div><br></div><div>%%% Do the LCMV sourcefitting</div><div>cfg = [];</div><div>cfg.method = 'lcmv';</div><div>cfg.grid = leadfield;</div><div>cfg.vol = vol;</div><div>cfg.elec = elec;</div><div>cfg.lcmv.lambda = '15%';</div><div>cfg.lcmv.keepfilter = 'yes';</div><div>cfg.lcmv.fixedori = 'yes';</div><div>cfg.lcmv.projectnoise = 'yes';</div><div><br></div><div>sourceA = ft_sourceanalysis(cfg,A);</div><div>sourceU = ft_sourceanalysis(cfg,U);</div><div><br></div><div><br></div><div>%%% Attempt a contrast</div><div>% Create the contrast</div><div>sourceContrast = sourceA;</div><div>sourceContrast.avg.pow = sourceA.avg.pow - sourceU.avg.pow;</div><div><br></div><div>% Check to see if any non-zero values exist in the contrast</div><div>if all(sourceContrast.avg.pow(sourceContrast.inside(:)) == 0)</div><div> warning('No non-zero contast values exist. ft_sourceplot will give an error. Do not plot.');</div><div>end</div><div><br></div><div><br></div><div>%%% Instead of a contrast, look at the Neural Activity Index (NAI)</div><div>% See: <a href="http://www.fieldtriptoolbox.org/tutorial/beamformer#neural_activity_index">http://www.fieldtriptoolbox.org/tutorial/beamformer#neural_activity_index</a></div><div>sourceA_NAI = sourceA;</div><div>sourceA_NAI.avg.pow = sourceA.avg.pow./sourceA.avg.noise;</div><div>sourceU_NAI = sourceU;</div><div>sourceU_NAI.avg.pow = sourceU.avg.pow./sourceU.avg.noise;</div><div><br></div><div>if all(sourceA_NAI.avg.pow(sourceA_NAI.inside(:)) - sourceU_NAI.avg.pow(sourceU_NAI.inside(:))==0)</div><div> warning('No non-zero contast values exist. ft_sourceplot will give an error. Do not plot.')</div><div>end</div><div><br></div><div><br></div><div>%%% Visualize the output</div><div>% Load template MRI</div><div>mri = ft_read_mri([ftdir '\fieldtrip-20160309\template\anatomy\single_subj_T1.nii']);</div><div><br></div><div>% Interpolate source onto MRI</div><div>cfg = [];</div><div>cfg.parameter = 'avg.pow';</div><div>sourceA_interp = ft_sourceinterpolate(cfg, sourceA, mri);</div><div>sourceA_NAI_interp = ft_sourceinterpolate(cfg, sourceA_NAI, mri);</div><div><br></div><div>% Visualize with ft_sourceplot</div><div>cfg = [];</div><div>cfg.method = 'ortho';</div><div>cfg.funparameter = 'avg.pow';</div><div>cfg.funcolorlim = [0 3e3];</div><div>cfg.maskparameter = cfg.funparameter; </div><div>ft_sourceplot(cfg, sourceA_interp);</div><div><br></div><div>cfg = [];</div><div>cfg.method = 'ortho';</div><div>cfg.funparameter = 'avg.pow';</div><div>cfg.maskparameter = cfg.funparameter; </div><div>ft_sourceplot(cfg, sourceA_NAI_interp);</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 24, 2017 at 3:42 AM Julian Keil <<a href="mailto:julian.keil@gmail.com">julian.keil@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Tommy,<br class="gmail_msg">
<br class="gmail_msg">
did you do some sort of contrast (e.g. with the noise estimate or a baseline) after your source analysis?<br class="gmail_msg">
Right now, it's not clear what you are looking at. Could you paste your code not only of the sourceanalysis, but the rest after which got you to the plot?<br class="gmail_msg">
It might also be the case that the automatic scaling in the source plot throws you off - maybe try setting it by hand.<br class="gmail_msg">
<br class="gmail_msg">
Good luck,<br class="gmail_msg">
<br class="gmail_msg">
Julian<br class="gmail_msg">
<br class="gmail_msg">
Am 23.01.2017 um 22:00 schrieb Tommy Wilson:<br class="gmail_msg">
<br class="gmail_msg">
> Hi all,<br class="gmail_msg">
><br class="gmail_msg">
> I'm working with EEG data and I'm trying to get some basic source fitting up and running. Unfortunately, I don't have individual subject MRIs, so I'm using the templates provided by fieldtrip. I've co-registered my 160 Biosemi electrodes to the standard_bem template (see attached picture). For the sourcemodel, I'm using the standard_sourcemodel3d5mm grid (picture attached, overlaid on standard_bem). I can prepare the leadfield from there with ft_prepare_leadfield (cfg.normalize = 'yes'), as per the LCMV tutorial.<br class="gmail_msg">
><br class="gmail_msg">
> To test this configuration, I've selected a time window in my data and averaged across it (the covariance matrix was also calculated); the topography of this averaged data is attached. I then attempted a source fit with the LCMV beamformer:<br class="gmail_msg">
><br class="gmail_msg">
> cfg = [];<br class="gmail_msg">
> cfg.method = 'lcmv';<br class="gmail_msg">
> cfg.grid = leadfield;<br class="gmail_msg">
> cfg.vol = vol;<br class="gmail_msg">
> cfg.elec = elec;<br class="gmail_msg">
> cfg.lcmv.lambda = '15%';<br class="gmail_msg">
> cfg.lcmv.keepfilter = 'yes';<br class="gmail_msg">
> cfg.lcmv.fixedori = 'yes';<br class="gmail_msg">
> cfg.lcmv.projectnoise = 'yes';<br class="gmail_msg">
><br class="gmail_msg">
> sourceA = ft_sourceanalysis(cfg,A);<br class="gmail_msg">
><br class="gmail_msg">
> After interpolating to the single_subj_T1.nii provided with ft_sourceinterpolate and plotting with ft_sourceplot, I am given a sourceplot that is highly focal in nature (see attached picture).<br class="gmail_msg">
><br class="gmail_msg">
> I'd find it very surprising if this topography were generated primarily by a source that isn't even inside the brain (as the sourceplot indicates). So, I'm not sure exactly where/how I'm going wrong with this one, nor am I sure how to trouble shoot it. Any guidance you might provide would be greatly appreciated.<br class="gmail_msg">
><br class="gmail_msg">
> Thanks so much,<br class="gmail_msg">
><br class="gmail_msg">
> Tommy<br class="gmail_msg">
><br class="gmail_msg">
> <Grid.PNG><Electrode localization.PNG><Topo.PNG><Source.PNG>_______________________________________________<br class="gmail_msg">
> fieldtrip mailing list<br class="gmail_msg">
> <a href="mailto:fieldtrip@donders.ru.nl" class="gmail_msg" target="_blank">fieldtrip@donders.ru.nl</a><br class="gmail_msg">
> <a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" class="gmail_msg" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
fieldtrip mailing list<br class="gmail_msg">
<a href="mailto:fieldtrip@donders.ru.nl" class="gmail_msg" target="_blank">fieldtrip@donders.ru.nl</a><br class="gmail_msg">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" class="gmail_msg" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote></div></div>