question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] `mne.viz.plot_alignment` silently assumes unknown coordinate frame is in head

See original GitHub issue

@larsoner suggested warning that the coordinate frame is unknown might be the best option but as in this example, an unknown coordinate frame is silently accepted as being in “head” coordinates:

import os.path as op
import numpy as np
import mne
data = np.random.normal(size=(16, 100))
ch_names = ['S1_D1 hbo', 'S1_D1 hbr', 'S2_D1 hbo', 'S2_D1 hbr',
            'S3_D1 hbo', 'S3_D1 hbr', 'S4_D1 hbo', 'S4_D1 hbr',
            'S5_D2 hbo', 'S5_D2 hbr', 'S6_D2 hbo', 'S6_D2 hbr',
            'S7_D2 hbo', 'S7_D2 hbr', 'S8_D2 hbo', 'S8_D2 hbr']
ch_types = ['hbo', 'hbr', 'hbo', 'hbr',
            'hbo', 'hbr', 'hbo', 'hbr',
            'hbo', 'hbr', 'hbo', 'hbr',
            'hbo', 'hbr', 'hbo', 'hbr']
sfreq = 10.  # in Hz
info = mne.create_info(ch_names=ch_names, ch_types=ch_types, sfreq=sfreq)
raw = mne.io.RawArray(data, info, verbose=True)

subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_fsaverage(subjects_dir=subjects_dir)

montage = mne.channels.make_standard_montage('artinis-octamon')
raw.set_montage(montage)
trans = mne.channels.compute_native_head_t(montage)

fig = mne.viz.create_3d_figure(size=(800, 600), bgcolor='white')
fig = mne.viz.plot_alignment(
    raw.info, trans=trans, subject='fsaverage', subjects_dir=subjects_dir,
    surfaces=['brain', 'head'], coord_frame='mri', dig=True, show_axes=True,
    fnirs=['channels', 'pairs', 'sources', 'detectors'], fig=fig)
print({ch: raw.info['chs'][i]['coord_frame'] for i, ch in enumerate(raw.ch_names)})

Adapted from https://mne.tools/stable/auto_tutorials/io/30_reading_fnirs_data.html

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alexrockhillcommented, Jul 30, 2021

I suspect this is a widespread, non-fNIRS-specific issue as I ran into it for the stereoEEG tutorial as well

1reaction
alexrockhillcommented, Jul 30, 2021

Huh, artinis-octamon has fiducial points so there might also be an issue with the coordinate frame not being set to “head” properly…

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.viz.plot_alignment — MNE 1.2.2 documentation
Plot head, sensor, and source space alignment in 3D. ... If True (default False), coordinate frame axis indicators will be shown: head in ......
Read more >
VIZ: bug in plot_sensors(kind='3d') #7136 - GitHub
Describe the bug When plotting MEG and EEG sensors at the same time, ... Presumably this is an issue of which coordinate frame...
Read more >
Problems running mne.viz.plot_alignment() from within Spyder
I'm trying to use mne. viz. plot_alignment (which doesn't have “block=” argument). The only way I've found to keep the plot window open...
Read more >
Francisco Martins Treasures Lost - De Gruyter
Vorlage (*Kings) and, unless we assume that the Chronicler had at his disposal some unknown source of information about Asa's, Hezekiah's, ...
Read more >
Final Environment and Social Impact Assessment ... - DFCCIL
email or hand delivery at DFCCIL Head office and CPM offices. - The second stage of information dissemination is conducted at final ESIA...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found