Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH, MRG] Add intracranial electrode localization GUI #9586

Merged
merged 2 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Enhancements

- Reading EDF files via :func:`mne.io.read_raw_edf` now can infer channel type from the signal label in the EDF header (:gh:`9694` by `Adam Li`_)

- Add :func:`mne.gui.locate_ieeg` to locate intracranial electrode contacts from a CT, an MRI (with Freesurfer ``recon-all``) and the channel names from an :class:`mne.Info` object (:gh:`9586` by `Alex Rockhill`_)

Bugs
~~~~
Expand Down
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
# unlinkable
'mayavi.mlab.pipeline.surface',
'CoregFrame', 'Kit2FiffFrame', 'FiducialsFrame',
'IntracranialElectrodeLocator'
}
numpydoc_validate = True
numpydoc_validation_checks = {'all'} | set(error_ignores)
Expand Down
1 change: 1 addition & 0 deletions doc/mri.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Step by step instructions for using :func:`gui.coregistration`:
get_montage_volume_labels
gui.coregistration
gui.fiducials
gui.locate_ieeg
create_default_subject
head_to_mni
head_to_mri
Expand Down
4 changes: 2 additions & 2 deletions mne/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
path = _get_path(path, key, name)
# To update the testing or misc dataset, push commits, then make a new
# release on GitHub. Then update the "releases" variable:
releases = dict(testing='0.123', misc='0.18')
releases = dict(testing='0.123', misc='0.19')
# And also update the "md5_hashes['testing']" variable below.
# To update any other dataset, update the data archive itself (upload
# an updated version) and update the md5 hash.
Expand Down Expand Up @@ -345,7 +345,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
bst_raw='fa2efaaec3f3d462b319bc24898f440c',
bst_resting='70fc7bf9c3b97c4f2eab6260ee4a0430'),
fake='3194e9f7b46039bb050a74f3e1ae9908',
misc='0aa25a9bb4f204b3d4769f0b84e9b526',
misc='b5ebe66dbe0f36cba9170a7ce909a66f',
sample='12b75d1cb7df9dfb4ad73ed82f61094f',
somato='32fd2f6c8c7eb0784a1de6435273c48b',
spm='9f43f67150e3b694b523a21eb929ea75',
Expand Down
41 changes: 41 additions & 0 deletions mne/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,44 @@ def kit2fiff():
from ._kit2fiff_gui import Kit2FiffFrame
frame = Kit2FiffFrame()
return _initialize_gui(frame)


@verbose
def locate_ieeg(info, trans, aligned_ct, subject=None, subjects_dir=None,
groups=None, verbose=None):
"""Locate intracranial electrode contacts.

Parameters
----------
%(info_not_none)s
%(trans_not_none)s
aligned_ct : str | pathlib.Path | nibabel.spatialimages.SpatialImage
The CT image that has been aligned to the Freesurfer T1. Path-like
inputs and nibabel image objects are supported.
%(subject)s
%(subjects_dir)s
groups : dict | None
A dictionary with channels as keys and their group index as values.
If None, the groups will be inferred by the channel names. Channel
names must have a format like ``LAMY 7`` where a string prefix
like ``LAMY`` precedes a numeric index like ``7``. If the channels
are formatted improperly, group plotting will work incorrectly.
Group assignments can be adjusted in the GUI.
%(verbose)s

Returns
-------
gui : instance of IntracranialElectrodeLocator
The graphical user interface (GUI) window.
"""
from ._ieeg_locate_gui import IntracranialElectrodeLocator
from PyQt5.QtWidgets import QApplication
# get application
app = QApplication.instance()
if app is None:
app = QApplication(["Intracranial Electrode Locator"])
alexrockhill marked this conversation as resolved.
Show resolved Hide resolved
gui = IntracranialElectrodeLocator(
info, trans, aligned_ct, subject=subject,
subjects_dir=subjects_dir, groups=groups, verbose=verbose)
gui.show()
return gui
Loading