I had the same problem using 2.7.3-3268 and mne-python v 0.3-1 with my data, although it worked fine with the sample dataset.<div><br></div><div>After switching to 2.7.4-3357, the sample dataset still works, but with my own data now I get an error about the MRI RAS transformation matrix: </div>

<div><div>File &quot;/na/homes/jhouck/.local/lib/python2.6/site-packages/mne-0.3-py2.6.egg/mne/source_estimate.py&quot;, line 799, in save_stc_as_volume</div><div>    affine = np.dot(src[0][&#39;mri_ras_t&#39;][&#39;trans&#39;], affine)</div>

<div>KeyError: &#39;mri_ras_t&#39;</div><div><br></div><div>I checked with mne_collect_transforms and this transform was present in all of the MRI sets for my subject, as well as in talairach.xfm, but not in T1.mgz. I applied it to that file using mri_add_xform_to_header but still see the same error.  Does that transfomation matrix need to exist in T1.mgz before the source space and inverse solution are made?</div>

<div><br></div><div>Thanks,</div><div><br></div><div>Jon</div><div><br></div><div> </div><div><br></div><br><div class="gmail_quote">On Wed, May 2, 2012 at 6:10 AM, Alexandre Gramfort <span dir="ltr">&lt;<a href="mailto:gramfort@nmr.mgh.harvard.edu" target="_blank">gramfort@nmr.mgh.harvard.edu</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hi Will,<br>
<br>
I am not sure of what goes wrong on your side.<br>
<br>
Can try the python script on the data available at:<br>
<br>
<a href="ftp://surfer.nmr.mgh.harvard.edu/pub/data/MNE-sample-data-processed.tar.gz" target="_blank">ftp://surfer.nmr.mgh.harvard.edu/pub/data/MNE-sample-data-processed.tar.gz</a><br>
<br>
it contains the processed dataset as obtained with the shell scripts<br>
available on line and<br>
the nightly build of MNE.<br>
<br>
you can explore the content of a fif file with something like:<br>
<br>
mne_show_fiff --in sample_audvis-meg-vol-7-meg-inv.fif<br>
<br>
if the python script works with these files I suspect you have an<br>
outdated version of MNE commands.<br>
<br>
hope this helps,<br>
Alex<br>
<div><div><br>
<br>
<br>
On Tue, May 1, 2012 at 11:50 PM, Will Foran &lt;<a href="mailto:willforan%2Bmne@gmail.com" target="_blank">willforan+mne@gmail.com</a>&gt; wrote:<br>
&gt; With help and a new mne_volume_source_space binary from Junpeng Zhang,<br>
&gt;  run_meg_volume_tutorial.sh finishes and produces the desired files,<br>
&gt; namely sample_audvis-meg-vol-7-meg-inv.fif.<br>
&gt;<br>
&gt; Now plot_compute_mne_inverse_volume.py fails with  &quot;Can not find parent MRI<br>
&gt; location.&quot;  This error is raised by read_inverse_operator()<br>
&gt; reading sample_audvis-meg-vol-7-meg-inv.fif .<br>
&gt;<br>
&gt;<br>
&gt; I haven&#39;t had much success diving into the code, but from what I gather the<br>
&gt; fiff file(?) as explored by fiff/tree.py and fiff/tag.py does not include<br>
&gt; the tag for the parent MRI (FIFFB_MNE_PARENT_MRI_FILE=353).<br>
&gt;<br>
&gt;<br>
&gt; Is there a way to confirm this?<br>
&gt; Can a fiff file be easily modified to include it or is there a way to get<br>
&gt; python to look in a default location (<br>
&gt; environ[&#39;SUBJECT_DIR&#39;]/environ[&#39;SUBJECT&#39;]/MRI/ )?<br>
&gt;<br>
&gt;<br>
&gt; Thanks!<br>
&gt; Will<br>
&gt;<br>
&gt; ------------------------------------------<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&gt;&gt;&gt; fname_inv<br>
&gt; &#39;../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif&#39;<br>
&gt;<br>
&gt;&gt;&gt;&gt; inverse_operator = read_inverse_operator(fname_inv)<br>
&gt;<br>
&gt; Reading inverse operator decomposition from<br>
&gt; ../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif...<br>
&gt;     Reading inverse operator info... [done]<br>
&gt;     Reading inverse operator decomposition... [done]<br>
&gt;     305 x 305 full covariance (kind = 1) found.<br>
&gt;     Read a total of 4 projection items:<br>
&gt;         PCA-v1 (1 x 102) active<br>
&gt;         PCA-v2 (1 x 102) active<br>
&gt;         PCA-v3 (1 x 102) active<br>
&gt;         Average EEG reference (1 x 60) active<br>
&gt;     Noise covariance matrix read.<br>
&gt;     11271 x 11271 diagonal covariance (kind = 2) found.<br>
&gt;     Source covariance matrix read.<br>
&gt; Did not find the desired covariance matrix<br>
&gt;     11271 x 11271 diagonal covariance (kind = 5) found.<br>
&gt;     Depth priors read.<br>
&gt; Did not find the desired covariance matrix<br>
&gt;<br>
&gt; &lt;open file<br>
&gt; &#39;../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif&#39;, mode<br>
&gt; &#39;rb&#39; at 0x9bbfc80&gt;<br>
&gt; ---------------------------------------------------------------------------<br>
&gt; ValueError                                Traceback (most recent call last)<br>
&gt; /home/foranw/src/MNE-sample-data/&lt;ipython-input-15-2bc8ebaf3112&gt; in<br>
&gt; &lt;module&gt;()<br>
&gt; ----&gt; 1 inverse_operator = read_inverse_operator(fname_inv)<br>
&gt;<br>
&gt; /usr/lib/python2.7/site-packages/mne/minimum_norm/inverse.pyc in<br>
&gt; read_inverse_operator(fname)<br>
&gt;     187     #<br>
&gt;<br>
&gt;     188<br>
&gt; --&gt; 189     inv[&#39;src&#39;] = read_source_spaces_from_tree(fid, tree,<br>
&gt; add_geom=False)<br>
&gt;     190<br>
&gt;     191     for s in inv[&#39;src&#39;]:<br>
&gt;<br>
&gt; /usr/lib/python2.7/site-packages/mne/source_space.py in<br>
&gt; read_source_spaces_from_tree(fid, tree, add_geom)<br>
&gt;      81     for s in spaces:<br>
&gt;      82         print &#39;    Reading a source space...&#39;,<br>
&gt; ---&gt; 83         this = _read_one_source_space(fid, s)<br>
&gt;      84         print &#39;[done]&#39;<br>
&gt;      85         if add_geom:<br>
&gt;<br>
&gt; /usr/lib/python2.7/site-packages/mne/source_space.py in<br>
&gt; _read_one_source_space(fid, this)<br>
&gt;     153         parent_mri = dir_tree_find(this,<br>
&gt; FIFF.FIFFB_MNE_PARENT_MRI_FILE)<br>
&gt;     154         if len(parent_mri) == 0:<br>
&gt; --&gt; 155             raise ValueError(&#39;Can not find parent MRI location&#39;)<br>
&gt;     156<br>
&gt;     157         mri = parent_mri[0]<br>
&gt;<br>
&gt; ValueError: Can not find parent MRI location<br>
&gt;<br>
&gt; ############<br>
&gt;<br>
&gt; $ grep -Ri &#39;FIFFB_MNE_PARENT_MRI_FILE.*=&#39;<br>
&gt; /usr/lib/python2.7/site-packages/mne<br>
&gt; /usr/lib/python2.7/site-packages/mne/fiff/constants.py:FIFF.FIFFB_MNE_PARENT_MRI_FILE<br>
&gt;    = 353<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; Mne_analysis mailing list<br>
&gt; <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
&gt;<br>
&gt;<br>
&gt; The information in this e-mail is intended only for the person to whom it is<br>
&gt; addressed. If you believe this e-mail was sent to you in error and the<br>
&gt; e-mail<br>
&gt; contains patient information, please contact the Partners Compliance<br>
&gt; HelpLine at<br>
&gt; <a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in<br>
&gt; error<br>
&gt; but does not contain patient information, please contact the sender and<br>
&gt; properly<br>
&gt; dispose of the e-mail.<br>
&gt;<br>
<br>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
</blockquote></div><br><br clear="all"><div><br></div>
</div>