60#define MALLOC_5(x,t) (t *)malloc((x)*sizeof(t))
62#define FREE_5(x) if ((char *)(x) != NULL) free((char *)(x))
63#define FREE_CMATRIX_5(m) mne_free_cmatrix_5((m))
65#define ALLOC_CMATRIX_5(x,y) mne_cmatrix_5((x),(y))
71#define VEC_DOT_5(x,y) ((x)[X_5]*(y)[X_5] + (x)[Y_5]*(y)[Y_5] + (x)[Z_5]*(y)[Z_5])
72#define VEC_LEN_5(x) sqrt(VEC_DOT_5(x,x))
74#define VEC_COPY_5(to,from) {\
75 (to)[X_5] = (from)[X_5];\
76 (to)[Y_5] = (from)[Y_5];\
77 (to)[Z_5] = (from)[Z_5];\
80static void matrix_error_5(
int kind,
int nr,
int nc)
84 printf(
"Failed to allocate memory pointers for a %d x %d matrix\n",nr,nc);
86 printf(
"Failed to allocate memory for a %d x %d matrix\n",nr,nc);
88 printf(
"Allocation error for a %d x %d matrix\n",nr,nc);
89 if (
sizeof(
void *) == 4) {
90 printf(
"This is probably because you seem to be using a computer with 32-bit architecture.\n");
91 printf(
"Please consider moving to a 64-bit platform.");
93 printf(
"Cannot continue. Sorry.\n");
105 if (!m) matrix_error_5(1,nr,nc);
107 if (!whole) matrix_error_5(2,nr,nc);
122static void normalize_5(
float *rr)
130 for (k = 0; k < 3; k++)
153 for (
int k = 0; k < 3; k++) {
168 if (!p_FwdCoil.
chname.isEmpty())
170 if (!p_FwdCoil.
desc.isEmpty())
176 this->
np = p_FwdCoil.
np;
188 for (
int p = 0; p < p_FwdCoil.
np; p++) {
189 this->
w[p] = p_FwdCoil.
w[p];
213 qWarning() << ch.
ch_name <<
"is not an EEG channel. Cannot create an electrode definition.";
217 printf(
"Inappropriate coordinate transformation in fwd_create_eeg_el");
227 res->
desc =
"EEG electrode";
246 for (c = 0; c < 3; c++)
248 normalize_5(res->
cosmag[0]);
254 for (c = 0; c < 3; c++)
256 normalize_5(res->
cosmag[1]);
FiffChInfo class declaration.
void mne_free_cmatrix_5(float **m)
#define FREE_CMATRIX_5(m)
#define ALLOC_CMATRIX_5(x, y)
float ** mne_cmatrix_5(int nr, int nc)
#define VEC_COPY_5(to, from)
FwdCoil class declaration.
#define FWD_COIL_ACCURACY_NORMAL
#define FWD_COIL_ACCURACY_POINT
#define FWD_COILC_AXIAL_GRAD2
#define FWD_COILC_AXIAL_GRAD
#define FWD_COILC_UNKNOWN
#define FWD_COILC_PLANAR_GRAD
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
Forward modelling (BEM, MEG/EEG lead fields).
Coordinate transformation description.
bool is_eeg_electrode() const
bool is_planar_coil() const
bool is_axial_coil() const
static FwdCoil * create_eeg_el(const FIFFLIB::FiffChInfo &ch, const FIFFLIB::FiffCoordTrans &t=FIFFLIB::FiffCoordTrans())
bool is_magnetometer_coil() const
Eigen::MatrixX3f apply_trans(const Eigen::MatrixX3f &rr, bool do_move=true) const