<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Laura,
<div class=""><br class="">
</div>
<div class="">Are you sure you want to use the `<font face="SauceCodePowerline-Regular" class="">sample</font>` subject as your anatomy? If you’re aiming at some sort of ‘template brain’ source localisation approach, would something like the ‘<font face="SauceCodePowerline-Regular" class="">fsaverage</font>’
 brain be more appropriate?</div>
<div class=""><br class="">
</div>
<div class="">The problem is that the transformation you load is between <font face="SauceCodePowerline-Regular" class="">
sample</font>’s fiducial head coordinates and <font face="SauceCodePowerline-Regular" class="">
sample</font>’s MRI. The default montage you load is however not in <font face="SauceCodePowerline-Regular" class="">
sample</font>’s head frame, so your coreg is off.&nbsp;</div>
<div class="">
<div class=""><br class="">
</div>
<div class="">For the&nbsp;<span style="font-family: SauceCodePowerline-Regular;" class="">fsaverage</span>-approach, something like the following might work.
<b class="">NB: there’s a small bug that’s being fixed on github</b> (see [1]). You can either wait until it’s in master, or check out the fix yourself.</div>
<div class=""><br class="">
</div>
<div class="">[1](<a href="https://github.com/mne-tools/mne-python/issues/4783" class="">https://github.com/mne-tools/mne-python/issues/4783</a>)</div>
<div class=""><br class="">
</div>
<div class="">/Chris</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">subject = 'fsaverage'</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">subjects_dir = '/Users/cjb/tmp/subs_dir’ &nbsp;# change appropriately</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">mne.create_default_subject(subjects_dir=subjects_dir)</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""><br class="">
</font></div>
<div class="">
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">montage_1005 = mne.channels.read_montage(kind='standard_1005')</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">fake_info = mne.create_info(ch_names=montage_1005.ch_names, sfreq=1000, ch_types='eeg', montage=montage_1005)</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""><br class="">
</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""># need to write a file to load into coregistration, not possible to pass info directly</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">fake_raw = mne.io.RawArray(np.zeros((len(fake_info['ch_names']), 1)), fake_info)</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">fake_raw.save('fake_raw.fif', overwrite=True)</font></div>
</div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""><br class="">
</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""># coregister and save trans</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">mne.gui.coregistration(inst='fake_raw.fif', subject=subject, subjects_dir=subjects_dir)</font></div>
</div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""><br class="">
</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">trans = _path_to_saved_trans.fif_</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""><br class="">
</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class=""># set src=None, or calculate a source space, e.g.</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">#&nbsp;</font><font face="SauceCodePowerline-Regular" class=""><span style="font-size: 11px;" class="">src = mne.setup_source_space(subject, subjects_dir=subjects_dir,</span></font></div>
<font face="SauceCodePowerline-Regular" class=""><span style="font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;spacing='oct5’)</span></font></div>
<div class=""><font face="SauceCodePowerline-Regular" class=""><span style="font-size: 11px;" class=""><br class="">
</span></font>
<div class="">
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">mne.viz.plot_alignment(info=fake_info, trans=trans, subject=subject, dig=True,</font></div>
<div class=""><font face="SauceCodePowerline-Regular" style="font-size: 11px;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;meg=False, src=None, subjects_dir=subjects_dir)</font></div>
</div>
<div class=""><br class="">
</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 26 Nov 2017, at 13.05, Laura Novelinkova &lt;<a href="mailto:l.novelinkova@gmail.com" class="">l.novelinkova@gmail.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hello,
<div class=""><br class="">
</div>
<div class="">I am trying to create an EEG forward model using&nbsp;</div>
<div class="">
<ol class="">
<li class="">anatomy from the sample dataset&nbsp;</li><li class="">source space from&nbsp;<span style="color:rgb(0,128,128);font-weight:bold;font-family:&quot;Courier New&quot;;font-size:9pt" class="">sample_audvis-meg-oct-6-meg-inv.fif</span><br class="">
</li><li class="">standard 1005 montage</li></ol>
</div>
<div class="">When I check the consistency of the coordinate systems with&nbsp;<span style="font-family: 'Courier New'; font-size: 9pt;" class="">plot_alignment,&nbsp;</span>I see that the electrode locations are off.&nbsp;</div>
<div class=""><br class="">
</div>
<div class="">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?</div>
<div class=""><br class="">
</div>
<div class="">Any help will be greatly appreciated.</div>
<div class=""><br class="">
</div>
<div class="">Sincerely, Laura Novelinkova</div>
<div class=""><br class="">
</div>
<div class="">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&nbsp;<span style="font-family: 'Courier New'; font-size: 12px;" class="">plot_alignment</span>:</div>
<div class="">
<pre style="font-family: 'Courier New'; font-size: 9pt;" class=""><span style="color:rgb(0,0,128);font-weight:bold" class="">from </span>mayavi <span style="color:rgb(0,0,128);font-weight:bold" class="">import </span>mlab  <span style="color:rgb(128,128,128);font-style:italic" class=""># without this the windows show nothing and hang python<br class=""></span><span style="color:rgb(0,0,128);font-weight:bold" class="">import </span>mne<br class=""><span style="color:rgb(0,0,128);font-weight:bold" class="">from </span>mne.datasets <span style="color:rgb(0,0,128);font-weight:bold" class="">import </span>sample<br class=""><span style="color:rgb(0,0,128);font-weight:bold" class="">import </span>os<br class=""><br class="">%gui qt<br class=""><br class="">subject = <span style="color:rgb(0,128,128);font-weight:bold" class="">'sample'<br class=""></span>data_path = sample.data_path()<br class="">inverse_operator_file_path = os.path.join(data_path, <span style="color:rgb(0,128,128);font-weight:bold" class="">'MEG'</span>, <span style="color:rgb(0,128,128);font-weight:bold" class="">'sample'</span>, <span style="color:rgb(0,128,128);font-weight:bold" class="">'sample_audvis-meg-oct-6-meg-inv.fif'</span>)<br class="">subjects_dir = os.path.join(data_path, <span style="color:rgb(0,128,128);font-weight:bold" class="">'subjects'</span>)<br class=""><br class="">montage_1005 = mne.channels.read_montage(<span style="color:rgb(102,0,153)" class="">kind</span>=<span style="color:rgb(0,128,128);font-weight:bold" class="">'standard_1005'</span>)<br class="">fake_info = mne.create_info(<span style="color:rgb(102,0,153)" class="">ch_names</span>=montage_1005.ch_names, <span style="color:rgb(102,0,153)" class="">sfreq</span>=<span style="color:rgb(0,0,255)" class="">1000</span>, <span style="color:rgb(102,0,153)" class="">ch_types</span>=<span style="color:rgb(0,128,128);font-weight:bold" class="">'eeg'</span>, <span style="color:rgb(102,0,153)" class="">montage</span>=montage_1005)<br class="">trans = os.path.join(data_path, <span style="color:rgb(0,128,128);font-weight:bold" class="">'MEG'</span>, <span style="color:rgb(0,128,128);font-weight:bold" class="">'sample'</span>, <span style="color:rgb(0,128,128);font-weight:bold" class="">'sample_audvis_raw-trans.fif'</span>)<br class="">source_space = mne.read_source_spaces(inverse_operator_file_path)<br class=""><br class=""><br class="">mne.viz.plot_alignment(<span style="color:rgb(102,0,153)" class="">info</span>=fake_info, <span style="color:rgb(102,0,153)" class="">trans</span>=trans, <span style="color:rgb(102,0,153)" class="">subject</span>=subject, <span style="color:rgb(102,0,153)" class="">dig</span>=<span style="color:rgb(0,0,128);font-weight:bold" class="">True</span>,<br class="">                       <span style="color:rgb(102,0,153)" class="">meg</span>=<span style="color:rgb(0,0,128);font-weight:bold" class="">False</span>, <span style="color:rgb(102,0,153)" class="">src</span>=source_space, <span style="color:rgb(102,0,153)" class="">subjects_dir</span>=subjects_dir)</pre>
<pre style="font-family: 'Courier New'; font-size: 9pt;" class=""><br class=""></pre>
<pre style="font-family: 'Courier New'; font-size: 9pt;" class=""><span id="cid:ii_15ff8373de6ee475">&lt;misaligned_electrodes.png&gt;</span><br class=""></pre>
</div>
</div>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" class=""><br class="">
<table style="border-top:1px solid #d3d4de" class="">
<tbody class="">
<tr class="">
<td style="width:55px;padding-top:13px" class=""><a href="https://www.avast.com/sig-email?utm_medium=email&amp;utm_source=link&amp;utm_campaign=sig-email&amp;utm_content=webmail&amp;utm_term=icon" target="_blank" class=""><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" class=""></a></td>
<td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px" class="">
Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&amp;utm_source=link&amp;utm_campaign=sig-email&amp;utm_content=webmail&amp;utm_term=link" target="_blank" style="color:#4453ea" class="">
www.avast.com</a> </td>
</tr>
</tbody>
</table>
<a href="x-msg://30/#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1" class=""></a></div>
_______________________________________________<br class="">
Mne_analysis mailing list<br class="">
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" class="">Mne_analysis@nmr.mgh.harvard.edu</a><br class="">
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis<br class="">
<br class="">
<br class="">
The information in this e-mail is intended only for the person to whom it is<br class="">
addressed. If you believe this e-mail was sent to you in error and the e-mail<br class="">
contains patient information, please contact the Partners Compliance HelpLine at<br class="">
http://www.partners.org/complianceline . If the e-mail was sent to you in error<br class="">
but does not contain patient information, please contact the sender and properly<br class="">
dispose of the e-mail.<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>