[Mne_analysis] regarding morphing in matlab

Pavan Ramkumar pavan at neuro.hut.fi
Wed Mar 16 19:23:30 EDT 2011
Search archives:

Hi Alex!

Sure and happy to do so. Attached is a self explanatory script called
mne_create_decimated_morph_map.m (along with the nearpoints function
scraped off the Vistasoft tools as recommended by Justin).

The script is a just slightly cleaned up version of what Justin had sent:
so I suspect the permissions etc. would rest with him. I will try to
implement Matti's interpolation method when I have some more time.

Thanks again,
Pavan

> Hi,
>
> if you feel like making this accessible to the MNE community
> it would be great to have it directly in the MNE matlab toolbox
>
> https://github.com/mne-tools/mne-matlab
>
> It would be another mne_* function. I can give you access to the
> code repository, or you can just send me the m files if you
> prefer.
>
> Alex
> --
> Alexandre Gramfort, PhD
> gramfort at nmr.mgh.harvard.edu
> Dept. of Radiology MGH Martinos Center / Harvard Medical School
> http://www-sop.inria.fr/members/Alexandre.Gramfort/
>
> On Tue, Mar 15, 2011 at 8:06 PM, Pavan Ramkumar <pavan at neuro.hut.fi>
> wrote:
>> Dear Matti, Justin, Hari, Dan, Sheraz, and others!
>>
>> Thanks very much for clarifying and proposing a solution. I guess
>> Justin's
>> interpolation method (nearpoints) and Matti's iterative method are
>> slightly different in how sparse they allow the 'destination' surface to
>> be. I have tested the nearpoints function and it seems to work really
>> well
>> & fast! I will also test Matti's suggestion and report back in case I
>> find
>> something unexpected.
>>
>> Thanks again,
>> Pavan
>>
>>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> The information in this e-mail is intended only for the person to whom
>>> it
>>> is
>>> addressed. If you believe this e-mail was sent to you in error and the
>>> e-mail
>>> contains patient information, please contact the Partners Compliance
>>> HelpLine at
>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>> in
>>> error
>>> but does not contain patient information, please contact the sender and
>>> properly
>>> dispose of the e-mail.
>>>
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mne_create_decimated_morph_map.tar.gz
Type: application/postscript
Size: 45844 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20110317/85166304/attachment.eps 


More information about the Mne_analysis mailing list