Skip to content

MNE-CPP v2.2.0

Choose a tag to compare

@chdinh chdinh released this 28 Apr 15:57

What's Changed

Highlights

  • MNX as MNE Scan project storage — Pipeline configurations now load and save as .mna (JSON) or .mnx (CBOR) files via MnaIO; legacy XML pipeline format removed. Default auto-save path is default.mna.
  • Unified File-menu naming across applications — mne_scan, mne_inspect, and mne_browse now use the same "Open Project… / Save Project… / Export Project as MNX…" pattern.
  • MNE-C CLI parity (82 tools) — every command-line tool from MNE-C has a mne-cpp counterpart; final 4 ports landed in this release (mne_make_movie, mne_convert_lspcov, mne_convert_ncov, mne_dacq_annotator).
  • Lossless MNA / MNX round-trip — every MNA struct preserves unknown JSON/CBOR keys via an extras field, so newer schema fields survive a round-trip through older software.
  • Performance as a co-equal optimization goal — periodic code-optimization prompt and matching optimization-requirements.md doc cover both idiomatic-code refactors and quantitative perf wins (≥ 5 % wall-clock).

New Features

  • MNA graph-execution library (mne_mna): New library for the .mna analysis node-graph format with YAML-based operator definitions, topological execution, and MnaOpRegistry for built-in and user-registered operators
  • MNX binary container — CBOR-based binary equivalent of .mna (MNX1 magic header), with embedded-data support and identical key structure for lossless format conversion
  • MNA Scan integration — MnaGraph m_pPipelineGraph mirrors the live plugin scene in PluginSceneManager; MnaDataKind ↔ ConnectorDataType mapping shipped in mna_scan_types; PluginGui::loadConfig/saveConfig route through MnaIO::read/MnaIO::write
  • Stream-mode MnaGraphExecutor — MnaGraphExecutor::startStream() / stopStream() with StreamContext for real-time acquisition pipelines
  • Machine-learning library (mne_ml): New library with MlTrainer for sklearn-compatible model training via embedded Python, supporting SVM, Random Forest, Logistic Regression, and custom estimators
  • STS covariance estimators: Added Ledoit-Wolf and Oracle Approximating Shrinkage (OAS) estimators to the sts library with cross-validation support against scikit-learn
  • Source-space cluster permutation tests — StatsCluster::oneSamplePermutationTest(), fTestPermutationTest(), tfce() (threshold-free cluster enhancement); StatsAdjacency::fromSourceSpaceTemporal() for spatio-temporal adjacency
  • Spectral connectivity expansion — GrangerCausality ("GC"), DirectedTransferFunction ("DTF"), PartialDirectedCoherence ("PDC"); shared MVAR fitting via MvarModel
  • CMNE sparse inverse: Added Cascaded MNE (InvCMNE) solver to the inverse library for spatially sparse source estimation
  • DSP Infomax ICA: Extended the dsp library with an Infomax-based ICA decomposition algorithm
  • BIDS coordinate system: Added BidsCoordinateSystem class for round-trip parsing and writing of coordinatesystem.json, and BidsElectrode::toFiffDigPoints() for converting BIDS electrodes to FIFF digitizer point sets
  • FreeSurfer atlas lookup: Added FsAtlasLookup for Desikan-Killiany / Destrieux atlas region querying
  • MRI slicer: Added MriSlicer class for extracting orthogonal slices (Axial/Sagittal/Coronal) from NIfTI volumes
  • 3D electrode visualization: ElectrodeObject now includes QRhi GPU buffer management (updateBuffers, vertexBuffer, indexBuffer, instanceBuffer) following the BrainSurface pattern; new electrode.vert / electrode.frag shaders with instanced contact spheres and Blinn-Phong lighting
  • 3D MRI slice visualization: New SliceObject renderable for textured MRI volume slices with voxel-to-world transforms and intensity windowing; new slice.vert / slice.frag shaders
  • FiffAnnotations integration: AnnotationModel refactored to use FiffAnnotations as backing store instead of internal QVector<AnnotationEntry>, with fiffAnnotations() / setFiffAnnotations() public accessors
  • Python cross-validation tests: Added GUARD_PYTHON / GUARD_PYTHON_PACKAGE macros ensuring Python-dependent tests fail in CI (MNE_REQUIRE_PYTHON=true) instead of silently skipping
  • PythonTestHelper extensions: Added writeMatrix(), readMatrix(), and evalMatrixViaFile() convenience methods for Eigen↔NumPy round-trip validation
  • MNA Scan plugin registry: Added scan-plugins.json schema and MnaScanTypes class for declaring MNE Scan plugins as MNA operator schemas
  • W-file I/O: Added read_w and write_w methods to FiffStream for FreeSurfer .w format surface data
  • Cortical surface mapping: New MNECorticalMap class with icoDownsample() for icosahedral downsampling, smoothOperator() for nearest-neighbor surface smoothing, and computeMorphMaps() for cross-subject cortical morphing
  • Scalp surface generation: Added makeScalpSurfaces() to MNEBemSurface for creating decimated scalp meshes at multiple resolutions
  • Processing history: Added copyProcessingHistory() to FiffStream for transferring processing provenance between FIFF files

