# Convert brainstorm channel .xyz file or sfp file	into mne raw fif

**URL:** <https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [December 6, 2018, 5:03pm UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673 "2018-12-06T17:03:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 6, 2018, 5:03pm UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/1 "2018-12-06T17:03:46Z")

</div>

External Email - Use Caution

Dear MNE community,

I want to use a set of electrode channel locations for my subjects. I have channel location files in format of .xyz and .sfp generated from brainstorm (already coregistered), does anyone know how to convert to fif file? I can setup montage by reading sfp files, but I don't know how to replace the raw.info\<[http://raw.info](http://raw.info)\> using the montage information. Also how to get the trans.fif file?

Thank you very much for your time

Best,

Feng Liu

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20181206/c69c04a7/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181206/c69c04a7/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 6, 2018, 7:31pm UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/2 "2018-12-06T19:31:00Z")

</div>

External Email - Use Caution

see:

[https://martinos.org/mne/dev/generated/mne.channels.read\_montage.html](https://martinos.org/mne/dev/generated/mne.channels.read_montage.html)

and then

raw.set\_montage

should do the job.

HTH  
Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 7, 2018, 1:55am UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/3 "2018-12-07T01:55:39Z")

</div>

External Email - Use Caution

Hi Alex,

Thank you for your reply. I can read sfp files using raw.set\_montage, do you know should I manually replace the raw.info with the montage information, in the end, I want to build the forward model using mne.make\_forward\_solution(), as you know this function requires raw.info as a mandatory input. I thought there should be a link from montage to raw.info.

Best regards,  
Feng

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 7, 2018, 2:13am UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/4 "2018-12-07T02:13:45Z")

</div>

Sorry that I think it is more helpful to post the error message.

montage = mne.channels.read\_montage( '/home/scratch/brainstorm\_db/Protocol01/data/106a\_recon/BioSemi\_128\_A01.sfp')  
raw.set\_montage(montage=montage)

ValueError: None of the sensors defined in the montage were found in the info structure. Check the channel names.

This is the structure of raw.info:

\<Info | 19 non-empty fields  
&nbsp;&nbsp;&nbsp;&nbsp;bads : list | MEG 2443, EEG 053  
&nbsp;&nbsp;&nbsp;&nbsp;ch\_names : list | MEG 0113, MEG 0112, MEG 0111, MEG 0122, MEG 0123, ...  
&nbsp;&nbsp;&nbsp;&nbsp;chs : list | 376 items (GRAD: 204, MAG: 102, STIM: 9, EEG: 60, EOG: 1)  
&nbsp;&nbsp;&nbsp;&nbsp;comps : list | 0 items

I think when I use setup\_montage, it will check the original channel names, it will assign the value only if the name under montage match the name under raw.info['ch\_names']. So do I need to delete all the raw.info['ch\_names'] and re-assign channels names?

Best,

Feng Liu

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 7, 2018, 12:59pm UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/5 "2018-12-07T12:59:10Z")

</div>

External Email - Use Caution

what are you trying to do?

it seems that you use the sample dataset info for your EEG data which  
should not be necessary.

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 7, 2018, 2:39pm UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/6 "2018-12-07T14:39:28Z")

</div>

Hi Alex,

I am trying to compare the forward models and signal changes among control vs patients, I only have the T1 scans. I have to make assumed locations for all the channels. I have done recon all, I need something like raw.info and trans file to get it done. If you have any suggestions, I would appreciate it a lot.

Best,  
Feng

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 7, 2018, 3:38pm UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/7 "2018-12-07T15:38:06Z")

</div>

External Email - Use Caution

I would suggest your read our documentation about Measurement Info,  
coregistration and how to use freesurfer

since you're at MGH you can certainly go see Sheraz Khan for help

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 8, 2018, 4:44am UTC](https://mne.discourse.group/t/convert-brainstorm-channel-xyz-file-or-sfp-file-into-mne-raw-fif/1673/8 "2018-12-08T04:44:44Z")

</div>

External Email - Use Caution

Sure, definitely. I will read through the documentation, if I can't figure out, I will ask Sheraz, he knows everything.

Thanks again,

Best  
Feng
