Spatiotemporal cluster test in a subset of vertices

Hi all,

How do I restrict the spatiotemporal cluster test to a label? I've been
trying to work off of this example:

http://martinos.org/mne/stable/auto_examples/stats/plot_cluster_stats_spatio_temporal.html

And zeroed in on the following line as the line I'd probably want to modify:

connectivity = spatial_tris_connectivity(grade_to_tris(5))

But this is pretty opaque to me and I'm not sure what the next step would
be.

Thanks,
Tal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140811/1ecf051f/attachment.html

For now, you can use the `spatial_exclude` parameter of the clustering
functions to exclude all the source space vertices outside your label:

http://martinos.org/mne/stable/generated/mne.stats.spatio_temporal_cluster_1samp_test.html#mne.stats.spatio_temporal_cluster_1samp_test

Denis also has some work going to make it easier:

https://github.com/mne-tools/mne-python/pull/1503

Eric

Hi Tal,

also have a look at this example (in combination wtih #1503):

https://gist.github.com/dengemann/ea482183be869568412c

Denis

Thanks for your replies. Is this the right way to use spatial_exclude? I
think I might be missing something, because the clusters are *kind of* in
the ROI I would want them to be in but also spill out of the ROI:

        vertices = np.arange(5124)
        *excluded_vertices = vertices[~np.in1d(vertices, label.vertices)]*
        tris = mne.source_estimate.grade_to_tris(4)
        connectivity = mne.source_estimate.spatial_tris_connectivity(tris)
        clu = mne.stats.spatio_temporal_cluster_1samp_test(
            data, connectivity=connectivity, n_jobs=2,
            n_permutations=n_permutations, threshold=t_threshold,
            spatial_exclude=excluded_vertices)

Does anything jump out at you? Otherwise I can put my data somewhere online
and we can take a look together.

Thanks!

Tal

make sure to get all mappings right which are involved

1) hemisphere vertices to whole brain indices (e.g. for ico5 / fsaverage the left hemisphere indices go up to 10241 and the right ones up to 20483, nevertheless vertices don't go beyond 10242.

2) all label vertices and the vertices used by the source space

use label.get_vertices_used to be sure

Importantly, the clustering test expects indices related to the data passed.

-Denis

Hi,

Is there a way to use spatial_exclude to "downsample" the number of vertices? That is, I'd like to run spatiotemporal cluster stats across the whole brain (not using an ROI) but use fewer than 20484 vertices. If I simply drop every other vertex, for example, will that retain an even spacing of vertices?

Thanks,
Ben

Just sub-selecting vertices by excluding some proportion of them (even if
evenly spatially sampled) will distort the signals that you're representing
a bit. It would be better to build another, smaller source space, and morph
from the full one to the smaller one, as the morphing procedure is designed
to preserve the overall activation levels. But I would try to avoid doing
this, as you may lose some effective spatial resolution.

Eric

Hi list,

What about doing group analysis on a smaller source space. e.g. Morphing to a particular subject and using fsaverage to display results?

-- Denis