MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
dipole_fit_data.h
Go to the documentation of this file.
1//=============================================================================================================
37#ifndef DIPOLEFITDATA_H
38#define DIPOLEFITDATA_H
39
40//=============================================================================================================
41// INCLUDES
42//=============================================================================================================
43
44#include "../inverse_global.h"
45
46#include <fiff/fiff_types.h>
47#include "analyze_types.h"
48#include <fwd/fwd_types.h>
50#include <fwd/fwd_bem_model.h>
51#include "dipole_forward.h"
52
53//=============================================================================================================
54// EIGEN INCLUDES
55//=============================================================================================================
56
57#include <Eigen/Core>
58
59//=============================================================================================================
60// QT INCLUDES
61//=============================================================================================================
62
63#include <QSharedPointer>
64
65// ToDo move to cpp
66#define COLUMN_NORM_NONE 0 /* No column normalization requested */
67#define COLUMN_NORM_COMP 1 /* Componentwise normalization */
68#define COLUMN_NORM_LOC 2 /* Dipole locationwise normalization */
69
70//=============================================================================================================
71// DEFINE NAMESPACE INVERSELIB
72//=============================================================================================================
73
74namespace INVERSELIB
75{
76
77/*
78 * These are the type definitions for dipole fitting
79 */
80typedef void (*fitUserFreeFunc)(void *);
81
82// (Replaces *dipoleFitFuncs,dipoleFitFuncsRec struct of MNE-C fit_types.h).
83
84typedef struct {
85 fwdFieldFunc meg_field; /* MEG forward calculation functions */
86 fwdVecFieldFunc meg_vec_field;
87 void *meg_client; /* Client data for MEG field computations */
88 mneUserFreeFunc meg_client_free;
89
90 fwdFieldFunc eeg_pot; /* EEG forward calculation functions */
91 fwdVecFieldFunc eeg_vec_pot;
92 void *eeg_client; /* Client data for EEG field computations */
93 mneUserFreeFunc eeg_client_free;
95
96//=============================================================================================================
97// FORWARD DECLARATIONS
98//=============================================================================================================
99
100class GuessData;
101class ECD;
102
103//=============================================================================================================
110{
111public:
112 typedef QSharedPointer<DipoleFitData> SPtr;
113 typedef QSharedPointer<const DipoleFitData> ConstSPtr;
115 //=========================================================================================================
119 explicit DipoleFitData();
120
121 //=========================================================================================================
126 virtual ~DipoleFitData();
127
128 //============================= dipole_fit_setup.c =============================
129
130 static int setup_forward_model(DipoleFitData* d, MNELIB::MneCTFCompDataSet* comp_data, FWDLIB::FwdCoilSet* comp_coils);
131
132 static MNELIB::MneCovMatrix* ad_hoc_noise(FWDLIB::FwdCoilSet* meg, /* Channel name lists to define which channels are gradiometers */
134 float grad_std,
135 float mag_std,
136 float eeg_std);
137
138 //ToDo move to mneProjOp class
139 static int make_projection(const QList<QString>& projnames,
140 const QList<FIFFLIB::FiffChInfo>& chs,
141 int nch,
142 MNELIB::MneProjOp* *res);
143
144 static int scale_noise_cov(DipoleFitData* f,int nave);
145
146 static int scale_dipole_fit_noise_cov(DipoleFitData* f,int nave);
147
148 static int select_dipole_fit_noise_cov(DipoleFitData* f, mshMegEegData d);
149
150 static DipoleFitData* setup_dipole_fit_data( const QString& mriname,
151 const QString& measname,
152 const QString& bemname,
153 Eigen::Vector3f *r0,
154 FWDLIB::FwdEegSphereModel* eeg_model,
155 int accurate_coils,
156 const QString& badname,
157 const QString& noisename,
158 float grad_std,
159 float mag_std,
160 float eeg_std,
161 float mag_reg,
162 float grad_reg,
163 float eeg_reg,
164 int diagnoise,
165 const QList<QString>& projnames,
166 int include_meg,
167 int include_eeg);
168
169 //=========================================================================================================
181 static bool fit_one(DipoleFitData* fit, GuessData* guess, float time, float *B, int verbose, ECD& res);
182
183//============================= dipole_forward.c
184
185 static int compute_dipole_field(DipoleFitData* d, float *rd, int whiten, float **fwd);
186
187 //============================= dipole_forward.c
188
189 static DipoleForward* dipole_forward_one(DipoleFitData* d,
190 float *rd,
191 DipoleForward* old);
192
193public:
197 QList<FIFFLIB::FiffChInfo> chs;
198 int nmeg;
199 int neeg;
200 QStringList ch_names;
204 float r0[3];
205 QString bemname;
218 int nave;
222 void *user;
223 fitUserFreeFunc user_free;
225// ### OLD STRUCT ###
226// typedef struct { /* This structure holds all fitting-related data */
227// fiffCoordTrans mri_head_t; /* MRI <-> head coordinate transformation */
228// fiffCoordTrans meg_head_t; /* MEG <-> head coordinate transformation */
229// int coord_frame; /* Common coordinate frame */
230// fiffChInfo chs; /* Channels */
231// int nmeg; /* How many MEG */
232// int neeg; /* How many EEG */
233// char **ch_names; /* List of all channel names */
234// mneSparseMatrix pick; /* Matrix to pick data from the
235// full data set which may contain channels
236// we are not interested in */
237// fwdCoilSet meg_coils; /* MEG coil definitions */
238// fwdCoilSet eeg_els; /* EEG electrode definitions */
239// float r0[3]; /* Sphere model origin */
240// char *bemname; /* Using a BEM? */
241
242// FwdEegSphereModel *eeg_model; /* EEG sphere model definition */
243// fwdBemModel bem_model; /* BEM model definition */
244
245// dipoleFitFuncs sphere_funcs; /* These are the sphere model forward functions */
246// dipoleFitFuncs bem_funcs; /* These are the BEM forward functions */
247// dipoleFitFuncs funcs; /* Points to one of the two above */
248// dipoleFitFuncs mag_dipole_funcs; /* Functions to fit a magnetic dipole */
249
250// int fixed_noise; /* Were fixed noise values used rather than a noise-covariance
251// * matrix read from a file */
252// MneCovMatrix* noise_orig; /* Noise covariance matrix (original) */
253// MneCovMatrix* noise; /* Noise covariance matrix (weighted to take the selection into account) */
254// int nave; /* How many averages does this correspond to? */
255// mneProjOp proj; /* The projection operator to use */
256// int column_norm; /* What kind of column normalization to apply to the forward solution */
257// int fit_mag_dipoles; /* Fit magnetic dipoles? */
258// void *user; /* User data for anything we need */
259// fitUserFreeFunc user_free; /* Function to free the above */
260// } *dipoleFitData,dipoleFitDataRec;
261};
262
263//=============================================================================================================
264// INLINE DEFINITIONS
265//=============================================================================================================
266} //NAMESPACE
267
268#endif // DIPOLEFITDATA_H
Definitions for describing the objects in a FIFF file.
FwdEegSphereModel class declaration.
FwdBemModel class declaration.
DipoleForward class declaration.
#define INVERSESHARED_EXPORT
Coordinate transformation descriptor.
Data associated with MNE computations for each mneMeasDataSet.
Holds the BEM model definition.
FwdCoilSet description.
Electric Current Dipole description.
Dipole Fit Data implementation.
FWDLIB::FwdCoilSet * meg_coils
FIFFLIB::FiffSparseMatrix * pick
QSharedPointer< DipoleFitData > SPtr
QList< FIFFLIB::FiffChInfo > chs
FWDLIB::FwdBemModel * bem_model
QSharedPointer< const DipoleFitData > ConstSPtr
MNELIB::MneProjOp * proj
FIFFLIB::FiffCoordTransOld * mri_head_t
MNELIB::MneCovMatrix * noise_orig
FWDLIB::FwdEegSphereModel * eeg_model
FWDLIB::FwdCoilSet * eeg_els
MNELIB::MneCovMatrix * noise
FIFFLIB::FiffCoordTransOld * meg_head_t
DipoleForward description.
Electric Current Dipole description.
Definition ecd.h:73
GuessData description.
Definition guess_data.h:79
Covariance matrix storage.
One MNE CTF Compensation Data Set description.
One linear projection item.
Definition mne_proj_op.h:84