Problem running source grand average and source statistics

Ingrid Nieuwenhuis ingrid.nieuwenhuis at FCDONDERS.RU.NL
Wed Nov 5 13:41:44 CET 2008


Dear Michael and Jan-Mathijs,

If the same procedure is followed as on the wiki, the inside of the template
grid is copied to the single subjects, so by definition also the
'sparsified' single subjects sources should all have the same amount of
(inside) voxels. So point 2 J-M raised can't be it, point 1 could well be:
Because in line 115 dat's size is defined as (Nvoxels, Nsubj) and Nvoxels is
the product of the dim.

Best Ingrid

-----Original Message-----
From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
Of jan-mathijs schoffelen
Sent: Wednesday, November 05, 2008 10:20 AM
To: FIELDTRIP at NIC.SURFNET.NL
Subject: Re: [FIELDTRIP] Problem running source grand average and source
statistics

Dear Michael,

I agree with you that a likely cause is that the Nvoxel (which is
based on the dimensionality of the first singlesubject-source in the
input) varies across subjects. However, this would be strange,
because you use the same dipole grid for all subjects. On the other
hand: could it be that you 'sparsified' the single subjects? Each
subject could have a slightly different number of 'inside' positions.
This obviously leads to problems:
1 because the Nvoxel is incorrect in the first place (it's the
product of the dim, so the input is assumed to be full 3D, or a
linear array with all outside voxels present (either as nans or zeros
or whichever number you fancy).
2 because the length of the array per subject varies.

Hope this helps,

Jan-M



On Nov 4, 2008, at 5:35 PM, Michael Wibral wrote:

> Dear list users,
>
> I am having a problem running, source grandaverage and source
> statistics (over multiple subjects) on the output of
> soucrestatistictics (from multiple trials in single subjects).
>
> I ran first sourceanalysis supplying the backwads warped grids (as
> described in the wiki) to compute filters. Then I ran source
> analysis again to extract the single trial source images and the
> ran sourcestatistitics on this to get the single subject
> statistical images - all this runs fine. I then supply the pos (and
> dim) data of the template grid to each structure, replacing the
> original pos data (that do not match and of course prohibit using
> sourceststatistics and sourcegrandaverage). When trying to do
> either a source grand average or a sourcestatistics at the
> multisubject level I get the same error:
>
> subscripted assignment dimension mismatch
>  dat(:,i) = tmp(:);
>
> Error in ==> sourcegrandaverage at 173
>
>
> The corresponding lines of code in sourcegrandaverage are:
>
> % get the source parameter from each input source reconstruction
> % get the inside parameter from each input source reconstruction
> for i=1:Nsubject
>   % TODO this function should use parameterselection
>     if issubfield(varargin{i}, ['avg.' cfg.parameter])
>         tmp = getsubfield(varargin{i}, ['avg.' cfg.parameter]);
>     else
> 	      tmp = getsubfield(varargin{i}, cfg.parameter);
>     end
>    dat(:,i) = tmp(:);
>     tmp = getsubfield(varargin{i}, 'inside');
>      inside(tmp,i) = 1;
>  end
>
> I get an identical error when using sourcestatistics at the
> multisubject level.
> The variable dat(:,i)  is created like this:
> dat = zeros(Nvoxel, Nsubject)
>
>
> I suspect that somehow trying to use the 'stat' instead of the
> power parameter is a problem (TODO?) or that Nvoxel somehow differs
> over the various subjects ??
>
> Any advice on what to try and test further would very much
> appreciated.
>
> Thanks in advance,
> Michael
>
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users
> of the FieldTrip  toolbox, to share experiences and to discuss new
> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/
> archives/fieldtrip.html and http://www.ru.nl/fcdonders/
> fieldtrip.<Michael Wibral.vcf>

----------------------------------
The aim of this list is to facilitate the discussion between users of the
FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG
and EEG analysis. See also
http://listserv.surfnet.nl/archives/fieldtrip.html and
http://www.ru.nl/fcdonders/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.



More information about the fieldtrip mailing list