Skip to main content

MNE Library

Namespace: MNELIB  ·  Source: src/libraries/mne The Mne library contains the core neuroscience data structures used throughout MNE-CPP — source spaces, source estimates, forward solutions, inverse operators, hemispheres, BEM surfaces, covariance matrices, epochs, projections, and many supporting geometry types. It is the C++ counterpart of the structures defined in the original MNE-C libmne and the core mne Python package. All classes reside in the MNELIB namespace.

Architecture​

The library mirrors the data model of the original MNE software closely. Most classes are direct C++ translations of the MNE-C structs with added Qt/Eigen integration.

Class Inventory​

Source Spaces​

ClassDescriptionMNE-PythonMNE-C
MNESourceSpaceSingle surface or volume source space with vertex positions, normals, triangles, and neighbour listsSourceSpaces[0]mneSurfaceOrVolume
MNESourceSpacesContainer for multiple source spaces (typically left + right hemisphere)mne.SourceSpacesMultiple mneSurfaceOrVolume
MNEHemisphereCortical hemisphere source space with patch clustering and decimated vertex setsVia SourceSpacesmneSurfaceOrVolume
MNESurfaceOrVolumeBase class for any surface or volume mesh with common geometry fieldsBase of SourceSpacesmneSurfaceOrVolume

Surfaces & Geometry​

ClassDescriptionMNE-PythonMNE-C
MNESurfaceTriangulated surface mesh (vertices, normals, triangles)read_surface()mneSurface
MNETrianglePer-triangle data: edge vectors, face normal, area, centroidInternalmneTriangle
MNEVolGeomVolume geometry: voxel-to-RAS transforms, dimensions, voxel sizeVolSourceEstimate metadatamneVolGeom
MNEPatchInfoCortical patch: member vertices, area, average normal deviationLabel (partial)mnePatchInfo
MNENearestNearest-neighbour record linking original vertices to decimated source pointsAdjacency matricesmneNearest
MNEClusterInfoCluster assignment with labels and statisticsmne.stats.cluster_level resultsmneClusterInfo

BEM Surfaces​

ClassDescriptionMNE-PythonMNE-C
MNEBemBEM model container holding multiple tissue surfacesmne.read_bem_solution()Multiple mneBemSurface
MNEBemSurfaceSingle BEM surface (scalp, outer skull, inner skull) with conductivity and triangle metadataBEM surface in solutionmneBemSurface

Forward & Inverse Operators​

ClassDescriptionMNE-PythonMNE-C
MNEForwardSolutionLead-field matrix with geometry, channel info, and source space referencemne.Forward / mne.read_forward_solution()mneForwardSolution
MNEInverseOperatorSVD-decomposed whitened lead field with source and noise covariancemne.minimum_norm.InverseOperatormneInverseOperator

Raw Data & Measurement​

ClassDescriptionMNE-PythonMNE-C
MNERawDataRaw continuous data with filtering, projection, and CTF/SSS compensationmne.io.RawmneRawData
MNERawInfoMetadata about raw data (sampling rate, channels, transforms)Raw.infomneRawInfo
MNERawBufDefBuffer segment definition for memory-mapped raw data accessInternalmneRawBufDef
MNEMeasDataMeasurement data container with associated inverse datamne.Evoked / mne.EpochsmneMeasData
MNEMeasDataSetSingle measurement epoch with data matrix and metadataPer-epoch datamneMeasDataSet
MNEEpochDataSingle trial epoch with time range and artifact rejection statusItem in mne.EpochsmneEpochData
MNEEpochDataListList of epochs with rejection thresholds, baseline, and I/O routinesmne.EpochsMultiple mneEpochData
MNEMneDataComputed MNE inverse data: projection, prediction, SNR, regularisation parametersAttributes in SourceEstimatemneMneData

Morph Maps & Surface Operations​

ClassDescriptionMNE-PythonMNE-C
MNEMorphMapVertex-to-vertex mapping between two FreeSurfer surfaces for morphing source estimatesmne.read_morph_map()morphMapRec
MNESurfacePatchPatch linking vertices to a source point on cortical surfaceEmbedded in SourceSpacesPart of mnePatchInfo
MNEProjectToSurfaceProjection of arbitrary 3D points onto a triangulated surface mesh_project_onto_surface()mne_project_to_surface
performIcp / fitMatchedPointsIterative Closest Point and matched-point rigid registration (co-registration, mne_icp.h)ICP via mne.coreg—

Projection & Compensation​

