[Mne_analysis] Error running make_forward_solution: Head<-->sensor transform not found

Eric Larson larson.eric.d at gmail.com
Thu Nov 19 12:05:11 EST 2015
Search archives:

No problem, glad it's working. FYI the latest version is actually 0.10, so
feel free to upgrade to that if you want, too.

Eric


On Thu, Nov 19, 2015 at 11:34 AM, Emily Stephen <emilyps14 at gmail.com> wrote:

> I noticed that the default python distribution on the Martinos system was
> using MNE 0.8. Switched to the anaconda distribution which was using MNE
> 0.9.
>
> After working through some bugs related to the version change, I no longer
> get the error I reported before.
>
> Sorry for wasting your time!
>
> Emily
>
> On Wed, Nov 18, 2015 at 4:02 PM, Emily Stephen <emilyps14 at gmail.com>
> wrote:
>
>> Update:
>>
>> (1) Re Hari's suggestion
>>
>> I tried converting the fif file to a hpts file using the C implementation:
>> (from the shell)
>> mne_convert_dig_data --fif $SUBJECT.fif --hptsout $SUBJECT.hpts
>> --headcoord
>>
>> (from python)
>> digfile_hpts = op.join(subjects_dir, subject, subject + '.hpts')
>> montage = mne.channels.read_montage(digfile_hpts)
>> raw = mne.io.read_raw_brainvision(subjects_dir + subject + '/' + subject
>> + '.vhdr',
>>                                   montage=montage, verbose=None,
>> preload=False)
>>
>> This raises a new error:
>> None of the sensors defined in the montage were found in the info
>> structure. Check the channel names.
>>
>> The channel names in the montage are of the form '0001' ... '0291', with
>> duplicated '0001' ... '0064' at the end. The channel names in the raw data
>> are of the form '01' ... '64'.
>>
>> I noticed that the first column in the .hpts file has 'eeg' for the last
>> 64 rows (vs 'cardinal', 'hpi', and 'extra' for the previous ones). This
>> first column isn't being used by read_montage, but I think it is what
>> distinguishes the eeg channel locations from the other digitizer info.
>>
>> I could manually change the channel names in the .hpts file to '01' ...
>> '64' for those rows, to match the channel names in the Brainvision file.
>> Not a pretty solution, but it might work.
>>
>> (2) Re Eric's comment
>>
>> I'd be happy to cut down the script/files. Where should I upload files?
>> I'm at Martinos, want to be sure to follow HIPAA etc.
>>
>> In the meantime, I've created an issue on github linking back to this
>> thread.
>>
>> Thanks,
>> Emily
>>
>> On Wed, Nov 18, 2015 at 8:44 AM, <
>> mne_analysis-request at nmr.mgh.harvard.edu> wrote:
>>
>>> Send Mne_analysis mailing list submissions to
>>>         mne_analysis at nmr.mgh.harvard.edu
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>         https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>> or, via email, send a message with subject or body 'help' to
>>>         mne_analysis-request at nmr.mgh.harvard.edu
>>>
>>> You can reach the person managing the list at
>>>         mne_analysis-owner at nmr.mgh.harvard.edu
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of Mne_analysis digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>>    1. Error running make_forward_solution: Head<-->sensor       transform
>>>       not found (Emily Stephen)
>>>    2. Re: Error running make_forward_solution: Head<-->sensor
>>>       transform not found (Hari Bharadwaj)
>>>    3. Re: Error running make_forward_solution: Head<-->sensor
>>>       transform not found (Eric Larson)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Tue, 17 Nov 2015 19:07:05 -0500
>>> From: Emily Stephen <emilyps14 at gmail.com>
>>> Subject: [Mne_analysis] Error running make_forward_solution:
>>>         Head<-->sensor  transform not found
>>> To: mne_analysis at nmr.mgh.harvard.edu
>>> Message-ID:
>>>         <CAHgMKiV9thqbaSLYNU31jCZ4FCdUoYbraAUW3=+
>>> o4wM+CSBJqA at mail.gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>>
>>> Hi All,
>>>
>>> I'm getting an error when I run mne.make_forward_solution, but only if I
>>> try to save the result.
>>>
>>> That is, if I set fname=None then the whole thing runs fine, but if I set
>>> fname=<filename>, it fails in the call to write_forward_solution with the
>>> error:
>>> Head<-->sensor transform not found
>>>
>>> Seems like write_forward_solution is expecting values in info under
>>> dev_head_t or ctf_head_t, which never got set.
>>>
>>> I think it may be related to the fact that I'm loading (just EEG) data
>>> from
>>> a brainvision file using mne.io.read_raw_brainvision.
>>>
>>> I've been struggling to figure out how to include the digitizer
>>> information
>>> in the preprocessed data. My digitizer info is in a .fif file that
>>> otherwise doesn't contain any measurement data (I can't even figure out
>>> how
>>> to load it using the python MNE). So far the only thing I've done with
>>> that
>>> file is to use it to update the channel locations with a call to the C
>>> implementation:
>>>     call(['mne_check_eeg_locations',
>>>           '--file', fname,
>>>           '--dig', op.join(subjects_dir,subject,subject + '.fif'),
>>>           '--fix'])
>>>
>>> I'm new to all of this (including python) so any help would be much
>>> appreciated! I've attached the code (apologies for the mess).
>>>
>>> Thanks,
>>> Emily
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL:
>>> http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151117/e57b3044/attachment-0001.html
>>> -------------- next part --------------
>>> A non-text attachment was scrubbed...
>>> Name: test_eeganes07_151112.py
>>> Type: text/x-python-script
>>> Size: 4538 bytes
>>> Desc: not available
>>> Url :
>>> http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151117/e57b3044/attachment-0001.bin
>>>
>>> ------------------------------
>>>
>>> Message: 2
>>> Date: Tue, 17 Nov 2015 22:13:03 -0500 (EST)
>>> From: "Hari Bharadwaj" <hari at nmr.mgh.harvard.edu>
>>> Subject: Re: [Mne_analysis] Error running make_forward_solution:
>>>         Head<-->sensor transform not found
>>> To: "Discussion and support forum for the users of MNE Software"
>>>         <mne_analysis at nmr.mgh.harvard.edu>
>>> Cc: mne_analysis at nmr.mgh.harvard.edu
>>> Message-ID:
>>>         <
>>> 51230.24.34.210.250.1447816383.squirrel at mail.nmr.mgh.harvard.edu>
>>> Content-Type: text/plain;charset=iso-8859-1
>>>
>>> Hi Emily,
>>>    Perhaps you could try converting the digitization data to one of the
>>> formats (e.g., .hpts) accepted by mne.channels.read_montage(.) using
>>> the C-version of mne_convert_dig_data (if they are already not
>>> available in one of those formats). Once you do that and read it into
>>> python as a Montage object using mne.channels.read_montage(.), you
>>> could supply it as to the montage argument in
>>> mne.io.read_raw_brainvision(.).
>>>
>>> Also, the digitization data should contain cardinal points (like nasion,
>>> LPA, RAP) for the head along with the EEG sensor locations.. That way,
>>> "head coordinated" and "sensor coordinates" can be matched in the
>>> Montage.
>>>
>>> HTH,
>>> Hari
>>>
>>>
>>>
>>> On Tue, November 17, 2015 7:07 pm, Emily Stephen wrote:
>>> > Hi All,
>>> >
>>> > I'm getting an error when I run mne.make_forward_solution, but only if
>>> I
>>> > try to save the result.
>>> >
>>> > That is, if I set fname=None then the whole thing runs fine, but if I
>>> set
>>> > fname=<filename>, it fails in the call to write_forward_solution with
>>> the
>>> > error:
>>> > Head<-->sensor transform not found
>>> >
>>> > Seems like write_forward_solution is expecting values in info under
>>> > dev_head_t or ctf_head_t, which never got set.
>>> >
>>> > I think it may be related to the fact that I'm loading (just EEG) data
>>> > from
>>> > a brainvision file using mne.io.read_raw_brainvision.
>>> >
>>> > I've been struggling to figure out how to include the digitizer
>>> > information
>>> > in the preprocessed data. My digitizer info is in a .fif file that
>>> > otherwise doesn't contain any measurement data (I can't even figure out
>>> > how
>>> > to load it using the python MNE). So far the only thing I've done with
>>> > that
>>> > file is to use it to update the channel locations with a call to the C
>>> > implementation:
>>> >     call(['mne_check_eeg_locations',
>>> >           '--file', fname,
>>> >           '--dig', op.join(subjects_dir,subject,subject + '.fif'),
>>> >           '--fix'])
>>> >
>>> > I'm new to all of this (including python) so any help would be much
>>> > appreciated! I've attached the code (apologies for the mess).
>>> >
>>> > Thanks,
>>> > Emily
>>> > _______________________________________________
>>> > Mne_analysis mailing list
>>> > Mne_analysis at nmr.mgh.harvard.edu
>>> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>
>>>
>>> --
>>> Hari Bharadwaj
>>> Research Fellow
>>> Martinos Center for Biomedical Imaging,
>>> Massachusetts General Hospital
>>> 149 Thirteenth Street,
>>> Charlestown, MA 02129
>>>
>>> hari at nmr.mgh.harvard.edu
>>> Ph: 734-883-5954
>>> www.haribharadwaj.com
>>>
>>>
>>> ------------------------------
>>>
>>> Message: 3
>>> Date: Wed, 18 Nov 2015 08:44:22 -0500
>>> From: Eric Larson <larson.eric.d at gmail.com>
>>> Subject: Re: [Mne_analysis] Error running make_forward_solution:
>>>         Head<-->sensor transform not found
>>> To: Discussion and support forum for the users of MNE Software
>>>         <mne_analysis at nmr.mgh.harvard.edu>
>>> Message-ID:
>>>         <CAGu2niVt3EnAv1566f=
>>> JjFWXVBof-yrC09f0M_+NTs60mKrPrg at mail.gmail.com>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> Can you simplify the script to use a minimal number of files and lines to
>>> reproduce the error (e.g., hopefully it doesn't depend on bad channels at
>>> all), and upload the necessary files and script somewhere? I guess that
>>> error could happen if you only have sensors in head coordinates to start
>>> with -- we can probably work around it.
>>>
>>> It shouldn't be too difficult to add that digitization information
>>> without
>>> having to resort to MNE-C tools. Feel free to open an mne-python issue
>>> about this stuff so we can hash out a solution, then we can report back
>>> to
>>> this thread.
>>>
>>> Eric
>>>
>>>
>>> On Tue, Nov 17, 2015 at 10:13 PM, Hari Bharadwaj <
>>> hari at nmr.mgh.harvard.edu>
>>> wrote:
>>>
>>> > Hi Emily,
>>> >    Perhaps you could try converting the digitization data to one of the
>>> > formats (e.g., .hpts) accepted by mne.channels.read_montage(.) using
>>> > the C-version of mne_convert_dig_data (if they are already not
>>> > available in one of those formats). Once you do that and read it into
>>> > python as a Montage object using mne.channels.read_montage(.), you
>>> > could supply it as to the montage argument in
>>> > mne.io.read_raw_brainvision(.).
>>> >
>>> > Also, the digitization data should contain cardinal points (like
>>> nasion,
>>> > LPA, RAP) for the head along with the EEG sensor locations.. That way,
>>> > "head coordinated" and "sensor coordinates" can be matched in the
>>> Montage.
>>> >
>>> > HTH,
>>> > Hari
>>>
>>> >
>>> >
>>> > On Tue, November 17, 2015 7:07 pm, Emily Stephen wrote:
>>> > > Hi All,
>>> > >
>>> > > I'm getting an error when I run mne.make_forward_solution, but only
>>> if I
>>> > > try to save the result.
>>> > >
>>> > > That is, if I set fname=None then the whole thing runs fine, but if
>>> I set
>>> > > fname=<filename>, it fails in the call to write_forward_solution
>>> with the
>>> > > error:
>>> > > Head<-->sensor transform not found
>>> > >
>>> > > Seems like write_forward_solution is expecting values in info under
>>> > > dev_head_t or ctf_head_t, which never got set.
>>> > >
>>> > > I think it may be related to the fact that I'm loading (just EEG)
>>> data
>>> > > from
>>> > > a brainvision file using mne.io.read_raw_brainvision.
>>> > >
>>> > > I've been struggling to figure out how to include the digitizer
>>> > > information
>>> > > in the preprocessed data. My digitizer info is in a .fif file that
>>> > > otherwise doesn't contain any measurement data (I can't even figure
>>> out
>>> > > how
>>> > > to load it using the python MNE). So far the only thing I've done
>>> with
>>> > > that
>>> > > file is to use it to update the channel locations with a call to the
>>> C
>>> > > implementation:
>>> > >     call(['mne_check_eeg_locations',
>>> > >           '--file', fname,
>>> > >           '--dig', op.join(subjects_dir,subject,subject + '.fif'),
>>> > >           '--fix'])
>>> > >
>>> > > I'm new to all of this (including python) so any help would be much
>>> > > appreciated! I've attached the code (apologies for the mess).
>>> > >
>>> > > Thanks,
>>> > > Emily
>>> > > _______________________________________________
>>> > > Mne_analysis mailing list
>>> > > Mne_analysis at nmr.mgh.harvard.edu
>>> > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>> >
>>> >
>>> > --
>>> > Hari Bharadwaj
>>> > Research Fellow
>>> > Martinos Center for Biomedical Imaging,
>>> > Massachusetts General Hospital
>>> > 149 Thirteenth Street,
>>> > Charlestown, MA 02129
>>> >
>>> > hari at nmr.mgh.harvard.edu
>>> > Ph: 734-883-5954
>>> > www.haribharadwaj.com
>>> > _______________________________________________
>>> > 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.
>>> >
>>> >
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL:
>>> http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151118/33c316c2/attachment.html
>>>
>>> ------------------------------
>>>
>>> _______________________________________________
>>> Mne_analysis mailing list
>>> Mne_analysis at nmr.mgh.harvard.edu
>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>>
>>> End of Mne_analysis Digest, Vol 94, Issue 7
>>> *******************************************
>>>
>>
>>
>
> _______________________________________________
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20151119/565599b9/attachment-0001.html 


More information about the Mne_analysis mailing list