v2.0.0
Loading...
Searching...
No Matches
compute_fwd.h File Reference

Top-level driver that assembles the MEG/EEG lead-field matrix G from a source space, sensor array and volume-conductor model. More...

#include "../fwd_global.h"
#include "compute_fwd_settings.h"
#include <fiff/fiff_coord_trans.h>
#include <fiff/fiff_types.h>
#include <fiff/fiff_info_base.h>
#include "../fwd_coil_set.h"
#include "../fwd_eeg_sphere_model_set.h"
#include "../fwd_bem_model.h"
#include <mne/mne_ctf_comp_data_set.h>
#include <mne/mne_source_space.h>
#include <vector>
#include <memory>
#include <QSharedDataPointer>
#include <QSharedPointer>
#include <QString>
Include dependency graph for compute_fwd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FWDLIB::ComputeFwd
 Top-level driver for MEG/EEG forward-solution computation. More...

Namespaces

namespace  FIFFLIB
 FIFF file I/O, in-memory data structures and high-level readers/writers.
namespace  MNELIB
 Core MNE data structures (source spaces, source estimates, hemispheres).
namespace  FWDLIB
 Forward modelling — BEM solver, spherical models, sensor/coil definitions and the lead-field assembly that links current dipoles to MEG/EEG sensor readings.

Detailed Description

Top-level driver that assembles the MEG/EEG lead-field matrix G from a source space, sensor array and volume-conductor model.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

ComputeFwd is the C++ analogue of the mne_forward_solution command-line tool: given a ComputeFwdSettings (source-space file, BEM or sphere model, raw/measurement file, coil-definition file, coordinate transforms, accuracy level), it loads every piece of input data, sets up the requested volume-conductor model (BEM via FwdBemModel or analytic sphere via FwdEegSphereModel), wraps the resulting field/grad callbacks in a CTF/4D compensation layer when needed, and runs the parallel dipole loop that fills G column by column. The output MNEForwardSolution carries G plus all metadata (source orientations, channel info, projection operators) that the downstream inverse stage requires.

updateHeadPos() supports head-motion-corrected averaging: it re-evaluates only the MEG block of G after a new device-to-head transform without re-touching the source space or BEM solution, matching the behaviour of MNE-C mne_forward_solution – update_head_pos.

Definition in file compute_fwd.h.