MNE Inspect

  • UI overhaul — Native QMenuBar (File / View / Tools / Help) with macOS system-menu integration, Recent Projects submenu (max 10), Ctrl+O / Ctrl+Q / Space shortcuts; closable + movable Controls and Loaded Files dock widgets with custom flat title bars; status bar with progress; saveState() / restoreState() persistence
  • Loaded Files panel — live QTreeWidget with Name / Type / Path columns and context menu (Remove, Copy Path, Show in Finder); double-click STC entry activates it in the source-estimate combo
  • Progressive-disclosure controls — load buttons removed from sidebar; menu actions are the single entry point; control groups disabled until matching data loads; data unload via Loaded Files context menu
  • WASM compatibility — menu bar renders inline; QFileDialog guarded for WASM; recent-files menu disabled on WASM

MNE Scan

  • File menu uses Project terminology — &New Project (Ctrl+N), &Open Project… (Ctrl+O, accepts *.mna *.mnx), &Save Project… (Ctrl+S, defaults .mna), &Export Project as MNX… (Ctrl+Shift+E, always binary CBOR)
  • Auto-save default path — default.xml → default.mna (auto-loaded on startup if present)
  • Foreign-data preservation — round-trip saves preserve unknown fields via m_loadedMnaProject
  • Modernised pipeline canvas — rounded-rect nodes with gradient fills, drop shadows, type labels (SENSOR / ALGORITHM), centred name, hollow-input / filled-output ports, Bezier connections with tangent arrowheads, dot-grid background, Tailwind-inspired palette, selection glow

MNE Browse

  • Project reset on standalone open — opening a raw file without a project resets m_mnxProject to prevent stale-project contamination across all 5 file-open entry points (desktop menu, WASM picker, recent files, drag-drop, CLI)

WASM Progressive Web App

  • PWA manifest + service worker — scripts/wasm/manifest.json, scripts/wasm/sw.js, 192×192 / 512×512 icons; offline caching with versioned cache keys; combined COOP/COEP header injection
  • No server required — deploy bundle to any static host; service worker injects required headers for SharedArrayBuffer

Command-Line Tools

  • Final MNE-C CLI parity (4 new): mne_make_movie (STC frames → PNG via FsSurface orthographic projection), mne_convert_lspcov (LISP S-expression covariance → FIFF FiffCov), mne_convert_ncov (ASCII ncov → FIFF), mne_dacq_annotator (event annotation replacing legacy Motif GUI)
  • Inverse tools (7 new): mne_compute_cmne, mne_inverse_pipeline, mne_label_ssp, mne_average_estimates, mne_process_stc, mne_make_uniform_stc, mne_map_data
  • Preprocessing tools (7 new): mne_add_triggers, mne_change_baselines, mne_change_nave, mne_copy_processing_history, mne_fix_stim14, mne_make_derivations, mne_toggle_skips
  • Info tools (6 new): mne_check_eeg_locations, mne_evoked_data_summary, mne_list_coil_def, mne_list_proj, mne_sensor_locations, mne_show_mna
  • Forward tools (3 new): mne_fit_sphere_to_surf, mne_make_scalp_surfaces, mne_transform_points
  • Conversion tools (3 new): mne_convert_ctf_markers, mne_epochs2mat, mne_mna_bids_converter
  • Total CLI inventory: 82 tools — full MNE-C feature parity

CI/CD

  • Upgraded codecov/codecov-action from v5 to v6 to resolve Node.js 20 deprecation warnings
  • Added MNE_REQUIRE_PYTHON: 'true' environment variable to all platform test steps
  • Added scikit-learn to Python test dependencies
  • Updated lodash from 4.17.23 to 4.18.1 (Dependabot security fix)

Bug Fixes

  • Fixed potential silent test skips — Python-dependent tests now respect MNE_REQUIRE_PYTHON enforcement
  • Fixed deprecated qWarn calls in test_mne_source_analysis (replaced with qWarning())
  • Fixed unused [[nodiscard]] return values in test_tool_inverse_computation

Documentation

  • Added 26 new command-line tool documentation pages
  • Comprehensive MNA / MNX format manual page (mna-format.mdx, ~692 lines) — file types, BIDS-like data hierarchy, computational graph, execution modes, parameter system, op registry, verification & provenance, MNX byte layout, schema versioning, complete annotated JSON example
  • Rewrote MNA API reference page (api-mna.mdx) with full class inventory (63 → 572 lines)
  • Added ML library API reference page (api-ml.mdx)
  • Added Statistics library API reference page (api-sts.mdx)
  • Updated tools overview with all 26 new tools and new "Inspection and Information" section
  • Updated overview and API pages with Mna, Ml, Sts library entries
  • Expanded glossary with 14 new terms (CMNE, DICS, LCMV, MNA, MxNE, ONNX, etc.) and 3 file format entries (.mna, .mnx, .onnx)
  • Fixed orphaned pages (mna-format, api-mna) by adding to sidebar navigation
  • Added zero-tolerance warning policy to development conventions
  • Added mne_analyze feature-parity gap analysis (Section 14 of gap-analysis.md); concrete plugin-level tasks moved to optimization-requirements.md § 15
  • Added reusable code-optimization Copilot prompt (.github/prompts/code-optimization.prompt.md) and matching optimization-requirements.md backlog with explicit performance scope