63 std::unique_ptr<MNESourceSpace> guesses;
65 if (!guessname.isEmpty()) {
69 std::vector<std::unique_ptr<MNESourceSpace>> sp;
72 if (
static_cast<int>(sp.size()) != 1) {
73 qCritical(
"Incorrect number of source spaces in guess file");
76 qInfo(
"Read guesses from %s\n", guessname.toUtf8().constData());
77 guesses = std::move(sp[0]);
80 std::unique_ptr<MNESurface> inner_skull_owned;
81 Eigen::Vector3f r0 = f->
r0;
86 qInfo(
"Using inner skull surface from the BEM (%s)...\n", f->
bemname.toUtf8().constData());
89 }
else if (!guess_surfname.isEmpty()) {
90 qInfo(
"Reading inner skull surface from %s...\n", guess_surfname.toUtf8().data());
92 if (!inner_skull_owned)
94 inner_skull = inner_skull_owned.get();
100 if (guesses->nuse == 0) {
101 qCritical(
"No active guess locations remaining.");
108 std::vector<std::unique_ptr<MNESourceSpace>> guesses_vec;
109 guesses_vec.push_back(std::move(guesses));
112 guesses = std::move(guesses_vec[0]);
116 this->
nguess = guesses->nuse;
117 this->
rr.resize(guesses->nuse, 3);
118 for (k = 0, p = 0; k < guesses->np; k++)
119 if (guesses->inuse[k]) {
120 this->
rr.row(p) = guesses->rr.row(k);
146 qCritical(
"Data missing in compute_guess_fields");
150 qCritical(
"Noise covariance missing in compute_guess_fields");
153 qInfo(
"Go through all guess source locations...");
159 for (
int k = 0; k < this->
nguess; k++) {
168 qInfo(
"%f %f %f\n", sing[0], sing[1], sing[2]);
172 qInfo(
"[done %d sources]\n", this->nguess);
FIFF tag: the 16-byte tag header (kind, type, size, next) plus its decoded payload.
FIFF binary tag-stream layer: wraps a QIODevice to read and write FIFF tags, directories,...
#define FIFFV_BEM_SURF_ID_BRAIN
Per-iteration forward-field cache (forward matrix, SVD, column normalisation) used by the dipole-fit ...
Initial-guess grid for the dipole-fit optimiser, with per-guess forward fields pre-computed.
Dipole-fit workspace bundling sensor geometry, forward-model function pointers, noise covariance and ...
Lightweight triangulated surface (vertices, triangles, normals) used by surface-based routines.
Single-hemisphere source space (cortical surface or volume grid) loaded from FIFF.
Core MNE data structures (source spaces, source estimates, hemispheres).
FIFF file I/O, in-memory data structures and high-level readers/writers.
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).
dipoleFitFuncsRec * dipoleFitFuncs
Pointer alias for dipoleFitFuncsRec, used throughout the dipole fitting module.
Forward modelling — BEM solver, spherical models, sensor/coil definitions and the lead-field assembly...
static QString frame_name(int frame)
Eigen::MatrixX3f apply_inverse_trans(const Eigen::MatrixX3f &rr, bool do_move=true) const
static std::unique_ptr< MNELIB::MNESurface > make_guesses(MNELIB::MNESurface *guess_surf, float guessrad, const Eigen::Vector3f &guess_r0, float grid, float exclude, float mindist)
Generate a set of dipole guess locations inside a boundary surface.
Dipole fit workspace holding sensor geometry, forward model, noise covariance, and projection data.
std::unique_ptr< FIFFLIB::FiffCoordTrans > mri_head_t
static InvDipoleForward * dipole_forward_one(InvDipoleFitData *d, const Eigen::Vector3f &rd, InvDipoleForward *old)
Compute the forward solution for a single dipole position.
std::unique_ptr< MNELIB::MNECovMatrix > noise
std::unique_ptr< dipoleFitFuncsRec > sphere_funcs
std::unique_ptr< FWDLIB::FwdBemModel > bem_model
std::unique_ptr< dipoleFitFuncsRec > mag_dipole_funcs
dipoleFitFuncsRec * funcs
std::vector< InvDipoleForward::UPtr > guess_fwd
Eigen::Matrix< float, Eigen::Dynamic, 3, Eigen::RowMajor > rr
bool compute_guess_fields(InvDipoleFitData *f)
This defines a source space.
static int read_source_spaces(const QString &name, std::vector< std::unique_ptr< MNESourceSpace > > &spaces)
static int transform_source_spaces_to(int coord_frame, const FIFFLIB::FiffCoordTrans &t, std::vector< std::unique_ptr< MNESourceSpace > > &spaces)
Lightweight triangulated surface (vertices, triangles, normals).
static std::unique_ptr< MNESurface > read_bem_surface(const QString &name, int which, bool add_geometry)