Examples
69 runnable programs in src/examples, built with the rest of MNE-CPP. Each page lists the libraries the example uses, its options, and its full source.
Connectivity
| Example | What it shows |
|---|---|
| ex_connectivity | Example of using the MNE-CPP Connectivity library |
| ex_connectivity_comparison | Example to compare connectivity methods |
| ex_connectivity_metrics | Connectivity metrics on synthetic data with a known coupling |
| ex_connectivity_performance | Benchmark the run time of connectivity methods over channel and sample counts |
| ex_disp3d_scene | Disp3D scene data: sensor-to-surface interpolation, electrodes, MRI slices, video overlay and layers |
| ex_dsp_rt | DSP real-time workers: averaging, covariance, noise spectrum, connectivity, HPI fitting and inverse operators |
| ex_fiff_sniffer | Read a FIFF file from a memory buffer with a chosen byte order and summarise its contents |
Decoding
| Example | What it shows |
|---|---|
| ex_decoding | Spatial decoders and ICA labelling on synthetic mixtures with a known ground truth |
Machine Learning
| Example | What it shows |
|---|---|
| ex_ml | ML library: tensors, ONNX inference through the MlModel interface, and the Python trainer |
Statistics
| Example | What it shows |
|---|---|
| ex_sts_statistics | Statistics library on small literal data sets with known answers |
Inverse
| Example | What it shows |
|---|---|
| ex_clustered_inverse_mne | Example of a Clustered Inverse Minimum Norm Estimation application |
| ex_clustered_inverse_mne_raw | Example of the computation of a clustered inverse mne raw |
| ex_clustered_inverse_pwl_rap_music_raw | Example of the computation of a raw clustered inverse Powell RAP-MUSIC |
| ex_clustered_inverse_rap_music_raw | Example of the computation of a raw clustered inverse rap music |
| ex_disp_3D | Example of using the MNE-CPP Disp3D library |
| ex_dsp_analysis | DSP library: Welch PSD, FIR filtering, peak finding, envelope correlation, SPHARA and simulation |
| ex_histogram | Example application of reading raw data and presenting the result in histogram form |
| ex_hpiFit | Example for cHPI fitting on raw data with SSP. The result is written to a .txt file for comparison with MaxFilter's .pos file |
| ex_interpolation | Example of using the interpolation library and geometryInfo library |
| ex_inv_api | Inverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers |
| ex_inv_beamformer | Inverse library: LCMV and DICS beamformers and the RAP-MUSIC family of dipole scanners |
| ex_inv_dipole_fit | Inverse library: equivalent current dipole fitting in a sphere model |
| ex_inv_hpi | Inverse library: continuous head position (HPI) fitting |
| ex_inverse_mne | Example of a L2 minimum-norm estimate or a dSPM solution |
| ex_inverse_mne_raw | Example of a computation of a raw inverse |
| ex_inverse_pwl_rap_music | Example of MNEForwardSolution and Powell Rap Music application |
| ex_inverse_rap_music | Example of MNEForwardSolution and InvRapMusic application |
| ex_make_inverse_operator | Example of making an inverse operator |
| ex_roi_clustered_inverse_pwl_rap_music | Example of the computation of a roi clustered inverse powell rap music |
| ex_st_clustered_inverse_pwl_rap_music | Example of the computation of a single trial clustered inverse rap music |
Forward
| Example | What it shows |
|---|---|
| ex_compute_forward | This example shows how to compute the forward solution |
| ex_fwd_api | Forward library: coil definitions, BEM and sphere models, field maps and forward solutions |
3D Visualization
| Example | What it shows |
|---|---|
| ex_coreg | Coregistration workflow: fit digitizer points to the head surface with ICP |
| ex_fs_surface | Example of an FreeSurfer FsSurface application |
| ex_read_fwd_disp_3D | Example of reading ForwardSolution data from a fiff file and display it in 3D |
Visualization
| Example | What it shows |
|---|---|
| ex_disp | Disp library widgets: image map, line plot and time-frequency plot of raw data |
| ex_disp_plots | Disp plots: colour maps, bar and spline histograms, line plots, image and time-frequency maps |
| ex_spectral | Example of the computation of spectra, PSD and CSD |
| ex_tf_plot | Read data and perform tf analysis |
Signal Processing
| Example | What it shows |
|---|---|
| ex_dsp_artifacts | Artifact detection and repair with the dsp library on a recording with planted defects |
| ex_dsp_filter | FIR filter design, application and storage with the dsp library |
| ex_dsp_maxwell | DSP Maxwell filtering: SSS, bad-channel detection, movement compensation, fine calibration and cHPI removal |
| ex_dsp_preprocessing | Preprocessing tools of the dsp library on synthetic data with a known ground truth |
| ex_dsp_spectral | Spectral and filtering tools of the dsp library on signals with known content |
| ex_filtering | Example for filtering data with a user defined FIR filter and writing the result to a file |
iEEG
| Example | What it shows |
|---|---|
| ex_ieeg | IEEG library: group sEEG contacts into a lead, derive a bipolar montage and paint contact values onto a surface |
BIDS
| Example | What it shows |
|---|---|
| ex_bids | BIDS library: paths, sidecar TSVs, BrainVision/EDF readers and a raw-data round trip |
Lab Streaming Layer
| Example | What it shows |
|---|---|
| ex_lsl | LSL library: publish a stream, discover it and receive its samples over loopback |
MNA Pipelines
| Example | What it shows |
|---|---|
| ex_mna | MNA library: register operations, build and run a graph, bind parameters and save a project |
MRI
| Example | What it shows |
|---|---|
| ex_mri | MRI library: MGH/MGZ and NIfTI volumes, voxel/RAS transforms, slicing and COR sets |
FreeSurfer
| Example | What it shows |
|---|---|
| ex_fs | FreeSurfer library: surfaces, curvature, parcellations, labels and an atlas volume |
| ex_mne_api | MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs |
| ex_read_fwd | Example of reading ForwardSolution data from a fiff file |
MNE Core
| Example | What it shows |
|---|---|
| ex_averaging | Average data from a raw data file |
| ex_cancel_noise | Example of noise cancellation procedures |
| ex_evoked_grad_amp | Compute tangential gradient amplitudes from planar gradiometer data |
| ex_fiff_io | Example of the FiffIO interface class |
| ex_find_evoked | Find all evoked data sets from a file |
| ex_read_bem | Example of reading BEM data |
| ex_read_epochs | Read epoch data from a raw data file |
| ex_read_evoked | Example for read an evoked from fiff file |
| ex_read_raw | Example of reading raw data |
FIFF I/O
| Example | What it shows |
|---|---|
| ex_fiff_api | FIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events, |
| ex_fiff_structure | FIFF library: fixed-length epochs, CTF compensation, the file directory and raw buffers, and handing |
| ex_make_layout | Builds example for making a 2D layout from 3D points |
| ex_read_write_raw | Example of processing raw data (read and write) |
Math
| Example | What it shows |
|---|---|
| ex_math | Math library on inputs with known answers |
| ex_warp | Example demonstrating thin-plate-spline (TPS) warping with UTILSLIB::Warp |
Utilities
| Example | What it shows |
|---|---|
| ex_utils | Utilities library: buffers, observers, logging, file formats, montages, layouts and reports |