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

Alexandre Gramfort gramfort at nmr.mgh.harvard.edu
Fri May 11 13:14:38 EDT 2012
Search archives:

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

On Fri, May 11, 2012 at 3:08 PM, Jon Houck <jhouck at unm.edu> wrote:
> 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
>
>
>
>
> On Wed, May 2, 2012 at 6:10 AM, Alexandre Gramfort
> <gramfort at nmr.mgh.harvard.edu> wrote:
>>
>> 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
>>
>>
>>
>> On Tue, May 1, 2012 at 11:50 PM, Will Foran <willforan+mne at gmail.com>
>> wrote:
>> > 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 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
>> >
>> > ------------------------------------------
>> >
>> >
>> >
>> >>>> fname_inv
>> > '../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif'
>> >
>> >>>> inverse_operator = read_inverse_operator(fname_inv)
>> >
>> > Reading inverse operator decomposition from
>> > ../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif...
>> >     Reading inverse operator info... [done]
>> >     Reading inverse operator decomposition... [done]
>> >     305 x 305 full covariance (kind = 1) found.
>> >     Read a total of 4 projection items:
>> >         PCA-v1 (1 x 102) active
>> >         PCA-v2 (1 x 102) active
>> >         PCA-v3 (1 x 102) active
>> >         Average EEG reference (1 x 60) active
>> >     Noise covariance matrix read.
>> >     11271 x 11271 diagonal covariance (kind = 2) found.
>> >     Source covariance matrix read.
>> > Did not find the desired covariance matrix
>> >     11271 x 11271 diagonal covariance (kind = 5) found.
>> >     Depth priors read.
>> > Did not find the desired covariance matrix
>> >
>> > <open file
>> > '../MNE-sample-data/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif',
>> > mode
>> > 'rb' at 0x9bbfc80>
>> >
>> > ---------------------------------------------------------------------------
>> > ValueError                                Traceback (most recent call
>> > last)
>> > /home/foranw/src/MNE-sample-data/<ipython-input-15-2bc8ebaf3112> in
>> > <module>()
>> > ----> 1 inverse_operator = read_inverse_operator(fname_inv)
>> >
>> > /usr/lib/python2.7/site-packages/mne/minimum_norm/inverse.pyc in
>> > read_inverse_operator(fname)
>> >     187     #
>> >
>> >     188
>> > --> 189     inv['src'] = read_source_spaces_from_tree(fid, tree,
>> > add_geom=False)
>> >     190
>> >     191     for s in inv['src']:
>> >
>> > /usr/lib/python2.7/site-packages/mne/source_space.py in
>> > read_source_spaces_from_tree(fid, tree, add_geom)
>> >      81     for s in spaces:
>> >      82         print '    Reading a source space...',
>> > ---> 83         this = _read_one_source_space(fid, s)
>> >      84         print '[done]'
>> >      85         if add_geom:
>> >
>> > /usr/lib/python2.7/site-packages/mne/source_space.py in
>> > _read_one_source_space(fid, this)
>> >     153         parent_mri = dir_tree_find(this,
>> > FIFF.FIFFB_MNE_PARENT_MRI_FILE)
>> >     154         if len(parent_mri) == 0:
>> > --> 155             raise ValueError('Can not find parent MRI location')
>> >     156
>> >     157         mri = parent_mri[0]
>> >
>> > ValueError: Can not find parent MRI location
>> >
>> > ############
>> >
>> > $ grep -Ri 'FIFFB_MNE_PARENT_MRI_FILE.*='
>> > /usr/lib/python2.7/site-packages/mne
>> >
>> > /usr/lib/python2.7/site-packages/mne/fiff/constants.py:FIFF.FIFFB_MNE_PARENT_MRI_FILE
>> >    = 353
>> >
>> > _______________________________________________
>> > Mne_analysis mailing list
>> > Mne_analysis at nmr.mgh.harvard.edu
>> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>> >
>> >
>> > The information in this e-mail is intended only for the person to whom
>> > it is
>> > addressed. If you believe this e-mail was sent to you in error and the
>> > e-mail
>> > contains patient information, please contact the Partners Compliance
>> > HelpLine at
>> > http://www.partners.org/complianceline . If the e-mail was sent to you
>> > in
>> > error
>> > but does not contain patient information, please contact the sender and
>> > properly
>> > dispose of the e-mail.
>> >
>>
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>
>
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the
> e-mail
> contains patient information, please contact the Partners Compliance
> HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in
> error
> but does not contain patient information, please contact the sender and
> properly
> dispose of the e-mail.
>




More information about the Mne_analysis mailing list