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 "/na/homes/jhouck/.local/lib/python2.6/site-packages/mne-0.3-py2.6.egg/mne/source_estimate.py", line 799, in save_stc_as_volume</div><div> affine = np.dot(src[0]['mri_ras_t']['trans'], affine)</div>
<div>KeyError: 'mri_ras_t'</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"><<a href="mailto:gramfort@nmr.mgh.harvard.edu" target="_blank">gramfort@nmr.mgh.harvard.edu</a>></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 <<a href="mailto:willforan%2Bmne@gmail.com" target="_blank">willforan+mne@gmail.com</a>> wrote:<br>
> With help and a new mne_volume_source_space binary from Junpeng Zhang,<br>
> run_meg_volume_tutorial.sh finishes and produces the desired files,<br>
> namely sample_audvis-meg-vol-7-meg-inv.fif.<br>
><br>
> Now plot_compute_mne_inverse_volume.py fails with "Can not find parent MRI<br>
> location." This error is raised by read_inverse_operator()<br>
> reading sample_audvis-meg-vol-7-meg-inv.fif .<br>
><br>
><br>
> I haven't had much success diving into the code, but from what I gather the<br>
> fiff file(?) as explored by fiff/tree.py and fiff/tag.py does not include<br>
> the tag for the parent MRI (FIFFB_MNE_PARENT_MRI_FILE=353).<br>
><br>
><br>
> Is there a way to confirm this?<br>
> Can a fiff file be easily modified to include it or is there a way to get<br>
> python to look in a default location (<br>
> environ['SUBJECT_DIR']/environ['SUBJECT']/MRI/ )?<br>
><br>
><br>
> Thanks!<br>
> Will<br>
><br>
> ------------------------------------------<br>
><br>
><br>
><br>
>>>> fname_inv<br>
> '../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif'<br>
><br>
>>>> inverse_operator = read_inverse_operator(fname_inv)<br>
><br>
> Reading inverse operator decomposition from<br>
> ../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif...<br>
> Reading inverse operator info... [done]<br>
> Reading inverse operator decomposition... [done]<br>
> 305 x 305 full covariance (kind = 1) found.<br>
> Read a total of 4 projection items:<br>
> PCA-v1 (1 x 102) active<br>
> PCA-v2 (1 x 102) active<br>
> PCA-v3 (1 x 102) active<br>
> Average EEG reference (1 x 60) active<br>
> Noise covariance matrix read.<br>
> 11271 x 11271 diagonal covariance (kind = 2) found.<br>
> Source covariance matrix read.<br>
> Did not find the desired covariance matrix<br>
> 11271 x 11271 diagonal covariance (kind = 5) found.<br>
> Depth priors read.<br>
> Did not find the desired covariance matrix<br>
><br>
> <open file<br>
> '../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif', mode<br>
> 'rb' at 0x9bbfc80><br>
> ---------------------------------------------------------------------------<br>
> ValueError Traceback (most recent call last)<br>
> /home/foranw/src/MNE-sample-data/<ipython-input-15-2bc8ebaf3112> in<br>
> <module>()<br>
> ----> 1 inverse_operator = read_inverse_operator(fname_inv)<br>
><br>
> /usr/lib/python2.7/site-packages/mne/minimum_norm/inverse.pyc in<br>
> read_inverse_operator(fname)<br>
> 187 #<br>
><br>
> 188<br>
> --> 189 inv['src'] = read_source_spaces_from_tree(fid, tree,<br>
> add_geom=False)<br>
> 190<br>
> 191 for s in inv['src']:<br>
><br>
> /usr/lib/python2.7/site-packages/mne/source_space.py in<br>
> read_source_spaces_from_tree(fid, tree, add_geom)<br>
> 81 for s in spaces:<br>
> 82 print ' Reading a source space...',<br>
> ---> 83 this = _read_one_source_space(fid, s)<br>
> 84 print '[done]'<br>
> 85 if add_geom:<br>
><br>
> /usr/lib/python2.7/site-packages/mne/source_space.py in<br>
> _read_one_source_space(fid, this)<br>
> 153 parent_mri = dir_tree_find(this,<br>
> FIFF.FIFFB_MNE_PARENT_MRI_FILE)<br>
> 154 if len(parent_mri) == 0:<br>
> --> 155 raise ValueError('Can not find parent MRI location')<br>
> 156<br>
> 157 mri = parent_mri[0]<br>
><br>
> ValueError: Can not find parent MRI location<br>
><br>
> ############<br>
><br>
> $ grep -Ri 'FIFFB_MNE_PARENT_MRI_FILE.*='<br>
> /usr/lib/python2.7/site-packages/mne<br>
> /usr/lib/python2.7/site-packages/mne/fiff/constants.py:FIFF.FIFFB_MNE_PARENT_MRI_FILE<br>
> = 353<br>
><br>
</div></div>> _______________________________________________<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>
><br>
><br>
> The information in this e-mail is intended only for the person to whom it is<br>
> addressed. If you believe this e-mail was sent to you in error and the<br>
> e-mail<br>
> contains patient information, please contact the Partners Compliance<br>
> HelpLine at<br>
> <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>
> error<br>
> but does not contain patient information, please contact the sender and<br>
> properly<br>
> dispose of the e-mail.<br>
><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>