Using standard head

External Email - Use Caution

Hi all,

What's the right sequence of steps when setting up a new subject with just
MEG and no structural MRI?

I've seen the slides at
https://www.slideshare.net/mne-python/mnepython-scale-mri and they say one
needs to select a subject folder and copy the fsaverage template to it. But
to select a folder there should already be a BEM there as it looks from the
code so it looks like catch 22. Or is there something I misunderstand?

Thanks,

Vladimir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180918/d126f7b8/attachment.html

External Email - Use Caution

Hi Vladimir,

The subjects_dir is the directory which will contain your MRI subject folders. It doe snot need to contain any MRIs yet.

Christian

Hi Vladimir,

You should be able to make the BEM with freesurfer using mri_watershed or as a call within the MNE library to, I believe, mne_watershed_bem. See here: https://martinos.org/mne/dev/manual/appendix/bem_model.html

I made the watershed BEM for fsaverage at some point, so I could also send you my output it you can?t get it to work..

If that is the only thing missing with following those slides, you should be good to go.

Regards,
Josh

Joshua Bear, MD, MA | Assistant Professor, Pediatric Neurology and Epilepsy
13123 East 16th Avenue, Box B-155 | Aurora, CO 80045 | Phone: 720-777-6138 | Fax: 720-777-7285

        External Email - Use Caution

Hi all,

What's the right sequence of steps when setting up a new subject with just MEG and no structural MRI?

I've seen the slides at MNE-Python Scale MRI | PPT and they say one needs to select a subject folder and copy the fsaverage template to it. But to select a folder there should already be a BEM there as it looks from the code so it looks like catch 22. Or is there something I misunderstand?

Thanks,

Vladimir
_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

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
MyComplianceReport.com: Compliance and Ethics Reporting . 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/20180918/149cefd5/attachment-0002.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image010.jpg
Type: image/jpeg
Size: 591328 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180918/149cefd5/attachment-0001.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1501 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180918/149cefd5/attachment-0001.bin
-------------- next part --------------
        External Email - Use Caution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180918/149cefd5/attachment-0003.html

External Email - Use Caution

Hi Vladimir,
This below should help you:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
create bem model for fsaverage
This is done only once
"""

import mne

root_dir = '/Your/data/path/'
subjects_dir = root_dir + 'subjects/'
mne.set_config('SUBJECTS_DIR',subjects_dir)
subject = 'fsaverage'

# This defines a source space (a mesh)
src = mne.setup_source_space(subject=subject,spacing='ico4')
mne.write_source_spaces(subjects_dir + subject +'/'+
subject+'-ico4-src.fif',src)

# Create and solve a BEM model takes a few lines
# following line crashes in my install but I was too lazy to file an issue.
lines below do the same calling shell scripts
#mne.bem.make_watershed_bem(subject=subject,overwrite=True)
from subprocess import call
code = call(['mne','watershed_bem','-s',subject,'--overwrite'])
if code:
    raise ValueError('mne_watershed_bem failed')

# Make BEM
model = mne.bem.make_bem_model(subject = subject, conductivity=[0.3])
mne.bem.write_bem_surfaces(subjects_dir+ subject +'/' +
subject+'-5120-bem.fif', model)

# solve BEM
bem_sol = mne.bem.make_bem_solution(model)
mne.bem.write_bem_solution(subjects_dir+ subject +'/' +
subject+'-5120-bem-sol.fif',bem_sol)

# check that everything completed properly. Compare with online tutorial
https://www.martinos.org/mne/stable/auto_tutorials/plot_forward.html#sphx-glr-auto-tutorials-plot-forward-py
mne.viz.plot_bem(subject=subject, subjects_dir=subjects_dir,
                 brain_surfaces='white', orientation='coronal',
                 src = subjects_dir + subject +'/'+ subject+'-ico4-src.fif')

# the following lines will plot your BEM and source model together. (same
tutorial)
import numpy as np # noqa
from mayavi import mlab # noqa
from surfer import Brain # noqa

brain = Brain('sample', 'lh', 'inflated', subjects_dir=subjects_dir)
surf = brain.geo['lh']

vertidx = np.where(src[0]['inuse'])[0]

mlab.points3d(surf.x[vertidx], surf.y[vertidx],
              surf.z[vertidx], color=(1, 1, 0), scale_factor=1.5)

Le mar. 18 sept. 2018 ? 20:56, Christian Markus Brodbeck <brodbeck at umd.edu>
a ?crit :

        External Email - Use Caution

Hi Vladimir,

The subjects_dir is the directory which will contain your MRI subject
folders. It doe snot need to contain any MRIs yet.

Christian

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

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
MyComplianceReport.com: Compliance and Ethics Reporting . 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/20180919/f3bb2549/attachment.html

External Email - Use Caution

Thank you both. I think I figured it out at least with the GUI. If anyone
has example code for how to scale the head and create individual head from
the average in a script, that could still be helpful (though not critical
at this stage).

Thanks,

Vladimir

External Email - Use Caution

Hi Vladimir,

I don?t think the initial step of transforming the average head to fit the participant is reliable enough to do completely with a script (please correct me if this is possible now).

However, once you have determined the initial transformation with the GUI (and saved the MRI) you can then use different functions that scale different components of the MRI, and they should use the relevant scaling parameter(s) from the *.config file written by the initial transformation.

For example, if after scaling you generate a new source space in fsaverage, you can then use

mne.scale_source_space(subject_to, src_name, subjects_dir=subjects_dir)

to add the new source space to the scaled brain of subject_to. Look for the documentation of the scale_x functions under Page Redirection

Christian