Hi Alex,<div><br></div><div><div>The sample data has transforms for both MRI (surface RAS) -> head and MRI (surface RAS) -> RAS (non-zero origin); my file had only MRI (surface RAS) -> head. Re-running the MRI processing steps using 2.7.4 (from mne_setup_source_space onward) added this tranformation, and a slightly-modified version of the sample code gives me reasonable output in volume source space. Thanks!</div>
<div><br></div><div>Jon</div><div> </div><br><div class="gmail_quote">On Fri, May 11, 2012 at 11:14 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 Jon,<br>
<br>
that's weird. I don't really have a clue.<br>
<br>
to inspect the content of the generated forward operator you can do<br>
something like this:<br>
<br>
mne_show_fiff --in sample_audvis-meg-vol-7-fwd.fif --verbose<br>
<br>
to only search for the coordinate transformation:<br>
<br>
mne_show_fiff --in sample_audvis-meg-vol-7-fwd.fif --verbose --tag 222<br>
<br>
you can then check the difference between the sample subject and yours<br>
and see if the transform is present or not in the fif file.<br>
<br>
Alex<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, May 11, 2012 at 3:08 PM, Jon Houck <<a href="mailto:jhouck@unm.edu">jhouck@unm.edu</a>> wrote:<br>
> I had the same problem using 2.7.3-3268 and mne-python v 0.3-1 with my data,<br>
> although it worked fine with the sample dataset.<br>
><br>
> After switching to 2.7.4-3357, the sample dataset still works, but with my<br>
> own data now I get an error about the MRI RAS transformation matrix:<br>
> File<br>
> "/na/homes/jhouck/.local/lib/python2.6/site-packages/mne-0.3-py2.6.egg/mne/source_estimate.py",<br>
> line 799, in save_stc_as_volume<br>
> affine = np.dot(src[0]['mri_ras_t']['trans'], affine)<br>
> KeyError: 'mri_ras_t'<br>
><br>
> I checked with mne_collect_transforms and this transform was present in all<br>
> of the MRI sets for my subject, as well as in talairach.xfm, but not in<br>
> T1.mgz. I applied it to that file using mri_add_xform_to_header but still<br>
> see the same error. Does that transfomation matrix need to exist in T1.mgz<br>
> before the source space and inverse solution are made?<br>
><br>
> Thanks,<br>
><br>
> Jon<br>
><br>
><br>
><br>
><br>
> On Wed, May 2, 2012 at 6:10 AM, Alexandre Gramfort<br>
> <<a href="mailto:gramfort@nmr.mgh.harvard.edu">gramfort@nmr.mgh.harvard.edu</a>> wrote:<br>
>><br>
>> 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>
>><br>
>><br>
>><br>
>> On Tue, May 1, 2012 at 11:50 PM, Will Foran <<a href="mailto:willforan%2Bmne@gmail.com">willforan+mne@gmail.com</a>><br>
>> 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<br>
>> > 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<br>
>> > the<br>
>> > fiff file(?) as explored by fiff/tree.py and fiff/tag.py does not<br>
>> > 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<br>
>> > 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',<br>
>> > mode<br>
>> > 'rb' at 0x9bbfc80><br>
>> ><br>
>> > ---------------------------------------------------------------------------<br>
>> > ValueError Traceback (most recent call<br>
>> > 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>
>> ><br>
>> > /usr/lib/python2.7/site-packages/mne/fiff/constants.py:FIFF.FIFFB_MNE_PARENT_MRI_FILE<br>
>> > = 353<br>
>> ><br>
>> > _______________________________________________<br>
>> > Mne_analysis mailing list<br>
>> > <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">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<br>
>> > 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<br>
>> > 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">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>
><br>
><br>
><br>
> _______________________________________________<br>
> Mne_analysis mailing list<br>
> <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">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>
</div></div></blockquote></div><br><br clear="all"><div><br></div><br>
</div>