[python read_inverse_operator()] Can not find parent MRI location

With help and a new mne_volume_source_space binary from Junpeng Zhang,
run_meg_volume_tutorial.sh finishes and produces the desired files, namely *
sample_audvis-meg-vol-7-meg-inv.fif*.

Now plot_compute_mne_inverse_volume.py<http://www.martinos.org/mne/auto_examples/inverse/plot_compute_mne_inverse_volume.html>
fails
with "Can not find parent MRI location." This error is raised by
read_inverse_operator() reading sample_audvis-meg-vol-7-meg-inv.fif .

I haven't had much success diving into the code, but from what I gather the
fiff file(?) as explored by fiff/tree.py and fiff/tag.py does not include
the tag for the parent MRI (FIFFB_MNE_PARENT_MRI_FILE=353).

Is there a way to confirm this?
Can a fiff file be easily modified to include it or is there a way to get
python to look in a default location
(environ['SUBJECT_DIR']/environ['SUBJECT']/MRI/
)?

Thanks!
Will

hi Will,

I am not sure of what goes wrong on your side.

Can try the python script on the data available at:

ftp://surfer.nmr.mgh.harvard.edu/pub/data/MNE-sample-data-processed.tar.gz

it contains the processed dataset as obtained with the shell scripts
available on line and
the nightly build of MNE.

you can explore the content of a fif file with something like:

mne_show_fiff --in sample_audvis-meg-vol-7-meg-inv.fif

if the python script works with these files I suspect you have an
outdated version of MNE commands.

hope this helps,
Alex

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.

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:
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
    affine = np.dot(src[0]['mri_ras_t']['trans'], affine)
KeyError: 'mri_ras_t'

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?

Thanks,

Jon

hi Jon,

that's weird. I don't really have a clue.

to inspect the content of the generated forward operator you can do
something like this:

mne_show_fiff --in sample_audvis-meg-vol-7-fwd.fif --verbose

to only search for the coordinate transformation:

mne_show_fiff --in sample_audvis-meg-vol-7-fwd.fif --verbose --tag 222

you can then check the difference between the sample subject and yours
and see if the transform is present or not in the fif file.

Alex

Hi Alex,

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!

Jon

great news !

thanks for also sharing the success with MNE and Python :slight_smile:

Alex