Skip to main content

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​

ExampleWhat it shows
ex_connectivityExample of using the MNE-CPP Connectivity library
ex_connectivity_comparisonExample to compare connectivity methods
ex_connectivity_metricsConnectivity metrics on synthetic data with a known coupling
ex_connectivity_performanceBenchmark the run time of connectivity methods over channel and sample counts
ex_disp3d_sceneDisp3D scene data: sensor-to-surface interpolation, electrodes, MRI slices, video overlay and layers
ex_dsp_rtDSP real-time workers: averaging, covariance, noise spectrum, connectivity, HPI fitting and inverse operators
ex_fiff_snifferRead a FIFF file from a memory buffer with a chosen byte order and summarise its contents

Decoding​

ExampleWhat it shows
ex_decodingSpatial decoders and ICA labelling on synthetic mixtures with a known ground truth

Machine Learning​

ExampleWhat it shows
ex_mlML library: tensors, ONNX inference through the MlModel interface, and the Python trainer

Statistics​

ExampleWhat it shows
ex_sts_statisticsStatistics library on small literal data sets with known answers

Inverse​

ExampleWhat it shows
ex_clustered_inverse_mneExample of a Clustered Inverse Minimum Norm Estimation application
ex_clustered_inverse_mne_rawExample of the computation of a clustered inverse mne raw
ex_clustered_inverse_pwl_rap_music_rawExample of the computation of a raw clustered inverse Powell RAP-MUSIC
ex_clustered_inverse_rap_music_rawExample of the computation of a raw clustered inverse rap music
ex_disp_3DExample of using the MNE-CPP Disp3D library
ex_dsp_analysisDSP library: Welch PSD, FIR filtering, peak finding, envelope correlation, SPHARA and simulation
ex_histogramExample application of reading raw data and presenting the result in histogram form
ex_hpiFitExample for cHPI fitting on raw data with SSP. The result is written to a .txt file for comparison with MaxFilter's .pos file
ex_interpolationExample of using the interpolation library and geometryInfo library
ex_inv_apiInverse library: minimum-norm estimates, resolution matrices, label time courses, sparse solvers
ex_inv_beamformerInverse library: LCMV and DICS beamformers and the RAP-MUSIC family of dipole scanners
ex_inv_dipole_fitInverse library: equivalent current dipole fitting in a sphere model
ex_inv_hpiInverse library: continuous head position (HPI) fitting
ex_inverse_mneExample of a L2 minimum-norm estimate or a dSPM solution
ex_inverse_mne_rawExample of a computation of a raw inverse
ex_inverse_pwl_rap_musicExample of MNEForwardSolution and Powell Rap Music application
ex_inverse_rap_musicExample of MNEForwardSolution and InvRapMusic application
ex_make_inverse_operatorExample of making an inverse operator
ex_roi_clustered_inverse_pwl_rap_musicExample of the computation of a roi clustered inverse powell rap music
ex_st_clustered_inverse_pwl_rap_musicExample of the computation of a single trial clustered inverse rap music

Forward​

ExampleWhat it shows
ex_compute_forwardThis example shows how to compute the forward solution
ex_fwd_apiForward library: coil definitions, BEM and sphere models, field maps and forward solutions

3D Visualization​

ExampleWhat it shows
ex_coregCoregistration workflow: fit digitizer points to the head surface with ICP
ex_fs_surfaceExample of an FreeSurfer FsSurface application
ex_read_fwd_disp_3DExample of reading ForwardSolution data from a fiff file and display it in 3D

Visualization​

ExampleWhat it shows
ex_dispDisp library widgets: image map, line plot and time-frequency plot of raw data
ex_disp_plotsDisp plots: colour maps, bar and spline histograms, line plots, image and time-frequency maps
ex_spectralExample of the computation of spectra, PSD and CSD
ex_tf_plotRead data and perform tf analysis

Signal Processing​

ExampleWhat it shows
ex_dsp_artifactsArtifact detection and repair with the dsp library on a recording with planted defects
ex_dsp_filterFIR filter design, application and storage with the dsp library
ex_dsp_maxwellDSP Maxwell filtering: SSS, bad-channel detection, movement compensation, fine calibration and cHPI removal
ex_dsp_preprocessingPreprocessing tools of the dsp library on synthetic data with a known ground truth
ex_dsp_spectralSpectral and filtering tools of the dsp library on signals with known content
ex_filteringExample for filtering data with a user defined FIR filter and writing the result to a file

iEEG​

ExampleWhat it shows
ex_ieegIEEG library: group sEEG contacts into a lead, derive a bipolar montage and paint contact values onto a surface

BIDS​

ExampleWhat it shows
ex_bidsBIDS library: paths, sidecar TSVs, BrainVision/EDF readers and a raw-data round trip

Lab Streaming Layer​

ExampleWhat it shows
ex_lslLSL library: publish a stream, discover it and receive its samples over loopback

MNA Pipelines​

ExampleWhat it shows
ex_mnaMNA library: register operations, build and run a graph, bind parameters and save a project

MRI​

ExampleWhat it shows
ex_mriMRI library: MGH/MGZ and NIfTI volumes, voxel/RAS transforms, slicing and COR sets

FreeSurfer​

ExampleWhat it shows
ex_fsFreeSurfer library: surfaces, curvature, parcellations, labels and an atlas volume
ex_mne_apiMNE library: BEM surfaces, surface projection, ICP, source spaces and epochs
ex_read_fwdExample of reading ForwardSolution data from a fiff file

MNE Core​

ExampleWhat it shows
ex_averagingAverage data from a raw data file
ex_cancel_noiseExample of noise cancellation procedures
ex_evoked_grad_ampCompute tangential gradient amplitudes from planar gradiometer data
ex_fiff_ioExample of the FiffIO interface class
ex_find_evokedFind all evoked data sets from a file
ex_read_bemExample of reading BEM data
ex_read_epochsRead epoch data from a raw data file
ex_read_evokedExample for read an evoked from fiff file
ex_read_rawExample of reading raw data

FIFF I/O​

ExampleWhat it shows
ex_fiff_apiFIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events,
ex_fiff_structureFIFF library: fixed-length epochs, CTF compensation, the file directory and raw buffers, and handing
ex_make_layoutBuilds example for making a 2D layout from 3D points
ex_read_write_rawExample of processing raw data (read and write)

Math​

ExampleWhat it shows
ex_mathMath library on inputs with known answers
ex_warpExample demonstrating thin-plate-spline (TPS) warping with UTILSLIB::Warp

Utilities​

ExampleWhat it shows
ex_utilsUtilities library: buffers, observers, logging, file formats, montages, layouts and reports