[Mne_analysis] regarding morphing in matlab
Matti Hamalainen
msh at nmr.mgh.harvard.edu
Mon Mar 14 15:04:52 EDT 2011
Hi Pavan, Hari, Justin, and others,
On Mar 14, 2011, at 12:09 PM, Pavan Ramkumar wrote:
> Hi Hari (and others),
>
> Thanks very much for the suggestions and apologies for the lengthy
> reply!
>
> I did check that most rows are entirely zero (about 2300/2562).
> Secondly,
> I did look at the vertex numbering and they seem to make sense.
> Also, I
> visualized the result as stc and they do seem as sparse as the data
> matrix
> suggests.
>
> It seems to me that smoothing (or as Matti recommends to call it in
> Section 8.3 of the manual v2.6.1 : smudging/blurring) is the root of
> the
> difference between the mne_make_movie result and my MATLAB
> implemenation.
The smoothing or spreading operator is, indeed, essential. Here is how
the morphing works in mne_make_movie:
1. A morphing map is composed. Using the aligned spherical surfaces (?
h.sphere.reg) of the two subjects, you get a linear interpolation
(sparse) matrix which interpolates the values at the vertices of a
triangle of a "source" surface to get the value at a vertex of the
"destination" surface.
2. The vertices of interest on the "destination" surface are
determined. This is done by finding the vertices nearest to the
vertices of a recursively subdivided icosahedron on the sphere.reg
surfaces. Only the rows corresponding to these vertices are retained
in the morphing map.
3. Since the interpolation (morphing) matrix not only assumes but
requires that data are available on all vertices of the source
surface, the spreading operator is applied. This is the one step not
currently implemented in Matlab.
4. The smeared data are multiplied by the (restricted) morphing matrix.
Here is the recipe we came up with Alex Gramfort during lunch to make
the spreading operator matrix. The C code uses direct iteration
instead of forming this matrix explicitly. By "valid neigboring
vertex" I mean a vertex which is adjacent to the vertex of interest
AND belongs to the source space OR has been defined during previous
iterations of the spreading operator.
This is what you need to do:
0. Initialize the spreading operator as an nvert x nvert identity
matrix (S_0)
1. Create an nvert x nvert empty matrix (S)
2. On each row, insert ones to the columns corresponding to the
vertices adjacent to the vertex corresponding to the row.
3. Zero columns corresponding to vertices that are not valid.
4. Divide each row by the number of non-zero entries on that row.
4. Compute the spreading operator corresponding to the k'th smoothstep
as S_k = S*S_{k-1}
I hope this helps.
- Matti
---------
Matti Hamalainen, Ph.D.
Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
msh at nmr.mgh.harvard.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20110314/77a50358/attachment.html
More information about the Mne_analysis
mailing list