ClassDescriptionMNE-PythonMNE-C
MNEProjOpSSP projection operator managing multiple projection itemsmne.read_proj()mneLinspace
MNEProjItemSingle SSP vector with kind, description, and active flagOne SSP componentmneLinspaceRec
MNEProjDataPrecomputed auxiliary projection data for efficient repeated applicationInternal—
MNECovMatrixNoise or source covariance with eigendecomposition, channel sub-selection, and whiteningmne.CovariancemneCovMatrix
MNECTFCompDataSingle CTF compensation element (matrix + metadata)mne.Info['comps'][i]mneCTFCompData
MNECTFCompDataSetCollection of CTF compensation matricesapply_gradient_compensation()Multiple mneCTFCompData
MNESssDataMaxwell filtering (SSS) data for gradiometer/magnetometer reductionSSS via maxwell_filter()mneSssData

Derivations & Channels​

ClassDescriptionMNE-PythonMNE-C
MNEDerivSingle virtual channel derivation with sparse coefficient vectorCustom channelsmneDeriv
MNEDerivSetCollection of channel derivations—Multiple mneDeriv
MNEChSelectionChannel selection with regex pattern and picked indicespick_channels()mneChSelection

Named Matrices & Vectors​

ClassDescriptionMNE-PythonMNE-C
MNENamedMatrixDense matrix with labelled row and column namesInternalmneNamedMatrix
MNENamedVectorVector with element namesInternalmneNamedVector
MNESparseNamedMatrixSparse matrix with labelled rows/columnsInternalmneSparseNamedMatrix

Visualisation Helpers​

ClassDescriptionMNE-PythonMNE-C
MNEMshDisplaySurfaceSurface mesh for 3D rendering with colour mapping and morphingBrain / add_surface()mshDisplaySurface
MNEMshDisplaySurfaceSetCollection of display surfaces for multi-hemisphere visualisationBrain surfacesMultiple mshDisplaySurface
MNEMshLight / MNEMshLightSetLight sources for 3D sceneLighting configmshLight
MNEMshEyesCamera/eye position for 3D renderingCamera viewpointmshEyes
MNEMshPickedPicked vertex on displayed surface (index, coordinates, value)Click selectionmshPicked
MNEMshColorScaleDefColour scale definition with value range and colour mappingColormapmshColorScaleDef
MNELayout / MNELayoutPort2D channel layout for topographic displaysmne.channels.read_layout()mneLayout

Events & Triggers​

ClassDescriptionMNE-PythonMNE-C
MNEEventSingle trigger/stimulus event marker with sample, before, and after valuesEvent tuplemneEvent
MNEEventListOrdered collection of event markersmne.read_events() resultsMultiple mneEvent

File I/O & Utilities​

ClassDescriptionMNE-PythonMNE-C
MNEDescriptionParserParser for MNE-C style .ave and .cov description files—interpret.c
CovDescription / ProcessingSettingsParsed covariance description and processing settings (mne_process_description.h)——
MNEFilterDefFilter definition (highpass, lowpass, notch parameters)Filter specsmneFilterDef

Clustering​

ClassDescriptionMNE-PythonMNE-C
RegionData / RegionMTInput parameters for KMeans-based cortical region clusteringmne.SourceSpaces clustering—
RegionDataOut / RegionMTOutOutput of KMeans-based source clustering on cortical regionsCluster results—

Static Utility Class​

ClassDescription
MNEStatic utility wrapper providing MATLAB-toolbox-like functions: combine_xyz(), find_source_space_hemi(), make_compensator(), get_current_comp(), make_block_diag(), read_events(), setup_volume_source_space()

Usage Example​

#include <mne/mne.h>

using namespace MNELIB;
using namespace FIFFLIB;

// Read source spaces
MNESourceSpaces srcSpaces;
MNE::read_source_spaces("sample-src.fif", srcSpaces);

qDebug() << "Hemispheres:" << srcSpaces.size();
qDebug() << "LH vertices:" << srcSpaces[0].nuse;
qDebug() << "RH vertices:" << srcSpaces[1].nuse;

// Read forward solution
MNEForwardSolution fwd =
MNEForwardSolution::read("sample_audvis-meg-eeg-oct-6-fwd.fif");

// Read inverse operator
MNEInverseOperator invOp =
MNEInverseOperator::read("sample_audvis-meg-eeg-oct-6-inv.fif");

// Read epochs
FiffRawData raw("sample_audvis_raw.fif");
Eigen::MatrixXi events;
MNE::read_events("sample_audvis_raw-eve.fif", events);

MNEEpochDataList epochs;
epochs = MNEEpochDataList::readEpochs(raw, events,
-0.2, 0.5, /*eventType=*/1);

Doxygen Reference​

For method signatures, inheritance diagrams, and source-level documentation see the auto-generated MNELIB namespace in the Doxygen API reference.

See Also​