Command-Line Tools Reference
MNE-CPP includes a comprehensive set of command-line tools for MEG/EEG data processing, BEM model creation, forward solution computation, and inverse estimation. These tools are C++ ports of the original MNE-C tools created by Matti Hämäläinen.
Typical Processing Pipeline
The tools below are organized by their role in a typical MEG/EEG analysis workflow:
- Data Import — Convert raw data from various acquisition systems to FIFF format.
- Preprocessing — Mark bad channels, apply compensation, filter, and compute SSP projectors.
- Head Model (BEM) — Create and validate boundary-element model surfaces.
- Source Space — Set up cortical surface or volumetric source grids.
- Forward & Inverse Computation — Compute lead fields and source estimates.
- Morphing & Group Analysis — Map results across subjects for group studies.
- Simulation & Validation — Generate synthetic data and compare files.
Data Import and Conversion
| Tool | Description |
|---|---|
| mne_edf2fiff | Converts EDF/EDF+ files to FIFF format |
| mne_brain_vision2fiff | Converts BrainVision EEG data (.vhdr) to FIFF format |
| mne_ctf2fiff | Converts CTF MEG datasets (.ds) to FIFF format |
| mne_kit2fiff | Converts KIT/Yokogawa MEG data (.sqd/.con) to FIFF format |
| mne_tufts2fiff | Converts Tufts University EEG data to FIFF format |
| mne_eximia2fiff | Converts Nexstim eXimia EEG data (.nxe) to FIFF format |
| mne_raw2mat | Exports raw FIFF data to MATLAB .mat format |
| mne_epochs2mat | Exports epoched data to MATLAB .mat format |
| mne_convert_surface | Converts surface meshes between FIFF, FreeSurfer, .tri, and .smf formats |
| mne_convert_dig_data | Converts digitization data between FIFF and hpts formats |
| mne_ctf_dig2fiff | Converts CTF Polhemus digitization data to FIFF/hpts format |
| mne_convert_ctf_markers | Converts CTF marker files to FIFF event format |
| mne_mna_bids_converter | Converts between MNA project format and BIDS directory layout |
Raw Data Processing and Preprocessing
| Tool | Description |
|---|---|
| mne_process_raw | Batch processing of raw data: filtering, decimation, averaging, covariance estimation, SSP, and event detection |
| mne_mark_bad_channels | Marks channels as bad in a FIFF measurement file |
| mne_rename_channels | Renames channels in a FIFF file using an alias mapping |
| mne_fix_mag_coil_types | Fixes magnetometer coil type definitions in FIFF files |
| mne_compensate_data | Applies or changes CTF software gradient compensation grade |
| mne_cov2proj | Derives SSP projection vectors from a noise covariance matrix |
| mne_anonymize | Removes or modifies personal health information from FIFF files |
| mne_add_triggers | Adds trigger events to raw data from a text file |
| mne_change_baselines | Changes the baseline interval in evoked data files |
| mne_change_nave | Modifies the number of averages (n_ave) field in evoked data |
| mne_copy_processing_history | Copies processing history tags between FIFF files |
| mne_fix_stim14 | Reconstructs STI 014 by combining STI 001–006 |
| mne_make_derivations | Parses a text derivation file into FIFF format |
| mne_toggle_skips | Toggles skip tags in raw data files |
BEM Model Creation and Validation
| Tool | Description |
|---|---|
| mne_watershed_bem | Creates BEM surfaces using FreeSurfer's watershed algorithm |
| mne_flash_bem | Creates BEM surfaces using multi-echo FLASH MRI sequences |
| mne_surf2bem | Converts FreeSurfer surfaces and ASCII triangle files into BEM FIFF files |
| mne_setup_forward_model | Sets up the BEM for forward modeling |
| mne_prepare_bem_model | Computes the BEM solution (geometry matrices) for the forward solver |
| mne_make_sphere_bem | Creates a spherical BEM model from concentric shells |
| mne_check_surface | Validates BEM and FreeSurfer surface meshes for topological correctness |
| mne_list_bem | Exports BEM surface data from FIFF to ASCII text |
| mne_fit_sphere_to_surf | Fits a sphere to a set of surface points |
| mne_make_scalp_surfaces | Generates decimated scalp surface meshes for visualization |
| mne_transform_points | Transforms 3D points between coordinate frames |
MRI Setup
| Tool | Description |
|---|---|
| mne_setup_mri | Sets up FreeSurfer MRI data for MNE processing |
| mne_make_cor_set | Creates a FIFF MRI description file from FreeSurfer COR or mgh/mgz data |
Source Space Setup
| Tool | Description |
|---|---|
| mne_make_source_space | Creates cortical source spaces from FreeSurfer surfaces |
| mne_volume_source_space | Creates volumetric source spaces on a regular 3D grid |
| mne_add_patch_info | Adds cortical patch statistics to a source space |
| mne_list_source_space | Lists the contents of a source space file |
| mne_annot2labels | Converts FreeSurfer annotation files to individual label files |
Forward and Inverse Computation
| Tool | Description |
|---|---|
| mne_forward_solution | Computes the MEG/EEG forward solution |
| mne_average_forward_solutions | Computes a weighted average of multiple forward solutions |
| mne_sensitivity_map | Computes a sensitivity map from a forward solution |
| mne_inverse_operator | Assembles a linear inverse operator from a forward solution and noise covariance |
| mne_compute_mne | Computes MNE/dSPM/sLORETA source estimates from evoked data |
| mne_compute_raw_inverse | Computes inverse solutions (MNE/dSPM/sLORETA) on continuous data |
| mne_dipole_fit | Performs electric current dipole fitting |
| mne_volume_data2mri | Maps volume source estimates to MRI voxel space |
| mne_compute_cmne | Computes CMNE source estimates using ONNX Runtime (compute/train/finetune) |
| mne_inverse_pipeline | Executes an MNA graph-based inverse processing pipeline |
| mne_label_ssp | Creates SSP projectors from cortical ROI labels |
| mne_average_estimates | Computes weighted average of STC source estimate files |
| mne_process_stc | Scales, exports, or copies STC source estimate files |
| mne_make_uniform_stc | Creates uniform-value STC files for testing and validation |
| mne_map_data | Maps evoked data between different sensor arrays |
Morphing and Group Analysis
| Tool | Description |
|---|---|
| mne_make_morph_maps | Precomputes surface morphing maps between FreeSurfer subjects |
| mne_morph_labels | Morphs cortical label files between subjects |
| mne_smooth | Applies spatial smoothing to cortical source estimates |
Utilities
| Tool | Description |
|---|---|
| mne_add_to_meas_info | Adds tags from one FIFF file to the measurement info of another |
| mne_collect_transforms | Collects coordinate transforms from FIFF files |
| mne_create_comp_data | Creates CTF compensation data from ASCII matrix files |
| mne_insert_4D_comp | Merges 4D Neuroimaging reference channel compensation data with FIFF |
| mne_make_eeg_layout | Creates 2D topographical EEG layout from electrode positions |
Simulation
| Tool | Description |
|---|---|
| mne_simu | Generates simulated MEG/EEG data from a forward solution |
Inspection and Information
| Tool | Description |
|---|---|
| mne_show_fiff | Lists the contents of a FIFF file |
| mne_compare_fif_files | Compares two FIFF files tag by tag |
| mne_check_eeg_locations | Validates EEG electrode positions in a FIFF file |
| mne_evoked_data_summary | Prints a summary of evoked data sets in a FIFF file |
| mne_list_coil_def | Lists coil definitions from the coil definition file |
| mne_list_proj | Lists SSP projection vectors in a FIFF file |
| mne_sensor_locations | Exports sensor locations to a text file |
| mne_show_mna | Displays the contents of an MNA project file |
Real-Time Streaming
| Tool | Description |
|---|---|
| mne_rt_server | Real-time FIFF data streaming server |