-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
XFit-style dipole fitting GUI #13074
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
base: main
Are you sure you want to change the base?
Changes from all commits
752854d
d9b2e07
55edc31
bb7e229
1178ebc
7556823
cb5a520
d4015d4
2c307fe
3b37ea3
6245c0a
4f43e50
9779843
9747338
8268315
7dd77d9
10c2b2a
f0a92da
8ef1179
ca46e1a
458c509
3c91d05
6d2496c
8fc904d
6170c63
41087bb
568560b
f6738e7
a83b8fd
3bfe2a5
2e94752
3c6b73c
9b6bd60
8796836
573cb40
facd394
a0069d8
76aebb3
1cbdb96
b0e6cb2
474f184
bc54c3a
aa25982
bb4fd2c
b498c15
c2eed61
f7005a5
b47792e
fda59e8
ca1b99e
1b877df
f7bd8cc
5f594dd
263b99f
eaa081e
ffb2fe1
2f801a4
56ebda7
d913fff
13877b4
74e80d6
4039603
43e145f
b2bdbe2
e342e43
5c8e337
5bdb9e1
2aa51d6
65fb86b
9b6b06a
bcef66e
8efcb8c
87f72e2
6601235
871e15a
8ebd885
5f5666a
0277981
bea101d
2ae07bf
f55028d
49c9d0b
e857a2e
822f761
51efe6c
e806634
23b5c23
8b1a014
0066f0b
f1a0364
727fa29
710b77d
4b71df0
dbabf05
e90887d
df0737f
1e67acc
622ff54
64b0ed1
0841c88
0f3239a
17e28b0
b4467c9
d878f60
b1ee63a
15519eb
5108607
e243310
a1f5328
4e7270a
c703e32
08e28e6
b01cfdf
35a2b64
8f26350
a92aead
f4d879d
648ac5b
9e27f35
952a196
d0cae85
8c7c1b5
2a888bb
e5a3605
9874bbd
0abefff
8838aca
aab8aaa
67ab49c
a8fe912
a23182b
fbc3d10
3d49fe8
003ba92
b8892d1
bf0ec5b
67006a8
eff0b58
cba5ddd
0f8629c
f6a2943
f8b5884
d1f53d7
73a35c3
056521c
de9e836
51c6494
046dd22
a602932
084841e
b0adaeb
dff558d
152f135
e717069
5060f70
a897369
228bba7
e74bbc0
d77dd02
a12ce5e
a863853
c8d70b8
ab2c39a
7209ebe
72c4dad
8d4f7f9
2b218fb
0e462cf
d23104b
a4bd21e
ecc71e3
53a9fb7
208ea95
13fe805
54238a0
bc803fa
a9b1277
ce93f92
695c6bb
2833b5a
b915425
3a1534b
8fd98b1
93dda71
4ef1e40
41d514e
fed466e
5fa0749
57b6079
39b227b
39b8e5e
7fb8e24
f7e0170
f0739b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,7 @@ Inverse Solutions | |
| Dipole | ||
| DipoleFixed | ||
| fit_dipole | ||
| gui.dipolefit | ||
|
|
||
| :py:mod:`mne.dipole`: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add a GUI for interactive guided dipole fitting (:func:`mne.gui.dipolefit`), by `Marijn van Vliet`_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| # Authors: The MNE-Python contributors. | ||
| # License: BSD-3-Clause | ||
| # Copyright the MNE-Python contributors. | ||
|
|
||
| """Open the dipole fitting GUI on the given evoked file ("-ave.fif"). | ||
|
|
||
| Examples | ||
| -------- | ||
| .. code-block:: console | ||
|
|
||
| $ mne dipolefit | ||
|
|
||
| """ | ||
|
|
||
| import os.path as op | ||
| import sys | ||
|
|
||
| import mne | ||
|
|
||
|
|
||
| def run(): | ||
| """Run command.""" | ||
| from mne.commands.utils import _add_verbose_flag, get_optparser | ||
|
|
||
| parser = get_optparser(__file__, usage="mne dipolefit EVOKED_FILE") | ||
|
|
||
| parser.add_option( | ||
| "--condition", | ||
| default=0, | ||
| help="The condition to use.", | ||
| ) | ||
| parser.add_option( | ||
| "--baseline", | ||
| default=None, | ||
| metavar="BASELINE", # docutils doesn't like commas in rendered metavar | ||
| help=( | ||
| "The time period to use as baseline, written as two numbers (in seconds, " | ||
| "relative to the stimulus onset) separated by a comma. " | ||
| "For example: --baseline=-0.2,0.1" | ||
| ), | ||
| ) | ||
| parser.add_option( | ||
| "-c", | ||
| "--cov", | ||
| default=None, | ||
| metavar="COV_FILE", | ||
| help='The noise covariance ("-cov.fif") to use.', | ||
| ) | ||
| parser.add_option( | ||
| "-b", | ||
| "--bem", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Someday we should maybe allow
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
| default=None, | ||
| metavar="BEM_FILE", | ||
| help=( | ||
| 'The BEM model ("-bem-sol.fif") to use. When omitted, a basic sphere ' | ||
| "model will be used." | ||
| ), | ||
| ) | ||
| parser.add_option( | ||
| "-t", | ||
| "--initial-time", | ||
| default=None, | ||
| type=float, | ||
| metavar="TIME", | ||
| help="The initial time to show", | ||
| ) | ||
| parser.add_option( | ||
| "--trans", | ||
| default=None, | ||
| metavar="TRANS_FILE", | ||
| help='Head<->MRI transform FIF file ("-trans.fif")', | ||
| ) | ||
| parser.add_option( | ||
| "--stc", | ||
| default=None, | ||
| metavar="STC_FILE", | ||
| help="An optional distributed source estimate to show during dipole fitting.", | ||
| ) | ||
| parser.add_option( | ||
| "-s", "--subject", dest="subject", default=None, help="Subject name" | ||
| ) | ||
| parser.add_option( | ||
| "-d", | ||
| "--subjects-dir", | ||
| default=None, | ||
| help="Subjects directory", | ||
| ) | ||
| parser.add_option( | ||
| "--hide-density", | ||
| action="store_true", | ||
| default=False, | ||
| help="Prevent showing the magnetic field density as blobs of color.", | ||
| ) | ||
| parser.add_option( | ||
| "--channel-type", | ||
| default=None, | ||
| help=( | ||
| 'Restrict channel types to either "meg" or "eeg". By default both are used ' | ||
| "if present." | ||
| ), | ||
| ) | ||
| parser.add_option( | ||
| "-j", "--n-jobs", default=-1, type=int, help="Number of CPUs to use." | ||
| ) | ||
| _add_verbose_flag(parser) | ||
|
|
||
| options, args = parser.parse_args() | ||
| if len(args) != 1: | ||
| parser.print_help() | ||
| sys.exit(1) | ||
|
|
||
| # expanduser allows ~ for paths | ||
| subjects_dir = options.subjects_dir | ||
| if subjects_dir is not None: | ||
| subjects_dir = op.expanduser(subjects_dir) | ||
| bem = options.bem | ||
| if bem is not None: | ||
| bem = op.expanduser(bem) | ||
| trans = options.trans | ||
| if trans is not None: | ||
| trans = op.expanduser(trans) | ||
| stc = options.stc | ||
| if stc is not None: | ||
| stc = op.expanduser(stc) | ||
|
|
||
| # Condition can be specified as integer index or string comment. | ||
| if options.condition is not None: | ||
| try: | ||
| condition = int(options.condition) | ||
| except ValueError: | ||
| condition = options.condition | ||
| else: | ||
| condition = None | ||
| evoked = mne.read_evokeds(args[0], condition=condition) | ||
|
|
||
| # Parse the baseline time period | ||
| baseline = None | ||
| if options.baseline: | ||
| try: | ||
| baseline = [float(x) for x in options.baseline.split(",")] | ||
| if len(baseline) != 2: | ||
| raise ValueError() | ||
| except ValueError: | ||
| raise ValueError( | ||
| "The 'baseline' parameter should be written as two numbers (in seconds," | ||
| " relative to the stimulus onset) separated by a comma. " | ||
| "For example: --baseline=-0.2,0.1" | ||
| ) | ||
|
|
||
| mne.gui.dipolefit( | ||
| evoked=evoked, | ||
| baseline=baseline, | ||
| cov=options.cov, | ||
| bem=bem, | ||
| subject=options.subject, | ||
| subjects_dir=subjects_dir, | ||
| stc=stc, | ||
| ch_type=options.channel_type, | ||
| initial_time=options.initial_time, | ||
| trans=trans, | ||
| n_jobs=options.n_jobs, | ||
| show_density=not options.hide_density, | ||
| show=True, | ||
| block=True, | ||
| verbose=options.verbose, | ||
| ) | ||
|
|
||
|
|
||
| mne.utils.run_command_if_main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| __all__ = ["_GUIScraper", "coregistration"] | ||
| from ._gui import _GUIScraper, coregistration | ||
| __all__ = ["_GUIScraper", "coregistration", "dipolefit"] | ||
| from ._gui import _GUIScraper, coregistration, dipolefit |
Uh oh!
There was an error while loading. Please reload this page.