cmtklib.interfaces.mne module
The MNE module provides Nipype interfaces for MNE tools missing in Nipype or modified.
CreateBEM
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to create the BEM surfaces.
Examples
>>> from cmtklib.interfaces.mne import CreateBEM >>> create_bem = CreateBEM() >>> create_bem.inputs.fs_subject = 'sub-01' >>> create_bem.inputs.fs_subjects_dir = '/path/to/bids_dataset/derivatives/freesurfer-7.1.1' >>> create_bem.inputs.out_bem_fname = 'bem.fif' >>> create_bem.run()References
https://mne.tools/stable/generated/mne.bem.make_watershed_bem.html
https://mne.tools/stable/generated/mne.write_bem_solution.html
- fs_subjecta string
FreeSurfer subject ID.
- fs_subjects_dira string or os.PathLike object referring to an existing directory
Freesurfer subjects (derivatives) directory.
- out_bem_fnamea string
Name of output BEM file in fif format.
- bem_filea string or os.PathLike object
Path to output BEM file in fif format.
CreateCov
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to create the noise covariance matrix.
Examples
>>> from cmtklib.interfaces.mne import CreateCov >>> create_cov = CreateCov() >>> create_cov.inputs.epochs_file = '/path/to/sub-01_epo.fif' >>> create_cov.inputs.out_noise_cov_fname = 'sub-01_noisecov.fif' >>> create_cov.run()References
- epochs_filea string or os.PathLike object referring to an existing file
Eeg * epochs in .set format.
- out_noise_cov_fnamea string
Name of output file to save noise covariance matrix in fif format.
- noise_cov_filea string or os.PathLike object
Location and name to store noise covariance matrix in fif format.
CreateFwd
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to calculate the forward solution.
Examples
>>> from cmtklib.interfaces.mne import CreateFwd >>> create_fwd = CreateFwd() >>> create_fwd.inputs.epochs_file = '/path/to/sub-01_epo.fif' >>> create_fwd.inputs.out_fwd_fname = 'sub-01_fwd.fif' >>> create_fwd.inputs.src_file = '/path/to/sub-01_src.fif' >>> create_fwd.inputs.bem_file = '/path/to/sub-01_bem.fif' >>> create_fwd.inputs.trans_file = '/path/to/sub-01_trans.fif' >>> create_fwd.run()References
- bem_filea string or os.PathLike object referring to an existing file
Boundary surfaces for MNE head model in fif format.
- epochs_filea string or os.PathLike object referring to an existing file
Eeg * epochs in .fif format, containing information about electrode montage.
- src_filea string or os.PathLike object referring to an existing file
Source space file in fif format.
- out_fwd_fnamea string
Name of output forward solution file created with MNE.
- trans_filea string or os.PathLike object referring to an existing file
Trans.fif file containing co-registration information (electrodes x MRI).
- fwd_filea string or os.PathLike object
Path to generated forward solution file in fif format.
CreateSrc
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to set up bilateral hemisphere surface-based source space with subsampling and write source spaces to a file.
Examples
>>> from cmtklib.interfaces.mne import CreateSrc >>> create_src = CreateSrc() >>> create_src.inputs.fs_subject = 'sub-01' >>> create_src.inputs.fs_subjects_dir = '/path/to/bids_dataset/derivatives/freesurfer-7.1.1' >>> create_src.inputs.out_src_fname = 'sub-01_src.fif' >>> create_src.run()References
https://mne.tools/stable/generated/mne.setup_source_space.html
https://mne.tools/stable/generated/mne.write_source_spaces.html
- fs_subjecta string
FreeSurfer subject ID.
- fs_subjects_dira string or os.PathLike object referring to an existing directory
Freesurfer subjects (derivatives) directory.
- out_src_fnamea string
Name of output source space file created with MNE.
- overwritea boolean
Overwrite source space file if already existing.
- src_filea string or os.PathLike object
Path to output source space files in fif format.
EEGLAB2fif
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to convert EEG data from EEGlab to MNE format.
Examples
>>> from cmtklib.interfaces.mne import EEGLAB2fif >>> eeglab2fif = EEGLAB2fif() >>> eeglab2fif.inputs.eeg_ts_file = ['sub-01_task-faces_desc-preproc_eeg.set'] >>> eeglab2fif.inputs.events_file = ['sub-01_task-faces_events.tsv'] >>> eeglab2fif.inputs.out_epochs_fif_fname = 'sub-01_epo.fif' >>> eeglab2fif.inputs.electrodes_file = 'sub-01_eeg.xyz' >>> eeglab2fif.inputs.event_ids = {"SCRAMBLED":0, "FACES":1} >>> eeglab2fif.inputs.t_min = -0.2 >>> eeglab2fif.inputs.t_max = 0.6 >>> eeglab2fif.run()References
https://mne.tools/stable/generated/mne.read_epochs_eeglab.html
https://mne.tools/stable/generated/mne.channels.make_dig_montage.html
https://mne.tools/stable/generated/mne.Epochs.html?highlight=set_montage#mne.Epochs.set_montage
https://mne.tools/stable/generated/mne.Epochs.html?highlight=set_montage#mne.Epochs.save
- eeg_ts_filea string or os.PathLike object referring to an existing file
Eeg * epochs in .set format.
- events_filea string or os.PathLike object referring to an existing file
Epochs metadata in _behav.txt.
- out_epochs_fif_fnamea string
Output filename for eeg * epochs in .fif format, e.g. sub-01_epo.fif.
- electrodes_filea string or os.PathLike object referring to an existing file
Positions of EEG electrodes in a txt file.
- event_idsa dictionary with keys which are any value and with values which are any value
The id of the events to consider in
dict
form. The keys of thedict
can later be used to access associated events. If None, all events will be used and a dict is created with string integer names corresponding to the event id integers.- t_maxa float
End time of the epochs in seconds, relative to the time-locked event.
- t_mina float
Start time of the epochs in seconds, relative to the time-locked event.
- epochs_filea string or os.PathLike object referring to an existing file
Eeg * epochs in .fif format.
MNEInverseSolutionROI
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to convert EEG data from EEGlab to MNE format.
Examples
>>> from cmtklib.interfaces.mne import MNEInverseSolutionROI >>> inv_sol = MNEInverseSolutionROI() >>> inv_sol.inputs.esi_method_snr = 3.0 >>> inv_sol.inputs.fs_subject = 'sub-01' >>> inv_sol.inputs.fs_subjects_dir = '/path/to/bids_dataset/derivatives/freesurfer-7.1.1' >>> inv_sol.inputs.epochs_file = '/path/to/sub-01_epo.fif' >>> inv_sol.inputs.src_file = '/path/to/sub-01_src.fif' >>> inv_sol.inputs.bem_file = '/path/to/sub-01_bem.fif' >>> inv_sol.inputs.noise_cov_file = '/path/to/sub-01_noisecov.fif' >>> inv_sol.inputs.fwd_file = '/path/to/sub-01_fwd.fif' >>> inv_sol.inputs.atlas_annot = 'lausanne2018.scale1' >>> inv_sol.inputs.out_roi_ts_fname_prefix = 'sub-01_atlas-L2018_res-scale1_desc-epo_timeseries' >>> inv_sol.inputs.out_inv_fname = 'sub-01_inv.fif' >>> inv_sol.run()References
https://mne.tools/stable/generated/mne.read_forward_solution.html
https://mne.tools/stable/generated/mne.minimum_norm.make_inverse_operator.html
https://mne.tools/stable/generated/mne.minimum_norm.apply_inverse_epochs.html
https://mne.tools/stable/generated/mne.read_labels_from_annot.html
https://mne.tools/stable/generated/mne.extract_label_time_course.html
- bem_filea string or os.PathLike object referring to an existing file
Surfaces for head model in fif format.
- epochs_filea string or os.PathLike object referring to an existing file
Eeg * epochs in .fif format.
- fs_subjecta string
FreeSurfer subject ID.
- fs_subjects_dira string or os.PathLike object referring to an existing directory
Freesurfer subjects (derivatives) directory.
- fwd_filea string or os.PathLike object
Forward solution in fif format.
- noise_cov_filea string or os.PathLike object referring to an existing file
Noise covariance matrix in fif format.
- out_inv_fnamea string
Output filename for inverse operator in fif format.
- src_filea string or os.PathLike object referring to an existing file
Source space created with MNE in fif format.
- atlas_annot‘aparc’ or ‘lausanne2018.scale1’ or ‘lausanne2018.scale2’ or ‘lausanne2018.scale3’ or ‘lausanne2018.scale4’ or ‘lausanne2018.scale5’
The parcellation to use, e.g., ‘aparc’, ‘lausanne2018.scale1’, ‘lausanne2018.scale2’, ‘lausanne2018.scale3’, ‘lausanne2018.scale4’ or’lausanne2018.scale5’.
- esi_method‘sLORETA’ or ‘eLORETA’ or ‘MNE’ or ‘dSPM’
Use minimum norm 1, dSPM 2, sLORETA (default) 3, or eLORETA 4.
- esi_method_snra float
SNR value such as the ESI method regularization weight lambda2 is set to
1.0 / esi_method_snr ** 2
.- out_roi_ts_fname_prefixa string
Output filename prefix (no extension) for rois * time series in .npy and .mat formats.
- inv_filea string or os.PathLike object
Path to output inverse operator file in fif format.
- roi_ts_mat_filea string or os.PathLike object
Path to output ROI time series file in .mat format.
- roi_ts_npy_filea string or os.PathLike object
Path to output ROI time series file in .npy format.
MNESpectralConnectivity
Bases: nipype.interfaces.base.core.BaseInterface
Use MNE to compute frequency- and time-frequency-domain connectivity measures.
Examples
>>> from cmtklib.interfaces.mne import MNESpectralConnectivity >>> eeg_cmat = MNESpectralConnectivity() >>> eeg_cmat.inputs.fs_subject = 'sub-01' >>> eeg_cmat.inputs.fs_subjects_dir = '/path/to/bids_dataset/derivatives/freesurfer-7.1.1' >>> eeg_cmat.inputs.atlas_annot = 'lausanne2018.scale1' >>> eeg_cmat.inputs.connectivity_metrics = ['imcoh', 'pli', 'wpli'] >>> eeg_cmat.inputs.output_types = ['tsv', 'gpickle', 'mat', 'graphml'] >>> eeg_cmat.inputs.epochs_file = '/path/to/sub-01_epo.fif' >>> eeg_cmat.inputs.roi_ts_file = '/path/to/sub-01_timeseries.npy' >>> eeg_cmat.run()References
- fs_subjecta string
FreeSurfer subject ID.
- fs_subjects_dira string or os.PathLike object referring to an existing directory
Freesurfer subjects (derivatives) directory.
- atlas_annot‘aparc’ or ‘lausanne2018.scale1’ or ‘lausanne2018.scale2’ or ‘lausanne2018.scale3’ or ‘lausanne2018.scale4’ or ‘lausanne2018.scale5’
The parcellation to use, e.g., ‘aparc’, ‘lausanne2018.scale1’, ‘lausanne2018.scale2’, ‘lausanne2018.scale3’, ‘lausanne2018.scale4’ or’lausanne2018.scale5’.
- connectivity_metricsa list of items which are any value
Set of frequency- and time-frequency-domain connectivity metrics to compute.
- epochs_filea pathlike object or string representing an existing file
Epochs file in fif format.
- out_cmat_fnamea string
Basename of output connectome file (without any extension).
- output_typesa list of items which are any value
Set of format to save output connectome files.
- roi_ts_filea pathlike object or string representing an existing file
Extracted ROI time courses from ESI in .npy format.
- roi_volume_tsv_filea pathlike object or string representing an existing file
Index / label atlas mapping file in .tsv format accordingly to BIDS.
- connectivity_matricesa list of items which are a pathlike object or string representing a file
Connectivity matrices.