[FieldTrip] Specific sources and ft_sourcestatistics

Max Cantor mcantor at umich.edu
Mon Oct 20 18:58:30 CEST 2014


I found the tutorial,

http://fieldtrip.fcdonders.nl/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space?s[]=template&s[]=grid

Hopefully that clarifies anything about the code.

On Mon, Oct 20, 2014 at 12:49 PM, Max Cantor <mcantor at umich.edu> wrote:

> Hi Laura,
>
> If I understand your problem correctly, what I think you need to do is
> create a template grid using ft_source_model, then use ft_source_model to
> create a grid using each subjects' mri with the template grid, and finally
> change the .dim and .pos parameters of the source analysis output to unwarp
> from the subject grid to the template grid. The following code might help,
> although I think there is also a tutorial that talks about this:
>
>     template                   = ft_read_mri(templatefile);
>     template.coordsys    = 'spm';
>
>     % segment the template brain and construct a volume conduction model
> (i.e. head model)
>
>     cfg                            = [];
>     template_seg           = ft_volumesegment(cfg, template);
>
>     cfg                            = [];
>     cfg.method               = 'singleshell';
>     template_vol             = ft_prepare_headmodel(cfg, template_seg);
>
>     % construct the dipole grid in the template brain coordinates
>
>     cfg                           = [];
>     cfg.grid.xgrid           = -20:1:20;
>     cfg.grid.ygrid           = -20:1:20;
>     cfg.grid.zgrid           = -20:1:20;
>     cfg.grid.unit             = 'cm';
>     cfg.grid.tight            = 'yes';
>     cfg.inwardshift        = -1.5;
>     cfg.vol                     = template_vol;
>     template_grid         = ft_prepare_sourcemodel(cfg);
>
>    % Subject mri
>
>     mri                          = ft_read_mri(mrifile);
>     mri                          = ft_volumereslice([], mri);
>
>     cfg                          = [];
>     cfg.write                  = 'no';
>     cfg.coordsys           = 'ctf';
>     segmented             = ft_volumesegment(cfg, mri);
>
>     cfg                          = [];
>     cfg.method             = 'singleshell';
>     vol                          = ft_prepare_headmodel(cfg, segmented);
>
>     % Prepare Source Model using template grid and subject mri
>
>     cfg                          = [];
>     cfg.grid.warpmni     = 'yes';
>     cfg.grid.template     = template_grid;
>     cfg.grid.nonlinear    = 'yes';
>     cfg.mri                     = mri;
>     grid                          = ft_prepare_sourcemodel(cfg);
>
>    % Unwarp Grid (For group analysis)
>
>     src.dim                   = template_grid.dim;
>     src.pos                   = template_grid.pos;
>
> I hope this helps.
> best,
>
> Max
>
>
>
> On Mon, Oct 20, 2014 at 12:17 PM, Laura Rueda Delgado <
> Laura.Rueda at faber.kuleuven.be> wrote:
>
>>  Dear all,
>>
>>
>>
>> I’m working with EEG data and the individual MRIs. I have a doubt about a
>> step for defining ROIs. I have EEG data during a task with 3 conditions
>> (C1, C2, C3) and during rest. I would like to know what is the main effect
>> of the conditions in my source data. I was recommended to use the contrast
>> of Task (C1, C2 and C3 together) vs Rest to obtain meaningful sources,
>> which then are used to restrict the source and statistical analysis between
>> the conditions. This is what I do:
>>
>>
>>
>> -          Estimate sources with the common filter for Task and Rest
>> separately.
>>
>> -          Find sources that are significantly different between these
>> two conditions (ft_sourcestatistics with dependent T).
>>
>> -          Use the position of these sources as ROIs in
>> ft_sourceanalysis for C1, C2 and C3 separately (but using a common filter
>> of these conditions).
>>
>> -          Find sources that account for the main effect between
>> conditions (ft_sourcestatistics with dependent F).
>>
>>
>>
>> Now the problem is that if I use the position of the sources in
>> ft_sourceanalysis, I don’t have a regular grid anymore, and this becomes a
>> problem when using ft_sourcestatistics as cfg.dim needs to be specified and
>> if I do not specify it (because I don’t have a regular grid with 3
>> dimensions as expected), I get the following error:
>>
>>
>>
>> Error using reshape
>>
>> To RESHAPE the number of elements must not change.
>>
>>
>>
>> Error in clusterstat (line 185)
>>
>>       posclusobs = findcluster(reshape(postailobs,
>> [cfg.dim,1]),channeighbstructmat,cfg.minnbchan);
>>
>>
>>
>> Error in ft_statistics_montecarlo (line 361)
>>
>>   [stat, cfg] = clusterstat(cfg, statrand, statobs);
>>
>>
>>
>> Error in statistics_wrapper (line 308)
>>
>>     [stat, cfg] = statmethod(cfg, dat, design);
>>
>>
>>
>> Error in ft_sourcestatistics (line 107)
>>
>>     [stat, cfg] = statistics_wrapper(cfg, varargin{:});
>>
>>
>>
>>
>>
>> So does anybody know a way to work around this?
>>
>>
>>
>> And what do you think of the logic of these steps?
>>
>>
>>
>> Thank you in advance for any help!
>>
>>
>>
>>
>>
>> Cheers,
>>
>>
>>
>> Laura Rueda Delgado
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
>
> --
> Max Cantor
> Lab Manager
> Computational Neurolinguistics Lab
> University of Michigan
>



-- 
Max Cantor
Lab Manager
Computational Neurolinguistics Lab
University of Michigan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141020/c9578e18/attachment-0002.html>


More information about the fieldtrip mailing list