aojeda / dsi

Distributed EEG source imaging toolbox for EEGLAB
5 stars 0 forks source link

Head model coordinates #1

Closed lrkrol closed 4 years ago

lrkrol commented 5 years ago

Dear Alejandro,

Thanks for this great tool!

I'm trying to include the head models it generates into my EEG simulation toolbox SEREEGA. This basically means that I'm taking hm.K and hm.cortex.vertices and putting them in another standardised structure.

Comparing your head model (right) to the New York Head (left), there's two rather obvious differences:

image

Yours has the noise pointing to x-positive, rather than y-positive, which should be easy enough to fix. But the scale is very different, too. I'm looking to have everything in MNI mm, ideally.

Could you tell me what units you are using exactly?

Using DSI would allow users to get a lead field based a given EEG dataset. However, this may be a bit of a detour for some SEREEGA users, who might prefer to get it from the Colin template directly; in particular, I'm thinking of head_modelColin27_10003_Standard-10-5-Cap339-Destrieux148.mat. Did you create this file yourself for this toolbox based on the original MRIs, or what is its origin? How is it licensed?

aojeda commented 5 years ago

Hi Laurens,

I am glad you find the tool useful! I checked your toolbox in the past, and it looks like a nice addition to this ecosystem, great work!

So a few things... If at some point you need to visualize the surface, then I suggest copying also hm.cortex.faces, so that you can render the cortex with the patch function. The other layers are also necessary if you want to calculate new leadfield matrices, e.g., if you have a montage that does not follow the 10-20 standard or if you have arbitrary channel locations.

Regarding the rotation, I never paid too much attention to that because it seems to be pretty arbitrary and every lab may follow their own rules. As long as the head matches the montage it's all good, it does not matter if they both rotated, but they need to match. Whether you want them aligned in one direction is another thing, in this case, it seems that permuting the xy axes will do what you want. I want to incorporate the NY template, but I haven't had time for that, it looks very nice.

My surfaces are in meters.

I understand your use case, in fact, the headModel toolbox is designed so that you can copy the entire folder into your project if that's what you want, no need to depend on DSI. Otherwise, feel free to take whatever you need. The template that I use the most is head_modelColin27_8003_Standard-10-5-Cap339 because it has the vertices more regularly sampled and that matters to me, otherwise the 10k vertices is OK too.

Here are some references. I started from the templates in Brainstorm which are extracted from Colin's template, then I fixed a bunch of topological defects using iso2mesh (most recent templates may have been corrected already I don't know). Brainstorm's templates are nice because they have several atlases defined on the cortical surface, which is not a trivial thing to achieve without special software. I do care about the atlases, but if you don't, then extracting the cortical surface from Colin's template is relatively easy using FSL tools. Now, in Brainstorm web site they say that their templates are in the MNI space, although, as you may have realized, they are not, they are shifted with respect to MNI, I don't know why though. I use an approximation to map to MNI coordinates, hm.transform2MNI(), but that may be only roughly right.

Brainstorm is licensed under GPL3, so that makes my derived head models GPL3. My code if I remember correctly is BSD (free for noncommercial use).

lrkrol commented 5 years ago

Thanks for your reply!

SEREEGA is a modular toolbox that aims to support many different head models and lead fields, which means it's primarily focused on supporting the common denominators. Cortex vertices are not currently a priority in that sense; I'm mostly just interested in the sources themselves (and as you can see, SEREEGA optionally interpolates a cortex from those for visualisation purposes -- not too neat but always possible regardless of head model).

This goal of inter-head-model-operability is also why I unfortunately have to be specific about standard coordinates.

I hadn't seen the hm.transform2MNI() function yet -- that fixes the xy and scaling issue. There's still a remaining mismatch on the Y axis, though:

image

Would you happen to have any information about this?

Did you generate the lead field in Brainstorm as well? Ideally, I would have a lead field with projections for each source in all three dimensions, allowing users to freely orient the sources, but with a default orientation in place perpendicular to the cortical surface, which I assume is the one projection that you have in your lead field now. If this can be done in Brainstorm, I should have a look at that -- but that's a very different issue than the one I opened here. Perhaps I can shoot you an e-mail about that? (After your defense of course!) The atlas is also a great feature to have, which I'd like to support in SEREEGA.

aojeda commented 5 years ago

I guess that we use different terminology, to me each vertex is a source, this usually the case in distributed source imaging, so what I do in the DSI toolbox is to estimate the "source map" that is likely to generate a given EEG "scalp map". In this view, one estimates simultaneously the amplitude of equivalent current dipoles located on each vertex, which results in a more continuous field. If I understand your application correctly, you are working with single dipole solutions, and that's why your dipoles can land anywhere and you need to interpolate? This reminds me of the idea behind the Measure Projection toolbox.

I don't understand well the figure above, so my only comment is that the brain on the right seems shifted back a little bit. Maybe you can use the Co-registration gui to fit your montage to the head model manually. See how that works here.

Find transform2MNI here. This is wasn't introduced recently but it is possible that you are working with an older version of the toolbox.

Brainstorm can be used to generate the leadfield but I didn't do that. I use the pop_forwardModel function to check the co-registration and then call OpenMEEG for leadfield computation if needed. You can specify whether you want fixed orientation leadfield or orientation free, see the example in that wiki.

Feel free to ask more questions and I'll try to get back to you as soon as I can.

Cheers!