本文整理汇总了Python中mne.commands.utils.get_optparser函数的典型用法代码示例。如果您正苦于以下问题:Python get_optparser函数的具体用法?Python get_optparser怎么用?Python get_optparser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_optparser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
subjects_dir = mne.get_config('SUBJECTS_DIR')
parser.add_option('-o', '--overwrite', dest='overwrite',
action='store_true',
help='Overwrite previously computed surface')
parser.add_option('-s', '--subject', dest='subject',
help='The name of the subject', type='str')
parser.add_option('-f', '--force', dest='force', action='store_true',
help='Force transformation of surface into bem.')
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
help='Print the debug messages.')
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
help="Subjects directory", default=subjects_dir)
parser.add_option("-n", "--no-decimate", dest="no_decimate",
help="Disable medium and sparse decimations "
"(dense only)", action='store_true')
options, args = parser.parse_args()
subject = vars(options).get('subject', os.getenv('SUBJECT'))
subjects_dir = options.subjects_dir
if subject is None or subjects_dir is None:
parser.print_help()
sys.exit(1)
_run(subjects_dir, subject, options.force, options.overwrite,
options.no_decimate, options.verbose)
示例2: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
default=None, help="Subjects directory")
parser.add_option("-s", "--subject", dest="subject", default=None,
help="Subject name")
parser.add_option("-f", "--fiff", dest="inst", default=None,
help="FIFF file with digitizer data for coregistration")
parser.add_option("-t", "--tabbed", dest="tabbed", action="store_true",
default=False, help="Option for small screens: Combine "
"the data source panel and the coregistration panel "
"into a single panel with tabs.")
parser.add_option("--no-guess-mri", dest="guess_mri_subject",
action='store_false', default=True,
help="Prevent the GUI from automatically guessing and "
"changing the MRI subject when a new head shape source "
"file is selected.")
options, args = parser.parse_args()
with ETSContext():
mne.gui.coregistration(options.tabbed, inst=options.inst,
subject=options.subject,
subjects_dir=options.subjects_dir,
guess_mri_subject=options.guess_mri_subject)
if is_main:
sys.exit(0)
示例3: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
subjects_dir = mne.get_config('SUBJECTS_DIR')
parser.add_option('-s', '--subject', dest='subject',
help='Freesurfer subject id', type='str')
parser.add_option('-r', '--raw-dir', dest='raw_dir',
help='Path to parent directory containing raw mri data', default='PARREC', metavar='FILE')
parser.add_option('-d', '--subjects-dir', dest='subjects_dir',
help='FS Subjects directory', default=subjects_dir)
parser.add_option('-f', '--force', dest='force', action='store_true',
help='Force FreeSurfer reconstruction.')
parser.add_option('-o', '--openmp', dest='openmp', default=2, type=str,
help='Number of CPUs to use for reconstruction routines.')
parser.add_option('-v', '--volume', dest='volume', default='MPRAGE', type=str,
help='Input raw volume file for nii conversion. Default is MPRAGE '
'it can also be MEMP_VBM.')
options, args = parser.parse_args()
subject = vars(options).get('subject', os.getenv('SUBJECT'))
subjects_dir = options.subjects_dir
raw_dir = options.raw_dir
if subject is None or subjects_dir is None:
parser.print_help()
sys.exit(1)
_run(subjects_dir, subject, raw_dir, options.force, options.openmp, options.volume)
示例4: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("-i", "--in", dest="raw_in",
help="Input raw FIF file", metavar="FILE")
parser.add_option("-o", "--out", dest="raw_out",
help="Output raw FIF file", metavar="FILE",
default=None)
parser.add_option("-e", "--no-eog", dest="eog", action="store_false",
help="Remove EOG", default=True)
parser.add_option("-c", "--no-ecg", dest="ecg", action="store_false",
help="Remove ECG", default=True)
parser.add_option("-q", "--quiet", dest="quiet", action="store_true",
help="Suppress mne_process_raw output", default=False)
options, args = parser.parse_args()
if options.raw_in is None:
parser.print_help()
sys.exit(1)
raw_in = options.raw_in
raw_out = options.raw_out
eog = options.eog
ecg = options.ecg
quiet = options.quiet
clean_ecg_eog(raw_in, raw_out, eog=eog, ecg=ecg, quiet=quiet)
示例5: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
subject = os.environ.get('SUBJECT')
subjects_dir = os.environ.get('SUBJECTS_DIR')
parser.add_option("-s", "--subject", dest="subject",
help="Subject name", default=subject)
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
help="Subjects directory", default=subjects_dir)
parser.add_option("-5", "--flash05", dest="flash05",
help=("Path to FLASH sequence with a spin angle of 5 "
"degrees in Nifti format"), metavar="FILE")
parser.add_option("-3", "--flash30", dest="flash30",
help=("Path to FLASH sequence with a spin angle of 30 "
"degrees in Nifti format"), metavar="FILE")
parser.add_option("-v", "--view", dest="show", action="store_true",
help="Show BEM model in 3D for visual inspection",
default=False)
options, args = parser.parse_args()
if options.flash05 is None or options.flash30 is None:
parser.print_help()
sys.exit(1)
subject = options.subject
subjects_dir = options.subjects_dir
flash05 = os.path.abspath(options.flash05)
flash30 = os.path.abspath(options.flash30)
show = options.show
make_flash_bem(subject, subjects_dir, flash05, flash30, show=show)
示例6: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
subjects_dir = mne.get_config('SUBJECTS_DIR')
parser.add_option('-s', '--subject', dest='subject',
help='Freesurfer subject id', type='str')
parser.add_option('-l', '--layers', dest='layers', default=1, type=int,
help='Number BEM layers.')
parser.add_option('-i', '--ico', dest='ico', default=4, type=int,
help='Triangle decimation number for single layer bem')
parser.add_option('-d', '--subjects-dir', dest='subjects_dir',
help='FS Subjects directory', default=subjects_dir)
parser.add_option('-o', '--overwrite', dest='overwrite', action='store_true',
help='Overwrite existing neuromag MRI and MNE BEM files.')
options, args = parser.parse_args()
subject = options.subject
subjects_dir = options.subjects_dir
if subject is None or subjects_dir is None:
parser.print_help()
sys.exit(1)
_run(subjects_dir, subject, options.layers, options.ico, options.overwrite)
示例7: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
default=None, help="Subjects directory")
parser.add_option("-s", "--subject", dest="subject", default=None,
help="Subject name")
parser.add_option("-f", "--fiff", dest="inst", default=None,
help="FIFF file with digitizer data for coregistration")
parser.add_option("-t", "--tabbed", dest="tabbed", action="store_true",
default=False, help="Option for small screens: Combine "
"the data source panel and the coregistration panel "
"into a single panel with tabs.")
parser.add_option("--no-guess-mri", dest="guess_mri_subject",
action='store_false', default=None,
help="Prevent the GUI from automatically guessing and "
"changing the MRI subject when a new head shape source "
"file is selected.")
parser.add_option("--head-opacity", type=float, default=None,
dest="head_opacity",
help="The opacity of the head surface, in the range "
"[0, 1].")
parser.add_option("--high-res-head",
action='store_true', default=False, dest="high_res_head",
help="Use a high-resolution head surface.")
parser.add_option("--low-res-head",
action='store_true', default=False, dest="low_res_head",
help="Use a low-resolution head surface.")
parser.add_option('--trans', dest='trans', default=None,
help='Head<->MRI transform FIF file ("-trans.fif")')
parser.add_option('--verbose', action='store_true', dest='verbose',
help='Turn on verbose mode.')
options, args = parser.parse_args()
if options.low_res_head:
if options.high_res_head:
raise ValueError("Can't specify --high-res-head and "
"--low-res-head at the same time.")
head_high_res = False
elif options.high_res_head:
head_high_res = True
else:
head_high_res = None
with ETSContext():
mne.gui.coregistration(options.tabbed, inst=options.inst,
subject=options.subject,
subjects_dir=options.subjects_dir,
guess_mri_subject=options.guess_mri_subject,
head_opacity=options.head_opacity,
head_high_res=head_high_res,
trans=options.trans,
verbose=options.verbose)
if is_main:
sys.exit(0)
示例8: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("-s", "--subject", dest="subject",
help="Subject name", default=None)
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
help="Subjects directory", default=None)
parser.add_option("-3", "--noflash30", dest="noflash30",
action="store_true", default=False,
help=("Skip the 30-degree flip angle data"),)
parser.add_option("-n", "--noconvert", dest="noconvert",
action="store_true", default=False,
help=("Assume that the Flash MRI images have already "
"been converted to mgz files"))
parser.add_option("-u", "--unwarp", dest="unwarp",
action="store_true", default=False,
help=("Run grad_unwarp with -unwarp <type> option on "
"each of the converted data sets"))
parser.add_option("-o", "--overwrite", dest="overwrite",
action="store_true", default=False,
help="Write over existing .surf files in bem folder")
parser.add_option("-v", "--view", dest="show", action="store_true",
help="Show BEM model in 3D for visual inspection",
default=False)
parser.add_option("--copy", dest="copy",
help="Use copies instead of symlinks for surfaces",
action="store_true")
parser.add_option("-p", "--flash-path", dest="flash_path",
default=None,
help="The directory containing flash05.mgz and "
"flash30.mgz files (defaults to "
"$SUBJECTS_DIR/$SUBJECT/mri/flash/parameter_maps")
options, args = parser.parse_args()
subject = options.subject
subjects_dir = options.subjects_dir
flash30 = not options.noflash30
convert = not options.noconvert
unwarp = options.unwarp
overwrite = options.overwrite
show = options.show
flash_path = options.flash_path
copy = options.copy
if options.subject is None:
parser.print_help()
raise RuntimeError('The subject argument must be set')
convert_flash_mris(subject=subject, subjects_dir=subjects_dir,
flash30=flash30, convert=convert, unwarp=unwarp,
verbose=True)
make_flash_bem(subject=subject, subjects_dir=subjects_dir,
overwrite=overwrite, show=show, flash_path=flash_path,
copy=copy, verbose=True)
示例9: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option('--input', dest='input_fname',
help='Input data file name', metavar='filename')
parser.add_option('--mrk', dest='mrk_fname',
help='MEG Marker file name', metavar='filename')
parser.add_option('--elp', dest='elp_fname',
help='Headshape points file name', metavar='filename')
parser.add_option('--hsp', dest='hsp_fname',
help='Headshape file name', metavar='filename')
parser.add_option('--stim', dest='stim',
help='Colon Separated Stimulus Trigger Channels',
metavar='chs')
parser.add_option('--slope', dest='slope', help='Slope direction',
metavar='slope')
parser.add_option('--stimthresh', dest='stimthresh', default=1,
help='Threshold value for trigger channels',
metavar='value')
parser.add_option('--output', dest='out_fname',
help='Name of the resulting fiff file',
metavar='filename')
parser.add_option('--debug', dest='debug', action='store_true',
default=False,
help='Set logging level for terminal output to debug')
options, args = parser.parse_args()
if options.debug:
mne.set_log_level('debug')
input_fname = options.input_fname
if input_fname is None:
with ETSContext():
mne.gui.kit2fiff()
sys.exit(0)
hsp_fname = options.hsp_fname
elp_fname = options.elp_fname
mrk_fname = options.mrk_fname
stim = options.stim
slope = options.slope
stimthresh = options.stimthresh
out_fname = options.out_fname
if isinstance(stim, str):
stim = map(int, stim.split(':'))
raw = read_raw_kit(input_fname=input_fname, mrk=mrk_fname, elp=elp_fname,
hsp=hsp_fname, stim=stim, slope=slope,
stimthresh=stimthresh)
raw.save(out_fname)
raw.close()
sys.exit(0)
示例10: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option('-p', '--pdf', dest='pdf_fname',
help='Input data file name', metavar='FILE')
parser.add_option('-c', '--config', dest='config_fname',
help='Input config file name', metavar='FILE',
default='config')
parser.add_option('--head_shape', dest='head_shape_fname',
help='Headshape file name', metavar='FILE',
default='hs_file')
parser.add_option('-o', '--out_fname', dest='out_fname',
help='Name of the resulting fiff file',
default='as_data_fname')
parser.add_option('-r', '--rotation_x', dest='rotation_x', type='float',
help='Compensatory rotation about Neuromag x axis, deg',
default=2.0)
parser.add_option('-T', '--translation', dest='translation', type='str',
help='Default translation, meter',
default=(0.00, 0.02, 0.11))
parser.add_option('--ecg_ch', dest='ecg_ch', type='str',
help='4D ECG channel name',
default='E31')
parser.add_option('--eog_ch', dest='eog_ch', type='str',
help='4D EOG channel names',
default='E63,E64')
options, args = parser.parse_args()
pdf_fname = options.pdf_fname
if pdf_fname is None:
parser.print_help()
sys.exit(1)
config_fname = options.config_fname
head_shape_fname = options.head_shape_fname
out_fname = options.out_fname
rotation_x = options.rotation_x
translation = options.translation
ecg_ch = options.ecg_ch
eog_ch = options.ecg_ch.split(',')
if out_fname == 'as_data_fname':
out_fname = pdf_fname + '_raw.fif'
raw = read_raw_bti(pdf_fname=pdf_fname, config_fname=config_fname,
head_shape_fname=head_shape_fname,
rotation_x=rotation_x, translation=translation,
ecg_ch=ecg_ch, eog_ch=eog_ch)
raw.save(out_fname)
raw.close()
if is_main:
sys.exit(0)
示例11: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
options, args = parser.parse_args()
os.environ['ETS_TOOLKIT'] = 'qt4'
mne.gui.coregistration()
if is_main:
sys.exit(0)
示例12: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option('--input', dest='input_fname',
help='Input data file name', metavar='filename')
parser.add_option('--mrk', dest='mrk_fname',
help='MEG Marker file name', metavar='filename')
parser.add_option('--elp', dest='elp_fname',
help='Headshape points file name', metavar='filename')
parser.add_option('--hsp', dest='hsp_fname',
help='Headshape file name', metavar='filename')
parser.add_option('--stim', dest='stim',
help='Colon Separated Stimulus Trigger Channels',
metavar='chs')
parser.add_option('--slope', dest='slope', help='Slope direction',
metavar='slope')
parser.add_option('--stimthresh', dest='stimthresh', default=1,
help='Threshold value for trigger channels',
metavar='value')
parser.add_option('--output', dest='out_fname',
help='Name of the resulting fiff file',
metavar='filename')
options, args = parser.parse_args()
input_fname = options.input_fname
if input_fname is None:
os.environ['ETS_TOOLKIT'] = 'qt4'
mne.gui.kit2fiff()
sys.exit(0)
hsp_fname = options.hsp_fname
elp_fname = options.elp_fname
mrk_fname = options.mrk_fname
stim = options.stim
slope = options.slope
stimthresh = options.stimthresh
out_fname = options.out_fname
if isinstance(stim, str):
stim = stim.split(':')
raw = read_raw_kit(input_fname=input_fname, mrk=mrk_fname, elp=elp_fname,
hsp=hsp_fname, stim=stim, slope=slope,
stimthresh=stimthresh)
raw.save(out_fname)
raw.close()
sys.exit(0)
示例13: run
def run():
"""Run command."""
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("-s", "--subject", dest="subject",
help="Subject name (required)", default=None)
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
help="Subjects directory", default=None)
parser.add_option("-o", "--overwrite", dest="overwrite",
help="Write over existing files", action="store_true")
parser.add_option("-v", "--volume", dest="volume",
help="Defaults to T1", default='T1')
parser.add_option("-a", "--atlas", dest="atlas",
help="Specify the --atlas option for mri_watershed",
default=False, action="store_true")
parser.add_option("-g", "--gcaatlas", dest="gcaatlas",
help="Use the subcortical atlas", default=False,
action="store_true")
parser.add_option("-p", "--preflood", dest="preflood",
help="Change the preflood height", default=None)
parser.add_option("--copy", dest="copy",
help="Use copies instead of symlinks for surfaces",
action="store_true")
parser.add_option("--verbose", dest="verbose",
help="If not None, override default verbose level",
default=None)
options, args = parser.parse_args()
if options.subject is None:
parser.print_help()
sys.exit(1)
subject = options.subject
subjects_dir = options.subjects_dir
overwrite = options.overwrite
volume = options.volume
atlas = options.atlas
gcaatlas = options.gcaatlas
preflood = options.preflood
copy = options.copy
verbose = options.verbose
make_watershed_bem(subject=subject, subjects_dir=subjects_dir,
overwrite=overwrite, volume=volume, atlas=atlas,
gcaatlas=gcaatlas, preflood=preflood, copy=copy,
verbose=verbose)
示例14: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("--input", dest="input_fname", help="Input data file name", metavar="filename")
parser.add_option("--mrk", dest="mrk_fname", help="MEG Marker file name", metavar="filename")
parser.add_option("--elp", dest="elp_fname", help="Headshape points file name", metavar="filename")
parser.add_option("--hsp", dest="hsp_fname", help="Headshape file name", metavar="filename")
parser.add_option("--stim", dest="stim", help="Colon Separated Stimulus Trigger Channels", metavar="chs")
parser.add_option("--slope", dest="slope", help="Slope direction", metavar="slope")
parser.add_option(
"--stimthresh", dest="stimthresh", default=1, help="Threshold value for trigger channels", metavar="value"
)
parser.add_option("--output", dest="out_fname", help="Name of the resulting fiff file", metavar="filename")
options, args = parser.parse_args()
input_fname = options.input_fname
if input_fname is None:
os.environ["ETS_TOOLKIT"] = "qt4"
mne.gui.kit2fiff()
sys.exit(0)
hsp_fname = options.hsp_fname
elp_fname = options.elp_fname
mrk_fname = options.mrk_fname
stim = options.stim
slope = options.slope
stimthresh = options.stimthresh
out_fname = options.out_fname
if isinstance(stim, str):
stim = map(int, stim.split(":"))
raw = read_raw_kit(
input_fname=input_fname,
mrk=mrk_fname,
elp=elp_fname,
hsp=hsp_fname,
stim=stim,
slope=slope,
stimthresh=stimthresh,
)
raw.save(out_fname)
raw.close()
sys.exit(0)
示例15: run
def run():
from mne.commands.utils import get_optparser
parser = get_optparser(__file__)
parser.add_option("-p", "--path", dest="path",
help="Path to folder who MNE-Report must be created")
parser.add_option("-i", "--info", dest="info_fname",
help="File from which info dictionary is to be read",
metavar="FILE")
parser.add_option("-d", "--subjects-dir", dest="subjects_dir",
help="The subjects directory")
parser.add_option("-s", "--subject", dest="subject",
help="The subject name")
parser.add_option("-v", "--verbose", dest="verbose",
action='store_true', help="run in verbose mode")
parser.add_option("--no-browser", dest="no_browser", action='store_false',
help="Do not open MNE-Report in browser")
parser.add_option("--overwrite", dest="overwrite", action='store_false',
help="Overwrite html report if it already exists")
parser.add_option("-j", "--jobs", dest="n_jobs", help="Number of jobs to"
" run in parallel")
parser.add_option("-m", "--mri-decim", type="int", dest="mri_decim",
default=2, help="Integer factor used to decimate "
"BEM plots")
options, args = parser.parse_args()
path = options.path
if path is None:
parser.print_help()
sys.exit(1)
info_fname = options.info_fname
subjects_dir = options.subjects_dir
subject = options.subject
mri_decim = int(options.mri_decim)
verbose = True if options.verbose is not None else False
open_browser = False if options.no_browser is not None else True
overwrite = True if options.overwrite is not None else False
n_jobs = int(options.n_jobs) if options.n_jobs is not None else 1
t0 = time.time()
report = Report(info_fname, subjects_dir=subjects_dir, subject=subject,
verbose=verbose)
report.parse_folder(path, verbose=verbose, n_jobs=n_jobs,
mri_decim=mri_decim)
log_elapsed(time.time() - t0, verbose=verbose)
report.save(open_browser=open_browser, overwrite=overwrite)