[Mne_analysis] Standard montages and coordinate systems
Laura Novelinkova
l.novelinkova at gmail.com
Mon Nov 27 16:20:31 EST 2017
Hi Chris,
thank you for replying.
I want(ed) to use the 'sample' subject as my default brain because I
already used it for the MEG data and wanted to do the same analysis on my
EEG data and use the same source space. 'fsaverage' approach would have
probably been more appropriate and I plan to go this route in future when I
get my hands on a Linux machine. create_default_subject requires me to have
freesurfer as far as I understood and my machine is not powerful enough to
run a Freesurfer virtual machine. I could probably do the copying manually
on Windows but I would rather do it normally once I have Linux.
For now, I think, I want to stick to the 'sample' subject. So, I have two
ways to proceed the way I see it:
1) Do two coregistrations of MEG and EEG montages writing down the
coordinates of the fiducials on the first run so that the coregistrations
are the same. I am not sure about this because in the mne's manual and
elsewhere I read that it is not something that should be done by someone as
inexperienced as I am.
2) Find the information about fiducials somewhere in the sample's files.
Use it to manually construct transformation,
To me, the second route seems to be the better one because I am more
familiar with linear algebra than anatomy. I am still not sure about what
transformations are applied to what in mne though. When I ran
mne.viz.plot_alignment with the sample data but with trans=None, nothing
was co-aligned. Then I changed trans to 'sample_audvis_raw-trans.fif'. As
the result, source space and the head became co-aligned, but electrodes did
not because, as you wrote, their coordinates are not in the head coordinate
system as mne.viz.plot_alignment assumes.
So what I need is to transform the locations from the standard montage to
the head coordinate system, for which I need the coordinate of fiducial
points in that coordinate system.
I guess my question is this: does any of the sample's files contain the
coordinates of the fiducials in the head coordinate system (or MRI) that
were used during the construction of the inverse solution?
On Mon, Nov 27, 2017 at 5:12 PM, Christopher Bailey <cjb at cfin.au.dk> wrote:
> Hi Laura,
>
> Are you sure you want to use the `sample` subject as your anatomy? If
> you’re aiming at some sort of ‘template brain’ source localisation
> approach, would something like the ‘fsaverage’ brain be more appropriate?
>
> The problem is that the transformation you load is between sample’s
> fiducial head coordinates and sample’s MRI. The default montage you load
> is however not in sample’s head frame, so your coreg is off.
>
> For the fsaverage-approach, something like the following might work. *NB:
> there’s a small bug that’s being fixed on github* (see [1]). You can
> either wait until it’s in master, or check out the fix yourself.
>
> [1](https://github.com/mne-tools/mne-python/issues/4783)
>
> /Chris
>
> subject = 'fsaverage'
> subjects_dir = '/Users/cjb/tmp/subs_dir’ # change appropriately
> mne.create_default_subject(subjects_dir=subjects_dir)
>
> montage_1005 = mne.channels.read_montage(kind='standard_1005')
> fake_info = mne.create_info(ch_names=montage_1005.ch_names, sfreq=1000,
> ch_types='eeg', montage=montage_1005)
>
> # need to write a file to load into coregistration, not possible to pass
> info directly
> fake_raw = mne.io.RawArray(np.zeros((len(fake_info['ch_names']), 1)),
> fake_info)
> fake_raw.save('fake_raw.fif', overwrite=True)
>
> # coregister and save trans
> mne.gui.coregistration(inst='fake_raw.fif', subject=subject,
> subjects_dir=subjects_dir)
>
> trans = _path_to_saved_trans.fif_
>
> # set src=None, or calculate a source space, e.g.
> # src = mne.setup_source_space(subject, subjects_dir=subjects_dir,
> spacing='oct5’)
>
> mne.viz.plot_alignment(info=fake_info, trans=trans, subject=subject,
> dig=True,
> meg=False, src=None, subjects_dir=subjects_dir)
>
>
>
>
> On 26 Nov 2017, at 13.05, Laura Novelinkova <l.novelinkova at gmail.com>
> wrote:
>
> Hello,
>
> I am trying to create an EEG forward model using
>
> 1. anatomy from the sample dataset
> 2. source space from sample_audvis-meg-oct-6-meg-inv.fif
> 3. standard 1005 montage
>
> When I check the consistency of the coordinate systems with
> plot_alignment, I see that the electrode locations are off.
>
> I think that I need to add transformation information to the info I make
> based off the standard montage. Am I right? If yes, could you please advise
> me what transformation should I use? And if no, what should I do instead?
>
> Any help will be greatly appreciated.
>
> Sincerely, Laura Novelinkova
>
> Additional info: I am on Windows 7, Python version is 2.7, mne version is
> 15, I run the code in iPython console. Below is my current code and the
> output of plot_alignment:
>
> from mayavi import mlab # without this the windows show nothing and hang python
> import mne
> from mne.datasets import sample
> import os
>
> %gui qt
>
> subject = 'sample'
> data_path = sample.data_path()
> inverse_operator_file_path = os.path.join(data_path, 'MEG', 'sample', 'sample_audvis-meg-oct-6-meg-inv.fif')
> subjects_dir = os.path.join(data_path, 'subjects')
>
> montage_1005 = mne.channels.read_montage(kind='standard_1005')
> fake_info = mne.create_info(ch_names=montage_1005.ch_names, sfreq=1000, ch_types='eeg', montage=montage_1005)
> trans = os.path.join(data_path, 'MEG', 'sample', 'sample_audvis_raw-trans.fif')
> source_space = mne.read_source_spaces(inverse_operator_file_path)
>
>
> mne.viz.plot_alignment(info=fake_info, trans=trans, subject=subject, dig=True,
> meg=False, src=source_space, subjects_dir=subjects_dir)
>
>
> <misaligned_electrodes.png>
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> 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
>
>
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171128/e07a1590/attachment-0001.html
More information about the Mne_analysis
mailing list