[FieldTrip] ft_sourcestatistics

Uri Eduardo Ramírez Pasos urieduardo at gmail.com
Thu Dec 14 15:09:36 CET 2017

Dear Julian,

Thanks a lot for your advice! Some follow-up questions and clarifications.

1a. I've looked at both approaches suggested in
http://www.fieldtriptoolbox.org/tutorial/sourcemodel?s%5B%5D=warp. For the
first approach (interpolate then normalize volumes), I used the following
code (for EEG data), where I compute source values from two conditions, ON
and OFF:

    cfg              = [];

    cfg.method       = 'dics';

    cfg.frequency    = 18;

    cfg.grid         = grid;

    cfg.headmodel    = headmodel;

    cfg.dics.projectnoise = 'yes';

    cfg.dics.lambda       = '5%';

    cfg.dics.keepfilter   = 'yes';

    cfg.dics.realfilter   = 'yes';

    sourceAllneg_pos = ft_sourceanalysis(cfg, freqAll);

    cfg.grid.filter = sourceAllneg_pos.avg.filter;

    sourceOFF_con  = ft_sourceanalysis(cfg, freqOFF);

    sourceON_con = ft_sourceanalysis(cfg, freqON);

    atlas = ft_read_atlas(



    cont_sources{pat,1,1}=ft_sourceinterpolate(cfg, sourceOFF_con, atlas);

    cont_sources{pat,1,2}=ft_sourceinterpolate(cfg, sourceON_con, atlas);



    [mri] = ft_volumenormalise(cfg, mri)

Using ft_sourceinterpolate normalized the .pos values across my subjects,
however I'm not sure what to do with the MRI variable created with
ft_volumenormalize, but I'm guessing it should be integrated somewhere for
results to be valid.

 1b. I also tried the second method in the tutorial (Subject-specific
grids), but the standard_sourcemodel3dxmm.mat files are based on the single
shell method, and hence only relevant for MEG. When inputting
cfg.grid.template= 'cortex_xxxx.surf.gii' (the other templates, which I
hope are for EEG), I get the error using load: 'Number of columns on line 2
of ASCII file cortex_xxxx.surf.gii must be the same as previous lines.

2. Yes, I just used

%get mri

mri = ft_read_mri('0001.dcm');

%segment mri




% Y

% r

% a

% s

% n



cfg.numvertices=[3000 2000 1000];

cfg.method='projectmesh';% or 'iso2mesh', 'isosurface',



cfg.method='bemcp';%or dipoli on a mac, or openmeeg

headmodel        = ft_prepare_headmodel(cfg,bnd);

I'm using a mac, though I can't get dipoli to work. I've used this for the
other subjects without every problem. I have no fiducials, not sure if this
has any influence.

3. I've thought about this further, it doesn't make much sense to do this
at the source level.
4. The warning occurs after running


    cfg.method='bemcp';%or dipoli on a mac, or openmeeg

    headmodel        = ft_prepare_headmodel(cfg,bnd);

, though I also get this when running sample data from fieldtrip tutorials.

Again, thank you immensely for your pointers!

2017-12-12 17:49 GMT+01:00 Julian Keil <julian.keil at gmail.com>:

> Dear Eduardo,
> @1: Do you mean normalize across the group? What you could do is
> interpolate the source-level data to an MRI and then use ft_volumenormalise
> to normalize all images to a common standard MRI. Check the FT site here:
> http://www.fieldtriptoolbox.org/tutorial/sourcemodel?s[]=warp
> Alternatively, you could take care that a common source grid is warped to
> the individual headmodel prior to the source analysis. In this case, you
> don’t need to normalize, as all subjects have the same number of sources.
> Check the tutorials on the FT-website for hints (e.g. http://www.
> fieldtriptoolbox.org/tutorial/salzburg?s[]=warp or http://
> www.fieldtriptoolbox.org/tutorial/beamformingextended?s[]=warp)
> @2: Did you build your own headmodel? It might be that the elements of the
> headmodel intersect. I would go back and double check all steps leading up
> to the leadfield computation for errors.
> @3: I have no idea.
> @4: When does this happen?
> Good luck,
> Julian
> Am 12.12.2017 um 14:38 schrieb Uri Eduardo Ramírez Pasos <
> urieduardo at gmail.com>:
> Dear fieldtrippers,
> I have a couple questions regarding source reconstruction that I hope you
> can help me with.
> 1. What is the best way to 'normalize' the position values in each forward
> model across my subjects so that I can run ft_sourcestatistics with
> cfg.statistic = 'ft_statfun_depsamplesT' ?
> 2. For one of my subjects, their leadfield keeps containing only NaNs.
> What could be the source (no pun intended) of the problem?
> 3. If my experiment's design has three 'levels' (say A1, A2, A3) for one
> 'factor', is it valid to subtract source values (obtained using method
> 'dics') for a comparison (e.g. A1-A3 vs A2-A3)?
> 4. What could have gone wrong when i get the warning “matrix is singular,
> close to singular or badly scaled. Results may be inaccurate.” How does one
> go about solving this?
> Best regards,
> Eduardo Ramírez, PhD candidate
> University of Würzburg
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171214/7387a51a/attachment-0002.html>

More information about the fieldtrip mailing list