loreta2fieldtrip

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Dec 11 12:16:43 CET 2006


On 10 Dec 2006, at 14:44, Hanukaev Dmitri wrote:

> we want to do T depandent statistic over group of subjects with two
> conditions to find time -space cluster for Loreta's output.As you
> advised
> we used a monte carlo method as in attached file.We use one
> person's data
> and low number of rundomization to simplify function .
> WE got error message :
>
> "
> ??? In an assignment  A(:) = B, the number of elements in A and B
> must be the same.
>
> Error in ==> fieldtrip-20061202\private\clusterstat at 111
>     tmp(cfg.inside) = postailobs;


You are doing an experimental 4D clustering (3x space plus 1x time).
That is not yet completely supported and requires some manual
tweaking. Let me explain.

The inside and outside refers to dipole locations inside or outside
the brain. See also http://www2.ru.nl/fcdonders/fieldtrip/doku.php?
id=fieldtrip:documentation:frequently_asked_questions#why_is_there_a_rim
_around_the_brain_for_which_the_source_reconstruction_is_not_computed
for more background.
Note that inside/outside in the FT code either be represented as a
list of indices (e.g. inside=[1 2 3 5], outside=[4]), or as a boolean
vector (inside=[1 1 1 0 1], no outside needed). For the moment
consider that it is a boolean vector.

The source reconstruction can be depicted as a matrix with NxM, where
N=number_of_voxels and M=number_of_timepoints. So the data may look
like this

 >> a = randn(5,3)  % some example data
a =
    -0.4326    1.1909   -0.1867
    -1.6656    1.1892    0.7258
     0.1253   -0.0376   -0.5883
     0.2877    0.3273    2.1832
    -1.1465    0.1746   -0.1364

 >> a(4,:) = nan   % the 4th voxel is not inside the brain, so no
source reconstruction there
a =
    -0.4326    1.1909   -0.1867
    -1.6656    1.1892    0.7258
     0.1253   -0.0376   -0.5883
        NaN       NaN       NaN
    -1.1465    0.1746   -0.1364

What I expect to be the problem here is that inside and outside
relate to voxels, and not to timepoints. Since you are clustering 4D,
the data of a single subject and the statistic that is computed over
all subjects is represented as a (N*M)x1 vector. So the first
dimension is number_of_space_time_points. The "inside" vector only
codes for the inside "space" points, i.e. only for the rows in the
NxM matrix, whereas it now should should index into a (N*M)x1 vector.

I.e. the data per subject is now represented as


 >> a(:)
ans =
    -0.4326
    -1.6656
     0.1253
        NaN
    -1.1465
     1.1909
     1.1892
    -0.0376
        NaN
     0.1746
    -0.1867
     0.7258
    -0.5883
        NaN
    -0.1364

So the "inside" indicator should also repeat itself 3 times for this
example.

Please do "dbstop if error" and use the matlab debugger to confirm
this. If it is indeed the case, then I suspect that you manually can
override the (normally automatic) cfg.inside option using a repeated
version of it. So something like

dum = zeros(prod(size(cond1{:}.dim),1))
dum(cond1{:}.inside)  = 1;
dum(cond1{:}.outside) = 0;

cfg.inside = repmat(dum, num_timepoints, 1);

Please let me know whether this works.


Robert



More information about the fieldtrip mailing list