71 float guessrad = 0.080;
72 std::unique_ptr<MNESourceSpace> guesses;
75 if (!guessname.isEmpty()) {
79 std::vector<std::unique_ptr<MNESourceSpace>> sp;
82 if (
static_cast<int>(sp.size()) != 1) {
83 qCritical(
"Incorrect number of source spaces in guess file");
86 qInfo(
"Read guesses from %s\n",guessname.toUtf8().constData());
87 guesses = std::move(sp[0]);
91 std::unique_ptr<MNESurface> inner_skull_owned;
92 Eigen::Vector3f r0 = f->
r0;
97 qInfo(
"Using inner skull surface from the BEM (%s)...\n",f->
bemname.toUtf8().constData());
101 else if (!guess_surfname.isEmpty()) {
102 qInfo(
"Reading inner skull surface from %s...\n",guess_surfname.toUtf8().data());
104 if (!inner_skull_owned)
106 inner_skull = inner_skull_owned.get();
113 std::vector<std::unique_ptr<MNESourceSpace>> guesses_vec;
114 guesses_vec.push_back(std::move(guesses));
117 guesses = std::move(guesses_vec[0]);
121 this->
nguess = guesses->nuse;
122 this->
rr.resize(guesses->nuse, 3);
123 for (k = 0, p = 0; k < guesses->np; k++)
124 if (guesses->inuse[k]) {
125 this->
rr.row(p) = guesses->rr.row(k);
130 qInfo(
"Go through all guess source locations...");
141 for (k = 0; k < this->
nguess; k++) {
147 qInfo(
"%f %f %f\n",sing[0],sing[1],sing[2]);
152 qInfo(
"[done %d sources]\n",p);
163 float guessrad = 0.080f;
164 std::unique_ptr<MNESourceSpace> guesses;
166 if (!guessname.isEmpty()) {
170 std::vector<std::unique_ptr<MNESourceSpace>> sp;
173 if (
static_cast<int>(sp.size()) != 1) {
174 qCritical(
"Incorrect number of source spaces in guess file");
177 qInfo(
"Read guesses from %s\n",guessname.toUtf8().constData());
178 guesses = std::move(sp[0]);
182 std::unique_ptr<MNESurface> inner_skull_owned;
183 Eigen::Vector3f r0 = f->
r0;
188 qInfo(
"Using inner skull surface from the BEM (%s)...\n",f->
bemname.toUtf8().constData());
192 else if (!guess_surfname.isEmpty()) {
193 qInfo(
"Reading inner skull surface from %s...\n",guess_surfname.toUtf8().data());
195 if (!inner_skull_owned)
197 inner_skull = inner_skull_owned.get();
206 if (guesses->nuse == 0) {
207 qCritical(
"No active guess locations remaining.");
210 if (guess_save_name) {
211 qCritical(
"###################DEBUG writing source spaces not yet implemented.");
220 std::vector<std::unique_ptr<MNESourceSpace>> guesses_vec;
221 guesses_vec.push_back(std::move(guesses));
224 guesses = std::move(guesses_vec[0]);
228 this->
nguess = guesses->nuse;
229 this->
rr.resize(guesses->nuse, 3);
230 for (k = 0, p = 0; k < guesses->np; k++)
231 if (guesses->inuse[k]) {
232 this->
rr.row(p) = guesses->rr.row(k);
258 qCritical(
"Data missing in compute_guess_fields");
262 qCritical(
"Noise covariance missing in compute_guess_fields");
265 qInfo(
"Go through all guess source locations...");
271 for (
int k = 0; k < this->
nguess; k++) {
280 qInfo(
"%f %f %f\n",sing[0],sing[1],sing[2]);
284 qInfo(
"[done %d sources]\n",this->nguess);
Lightweight triangulated surface (vertices, triangles, normals) used by surface-based routines.
Single-hemisphere source space (cortical surface or volume grid) loaded from FIFF.
#define FIFFV_BEM_SURF_ID_BRAIN
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,...
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 ...
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)