[FieldTrip] cluster-based permutation tests on MNE-surface data
hanneke.meeren at uvt.nl
Thu Dec 30 14:02:23 CET 2010
Thanks a lot for your explanation. I follow your line of reasoning well. I have already done some experimenting with FT_TIMELOCKSTATISTICS, and it seems to do the job, although I have still have to do some double-checking. I have indeed created a FT data structure from my MNE data very similar as the way you describe it. The main difference between you and my mne-data is I guess, that my functional (source) data are not on a cortical mesh. Although my anatomical surface data is a patch with vertices and faces, my source data is not. My source data consists of fixed dipole locations that are actually a subset of the vertices in my surface data. These dipoles each have an x,y,z position in MRI coordinates, but do not have faces or other connectivity-parameters. I guess your tess_vertices_connectivity.m script cannot do the job for a x,y,z position-matrix. So I consider my dipoles as a set of electrodes each having their x,y,z coordinates, and create the neighbourhood-structure with cfg.neigbourdist =5 (I have both my coordinates and distance in mm).
Thanks a lot again,
From: Stephan Moratti <smoratti at psi.ucm.es>
To: Email discussion list for the FieldTrip project <fieldtrip at donders.ru.nl>
Date: Thu, 30 Dec 2010 10:12:43 +0100
Subject: Re: [FieldTrip] cluster-based permutation tests on MNE-surface data
Actually I do this kind of analysis using the MNE solution from the Brainstrom pipeline. I do the following. First you have to determine a connectivity matrix that determines which vertices of your cortical mesh are neighbors. I do that with a brainstrom script called tess_vertices_connectivity.m. You can download brainstrom for free. Let's call the connectivity matrix C. If C(i,j) = 1 then vertices i and j are connected, if C(i,j) = 0, then not.
Later I changed the clusterstat.m of FT a little bit:
lines 38 to 48 I changed:
if isfield(cfg, 'neighbours') && ~isempty(cfg.neighbours) && ~isfield(cfg,'connectivity')
channeighbstructmat = makechanneighbstructmat(cfg);
issource = 0;
elseif isfield(cfg, 'connectivity')
disp('Using precomputed connectivity matrix !');
channeighbstructmat = cfg.connectivity; % connectivity has been already computed this is what I introduced
issource = 0;
issource = 1;
% cfg contains dim and inside that are needed for reshaping the data to a volume, and inside should behave as a index vector
cfg = fixinside(cfg, 'index');
By doing so, FT does not calculate a connectivity matrix based on distance, but using directly your connectivity matrix C (see below):
The next trick is to create a FT data structure from your MNE data, so that you can use ft_timelockstatistics.m. As a cortical mesh has the same 3d coordinates as a sensor helmet, I "press" my MNE surface data in a sensor data structure that I can use later with ft_timelockstatistic.m. This could look like this:
MneERF1.grad.pnt=brain.vert; %brain.vert contains the vertices of my cortical mesh; be sure that the unit is cm
for i = 1:7000
MneERF1.grad.label = MneERF1.label;
MneERF1.grad.tra = eye(7000);
MneERF1.cfg.channel = UmneERF1.label;
MneERF1.grad.ori = zeros(7000,3);
for i = 1:23
MneERF1.individual(i,:,:) = squeeze(MNEsolution(:,i,:)); % Here I put the individual MNE solutions if I have 23 subjects; this depends a little bit of your data matrix
Now you can use timelockstatistic.m as described in the FT tutorial on sensor space data to calculate a non-parametric cluster based permutation statistic on your MNE surface data (for example MneERF1, MneERF2 are two conditions that you want to compare). The only difference is that you would introduce cfg.connectivity = C;, so that later
clusterstat.m uses your C matrix to determine your neighbours.
I hope that helps,
El 30/12/2010, a las 00:18, Meeren.H.K.M. escribió:
> Dear Jan-Mathijs,
> Thank you for your quick answer. I have used the MNE/mne_analyze stream developed by Matti Hamalainen which implements the anatomically-constrained noise-normalized MNE
> (Dale et al.2000). The spatial structure of the data is indeed the cortical sheet segmented and reconstructed using Freesurfer. The individual cortical sheets were morphed onto each other using Matti's mne-stream which performs intersubject alignment of cortical landmarks based on a spherical surface-based coordinate system according to the method of Fischl et al. (1999, Hum. Brain Mapping 8:272–284). I it makes use of a Freesurfer algorithm.
> Although the cortical sheet can functionally be considered as a folded 2D-sheet, computation-wise it is a 3D-patch of vertices, with each vertex having an x, y and z-coordinate, being the positions of the dipoles. I presume FT_SOURCESTATISTICS uses a 3D-voxel-grid, with the neighbors of each voxel being automatically defined on the basis of this grid (?). The trick would be then to translate the 3D-patch into a 3D-grid..., or not? No, I haven't thought of it yet how to do this. Also I don't know in which field and which format I should put the spatial info..
> Alternatively, I was wondering whether I could work my way around it by using FT_TIMELOCKSTATISTICS instead and to consider the vertices as a set of (intracranial) electrodes with their x,y,z coordinates (and their time-course!). For the spatial clustering I would need to generate a neighborhood-structure. I don't know, however, how I should exactly pass the vertex positions info to the function. Using cfg.elec or cfg.elecfile, or data.elec, but it is not clear to me what should be the exact format of the structure. It is also not clear to me whether it is necessary to give each vertex a label (in which field should I put this?), or whether only setting cfg.neigbourdist would do the trick.
> It would be very helpful to have an example EEG input dataset for FT_TIMELOCKSTATISTICS and an example input dataset for FT_SOURCESTATISTICS to see what the exact format of the data should be! I couldn't find either of them in the tutorial.
> Best regards,
> -----Original Message-----
> From: jan-mathijs schoffelen <jm.schoffelen at gmail.com>
> To: hanneke.meeren at uvt.nl
> Date: Wed, 29 Dec 2010 16:43:42 +0100
> Subject: Re: [FieldTrip] cluster-based permutation tests on MNE-surface data
> Hi Hanneke,
> Performing cluster based statistics on source reconstructed data based
> on a cortical sheet is as of yet not supported (I assume at least that
> you do the standard MNE cortical sheet reconstruction). At the moment,
> we are actually working on implementing an MNE-like pipeline in
> FieldTrip.Our first strategy would be to interpolate the 2D sheets
> onto a 3D volume, and use the standard machinery for statistics. Yet,
> another viable approach indeed would be to build in support for 2D-
> neighbourhood structures. Do you have any clear ideas on that? I would
> also be interested to see your recipe to warp the individual cortical
> sheets to a template.
> Regarding the mailing list: the list is hosted on a new server since
> the beginning of December. Apparently the archives have not been moved
> along, or at least are not accessible. We'll look into this.
> Best wishes,
> PS: could you forward this message to the list; I am at home and
> cannot send mails from my regular account.
> On Dec 29, 2010, at 4:25 PM, Meeren.H.K.M. wrote:
>> I would like to perform cluster-based permutation tests on MNE-
>> surface data, which I obtained using the MNE/Freesurfer pipeline. So
>> rather than use the whole FT pipeline and start from scratch, I
>> would like to import my existing source data into FieldTrip, and
>> export the resulting stats to my own matlab visualization tools.
>> Reading the tutorial and reference documentation I understand that I
>> could directly call ft_sourcestatistics, but it is not clear to me
>> what the exact data structure should be for the source data and
>> which fields the cfg should contain. I could not find a tutorial- or
>> example dataset for ft_sourcestatistics.
>> For each condition I have the source data in a (subjects x vertices
>> x time) 3d-array for each condition. Is it possible to have a time-
>> dimension in the source-data, or should I first convert to a two-
>> dimensional array subjects x vertices? In addition I have generated
>> a location matrix which contains the x, y, z - coordinates of the
>> vertices of my surface, which I presume is necessary to define
>> neighbors. It is however not clear to me how to pass the location
>> matrix to the function (should it be defined in a cfg field?). I
>> have also tried to search the archives of the discussion list but
>> was unable to find any messages before December 2010.
>> Does anyone have an example dataset available that can be used as
>> input dataset for sourcestatistics, so I can see what the structure
>> of the data should be? Could someone clarify how I should define the
>> location data? Could someone help me out on how to search through
>> the old messages in the discussion list archives.
>> Any help is greatly appreciated,
>> Thanks a lot in advance,
>> Hanneke K.M. Meeren, PhD.
>> Research Fellow and Instructor
>> Medical Psychology and Cognitive Neuroscience
>> Tilburg University
>> P.O. Box 90153
>> 5000 LE Tilburg
>> The Netherlands
>> email: hanneke.meeren at uvt.nl
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
> Hanneke K.M. Meeren, PhD.
> Research Fellow and Instructor
> Medical Psychology and Cognitive Neuroscience
> Tilburg University
> P.O. Box 90153
> 5000 LE Tilburg
> The Netherlands
> email: hanneke.meeren at uvt.nl
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
Stephan Moratti, PhD
see also: http://web.me.com/smoratti/
Department of Basic Psychology
Universidad Complutense de Madrid
Centro de Tecnología Biomédica CBT,
Universidad Politécnica de Madrid,
en la actualidad (currently at) en el
Centro de Magnetoencefalografía Dr. Perez Modrego,
Universidad Complutense de Madrid,
Faculdad de Medicina,
Avda. Complutense, s/n,
email: smoratti at psi.ucm.es
Tel.: +34 91 394 2186
Fax.: +34 91 394 2294
Hanneke K.M. Meeren, PhD.
Research Fellow and Instructor
Medical Psychology and Cognitive Neuroscience
P.O. Box 90153
5000 LE Tilburg
email: hanneke.meeren at uvt.nl
More information about the fieldtrip