MNE-CPP  0.1.9
A Framework for Electrophysiology
mne_types.h
1 #ifndef _mne_types_h
2 #define _mne_types_h
3 /*
4  * Type definitions for the MNE library
5  *
6  * Copyright 2001 - 2009
7  *
8  * Matti Hamalainen
9  * Athinoula A. Martinos Center for Biomedical Imaging
10  * Massachusetts General Hospital
11  * Charlestown, MA, USA
12  *
13  * $Id: mne_types.h 3331 2011-10-13 16:53:16Z msh $
14  *
15  * Revision 1.76 2009/03/14 12:37:30 msh
16  * Quite a bit of work for C++ compatibility
17  *
18  * Revision 1.75 2009/02/28 17:53:50 msh
19  * Added extra fields to mneWdata and mneStcData with future extensions in mind
20  *
21  * Revision 1.74 2009/02/18 02:45:40 msh
22  * Moved to the mneEventList structure, which contains comments per event
23  *
24  * Revision 1.73 2009/02/05 04:54:14 msh
25  * Added first_sample_val member to mneRawData
26  *
27  * Revision 1.72 2009/01/30 15:20:29 msh
28  * Added code to mask the contents of the digital trigger channel if appropriate
29  *
30  * Revision 1.71 2009/01/19 13:08:05 msh
31  * Initialize the MRI structure more completely
32  *
33  * Revision 1.70 2008/11/16 20:19:59 msh
34  * Added Talairach transforms
35  * Fixed bugs in MRI reading
36  *
37  * Revision 1.69 2008/09/30 11:47:01 msh
38  * Added option to load unprocessed MaxShield data
39  *
40  * Revision 1.68 2008/08/15 12:56:49 msh
41  * Added option for discrete source spaces
42  *
43  * Revision 1.67 2008/06/16 16:07:09 msh
44  * Added compatibility for the old event file format
45  *
46  * Revision 1.66 2008/05/28 10:14:05 msh
47  * Added possibility for a sparse covariance matrix
48  *
49  * Revision 1.65 2008/05/26 10:50:10 msh
50  * Changes to accommodate the preweighted lead field basis
51  *
52  * Revision 1.64 2008/03/17 18:29:31 msh
53  * Possibility to define the trigger channel with an environment variable
54  * Added mne_compare_filters routine
55  *
56  * Revision 1.63 2008/03/15 12:54:46 msh
57  * Handle FIFF_MEAS_DATE appropriately
58  * Copy MNE_PROCESSING_HISTORY to output files as needed
59  * Possibility to add new epochs to raw data epochs previously loaded
60  *
61  * Revision 1.62 2008/03/09 01:19:35 msh
62  * Added mne_raw_formatted_time routine
63  * Include first sample to number of omitted samples
64  * Read the FIFF_MEAS_DATE tag
65  *
66  * Revision 1.61 2007/04/06 19:07:58 msh
67  * Implemented a new event structure in raw data which will eventually
68  * allow for multiple event lists and comments for the events
69  *
70  * Revision 1.60 2007/03/01 04:32:19 msh
71  * Reworked the MRI data structure to be more flexible
72  *
73  * Revision 1.59 2007/02/27 17:40:14 msh
74  * Fixed empty row or column handling in mne_create_sparse_rcs and mne_create_sparse_ccs
75  * Fixed memory leak in mne_inverse_io.c
76  * Added new fields to volume source spaces
77  *
78  * Revision 1.58 2007/02/26 05:01:29 msh
79  * Added the voxel-RAS coordinate transformation to mneMRIdata
80  * Added routine to set voxels at given RAS coordinate location to given value
81  *
82  * Revision 1.57 2007/02/25 14:29:44 msh
83  * Added routines to read mgh and mgz MRI data files.
84  *
85  * Revision 1.56 2007/02/23 14:24:47 msh
86  * Made more provisions for volume source spaces.
87  *
88  * Revision 1.55 2007/02/20 20:40:40 msh
89  * Match channel names without spaces as well for compatibility with
90  * the new Neuromag channel naming scheme.
91  *
92  * Revision 1.54 2007/01/29 21:02:44 msh
93  * Added the additional prior weightings to the inverse operator structure
94  *
95  * Revision 1.53 2007/01/09 12:43:08 msh
96  * Added total area member to the mneSourceSpace structure
97  * Compute the total area in mne_add_triangle_data
98  *
99  * Revision 1.52 2006/12/08 16:36:36 msh
100  * Added source file name to layout.
101  *
102  * Revision 1.51 2006/12/05 21:27:55 msh
103  * Added the SSS stuff to raw data and the covariance matrix
104  *
105  * Revision 1.50 2006/11/16 22:46:13 msh
106  * Changed sample number in mneTrigEvent to be a signed integer.
107  *
108  * Revision 1.49 2006/10/16 13:39:17 msh
109  * Changed field names in mneMeasDataSet structure
110  *
111  */
112 #include <fiff/fiff_types.h>
113 #include <fiff/fiff_stream.h>
114 #include "mne_sss_data.h"
115 #include "mne_named_matrix.h"
116 #include "mne_deriv_set.h"
119 #include "mne_proj_item.h"
120 #include "mne_proj_op.h"
121 #include "mne_cov_matrix.h"
122 #include "mne_ctf_comp_data.h"
123 #include "mne_ctf_comp_data_set.h"
124 
125 #include <QStringList>
126 
127 //=============================================================================================================
128 // DEFINE NAMESPACE MNELIB
129 //=============================================================================================================
130 
131 namespace MNELIB
132 {
133 
134 #if defined(__cplusplus)
135 extern "C" {
136 #endif
137 
138 //namespace MNELIB {
139 // class MneSurfaceOrVolume {
140 // /*
141 // * These are the aliases
142 // */
143 // typedef MneSurfaceOrVolume MneCSourceSpace;
144 // //typedef mneSurfaceOrVolume mneSourceVolume;
145 // typedef MneSurfaceOrVolume MneCSurface;
146 // //typedef mneSurfaceOrVolume mneVolume;
147 // }
148 
149 //}
150 
152 // * Complex data
153 // */
154 //typedef struct {
155 // float re;
156 // float im;
157 //} *mneComplex,**mneComplexMatrix,mneComplexRec;
158 
159 //typedef struct {
160 // double re;
161 // double im;
162 //} *mneDoubleComplex,**mneDoubleComplexMatrix,mneDoubleComplexRec;
163 
164 typedef void (*mneUserFreeFunc)(void *); /* General purpose */
165 //typedef FIFFLIB::fiffSparseMatrix mneSparseMatrix;
166 //typedef FIFFLIB::fiffSparseMatrixRec mneSparseMatrixRec;
167 
168 //typedef struct {
169 // int vert; /* Which vertex does this apply to */
170 // int *memb_vert; /* Which vertices constitute the patch? */
171 // int nmemb; /* How many? */
172 // float area; /* Area of the patch */
173 // float ave_nn[3]; /* Average normal */
174 // float dev_nn; /* Average deviation of the patch normals from the average normal */
175 //} *mnePatchInfo,mnePatchInfoRec;
176 
177 //typedef struct { /* This is used in the patch definitions */
178 // int vert; /* Number of this vertex (to enable sorting) */
179 // int nearest; /* Nearest 'inuse' vertex */
180 // float dist; /* Distance to the nearest 'inuse' vertex */
181 // MNELIB::MnePatchInfo* patch; /* The patch information record for the patch this vertex belongs to */
182 //} *mneNearest,mneNearestRec;
183 
184 //typedef struct {
185 // int *vert; /* Triangle vertices (pointers to the itris member of the associated mneSurface) */
186 // float *r1,*r2,*r3; /* Triangle vertex locations (pointers to the rr member of the associated mneSurface) */
187 // float r12[3],r13[3]; /* Vectors along the sides */
188 // float nn[3]; /* Normal vector */
189 // float area; /* Area */
190 // float cent[3]; /* Centroid */
191 // float ex[3],ey[3]; /* Other unit vectors (used by BEM calculations) */
192 //} *mneTriangle,mneTriangleRec; /* Triangle data */
193 
194 //typedef struct {
195 // int valid; /* Is the information below valid */
196 // int width,height,depth; /* Size of the stack */
197 // float xsize,ysize,zsize; /* Increments in the three voxel directions */
198 // float x_ras[3],y_ras[3],z_ras[3]; /* Directions of the coordinate axes */
199 // float c_ras[3]; /* Center of the RAS coordinates */
200 // char *filename; /* Name of the MRI data file */
201 //} *mneVolGeom,mneVolGeomRec; /* MRI data volume geometry information like FreeSurfer keeps it */
202 
203 /*
204  * Values of the type field in the mneVolumeOrSurface structure
205  */
206 #define MNE_SOURCE_SPACE_UNKNOWN -1
207 #define MNE_SOURCE_SPACE_SURFACE 1 /* Surface-based source space */
208 #define MNE_SOURCE_SPACE_VOLUME 2 /* 3D volume source space */
209 #define MNE_SOURCE_SPACE_DISCRETE 3 /* Discrete points */
210 
211 //typedef struct { /* This defines a source space or a surface */
212 // int type; /* Is this a volume or a surface */
213 // char *subject; /* Name (id) of the subject */
214 // int id; /* Surface id */
215 // int coord_frame; /* Which coordinate system are the data in now */
216 // /*
217 // * These relate to the FreeSurfer way
218 // */
219 // mneVolGeom vol_geom; /* MRI volume geometry information as FreeSurfer likes it */
220 // void *mgh_tags; /* Tags listed in the file */
221 // /*
222 // * These are meaningful for both surfaces and volumes
223 // */
224 // int np; /* Number of vertices */
225 // float **rr; /* The vertex locations */
226 // float **nn; /* Surface normals at these points */
227 // float cm[3]; /* Center of mass */
228 
229 // int *inuse; /* Is this point in use in the source space */
230 // int *vertno; /* Vertex numbers of the used vertices in the full source space */
231 // int nuse; /* Number of points in use */
232 
233 // int **neighbor_vert; /* Vertices neighboring each vertex */
234 // int *nneighbor_vert; /* Number of vertices neighboring each vertex */
235 // float **vert_dist; /* Distances between neigboring vertices */
236 // /*
237 // * These are for surfaces only
238 // */
239 // int ntri; /* Number of triangles */
240 // mneTriangle tris; /* The triangulation information */
241 // int **itris; /* The vertex numbers */
242 // float tot_area; /* Total area of the surface, computed from the triangles */
243 
244 // int nuse_tri; /* The triangulation corresponding to the vertices in use */
245 // mneTriangle use_tris; /* The triangulation information for the vertices in use */
246 // int **use_itris; /* The vertex numbers for the 'use' triangulation */
247 
248 // int **neighbor_tri; /* Neighboring triangles for each vertex
249 // * Note: number of entries varies for vertex to vertex */
250 // int *nneighbor_tri; /* Number of neighboring triangles for each vertex */
251 
252 // mneNearest nearest; /* Nearest inuse vertex info (number of these is the same as the number vertices) */
253 // mnePatchInfo *patches; /* Patch information (number of these is the same as the number of points in use) */
254 // int npatch; /* How many (should be same as nuse) */
255 
256 // mneSparseMatrix dist; /* Distances between the (used) vertices (along the surface). */
257 // float dist_limit; /* Distances above this (in volume) have not been calculated.
258 // * If negative, only used vertices have been considered */
259 
260 // float *curv; /* The FreeSurfer curvature values */
261 // float *val; /* Some other values associated with the vertices */
262 // /*
263 // * These are for volumes only
264 // */
265 // MNELIB::FiffCoordTransOld* voxel_surf_RAS_t;/* Transform from voxel coordinate to the surface RAS (MRI) coordinates */
266 // int vol_dims[3]; /* Dimensions of the volume grid (width x height x depth)
267 // * NOTE: This will be present only if the source space is a complete
268 // * rectangular grid with unused vertices included */
269 // float voxel_size[3]; /* Derived from the above */
270 // mneSparseMatrix interpolator; /* Matrix to interpolate into an MRI volume */
271 // char *MRI_volume; /* The name of the file the above interpolator is based on */
272 // MNELIB::FiffCoordTransOld* MRI_voxel_surf_RAS_t;
273 // MNELIB::FiffCoordTransOld* MRI_surf_RAS_RAS_t; /* Transform from surface RAS to RAS coordinates in the associated MRI volume */
274 // int MRI_vol_dims[3]; /* Dimensions of the MRI volume (width x height x depth) */
275 // /*
276 // * Possibility to add user-defined data
277 // */
278 // void *user_data; /* Anything else we want */
279 // mneUserFreeFunc user_data_free; /* Function to set the above free */
280 //} *mneSurfaceOrVolume,mneSurfaceOrVolumeRec;
282 // * These are the aliases
283 // */
284 //typedef mneSurfaceOrVolume mneSourceSpace;
286 //typedef mneSurfaceOrVolume mneSurface;
288 
289 //typedef mneSurfaceOrVolumeRec mneSourceSpaceRec;
291 //typedef mneSurfaceOrVolumeRec mneSurfaceRec;
293 
294 //typedef struct { /* FreeSurfer patches */
295 // mneSurface s; /* Patch represented as a surface */
296 // int *vert; /* Vertex numbers in the complete surface*/
297 // int *surf_vert; /* Which vertex corresponds to each complete surface vertex here? */
298 // int np_surf; /* How many points on the complete surface? */
299 // int *tri; /* Which triangles in the complete surface correspond to our triangles? */
300 // int *surf_tri; /* Which of our triangles corresponds to each triangle on the complete surface? */
301 // int ntri_surf; /* How many triangles on the complete surface */
302 // int *border; /* Is this vertex on the border? */
303 // int flat; /* Is this a flat patch? */
304 // void *user_data; /* Anything else we want */
305 // mneUserFreeFunc user_data_free; /* Function to set the above free */
306 //} *mneSurfacePatch,mneSurfacePatchRec;
307 
308 //typedef struct { /* Matrix specification with a channel list */
309 // int nrow; /* Number of rows */
310 // int ncol; /* Number of columns */
311 // char **rowlist; /* Name list for the rows (may be NULL) */
312 // char **collist; /* Name list for the columns (may be NULL) */
313 // float **data; /* The data itself (dense) */
314 //} *mneNamedMatrix,mneNamedMatrixRec;
315 
316 typedef struct { /* Matrix specification with a channel list */
317  int nrow; /* Number of rows (same as in data) */
318  int ncol; /* Number of columns (same as in data) */
319  QStringList rowlist; /* Name list for the rows (may be NULL) */
320  QStringList collist; /* Name list for the columns (may be NULL) */
321  FIFFLIB::FiffSparseMatrix* data; /* The data itself (sparse) */
323 
324 typedef struct { /* Vector specification with a channel list */
325  int nvec; /* Number of elements */
326  QStringList names; /* Name list for the elements */
327  float* data; /* The data itself */
329 
330 //typedef struct { /* One linear projection item */
331 // MNELIB::MneNamedMatrix* vecs; /* The original projection vectors */
332 // int nvec; /* Number of vectors = vecs->nrow */
333 // char *desc; /* Projection item description */
334 // int kind; /* Projection item kind */
335 // int active; /* Is this item active now? */
336 // int active_file; /* Was this item active when loaded from file? */
337 // int has_meg; /* Does it have MEG channels? */
338 // int has_eeg; /* Does it have EEG channels? */
339 //} *mneProjItem,mneProjItemRec;
340 
341 //typedef struct { /* Collection of projection items and the projector itself */
342 // QList<MNELIB::MneProjItem*> items; /* The projection items */
343 // int nitems; /* Number of items */
344 // char **names; /* Names of the channels in the final projector */
345 // int nch; /* Number of channels in the final projector */
346 // int nvec; /* Number of vectors in the final projector */
347 // float **proj_data; /* The orthogonalized projection vectors picked and orthogonalized from the original data */
348 //} *mneProjOp,mneProjOpRec;
349 
350 //typedef struct {
351 // int job; /* Value of FIFF_SSS_JOB tag */
352 // int coord_frame; /* Coordinate frame */
353 // float origin[3]; /* The expansion origin */
354 // int nchan; /* How many channels */
355 // int out_order; /* Order of the outside expansion */
356 // int in_order; /* Order of the inside expansion */
357 // int *comp_info; /* Which components are included */
358 // int ncomp; /* How many entries in the above */
359 // int in_nuse; /* How many components included in the inside expansion */
360 // int out_nuse; /* How many components included in the outside expansion */
361 //} *mneSssData,mneSssDataRec; /* Essential information about SSS */
362 
363 /*
364  * The class field in MNELIB::MneCovMatrix* can have these values
365  */
366 //#define MNE_COV_CH_UNKNOWN -1 /* No idea */
367 //#define MNE_COV_CH_MEG_MAG 0 /* Axial gradiometer or magnetometer [T] */
368 //#define MNE_COV_CH_MEG_GRAD 1 /* Planar gradiometer [T/m] */
369 //#define MNE_COV_CH_EEG 2 /* EEG [V] */
370 
371 //typedef struct { /* Covariance matrix storage */
372 // int kind; /* Sensor or source covariance */
373 // int ncov; /* Dimension */
374 // int nfree; /* Number of degrees of freedom */
375 // int nproj; /* Number of dimensions projected out */
376 // int nzero; /* Number of zero or small eigenvalues */
377 // char **names; /* Names of the entries (optional) */
378 // double *cov; /* Covariance matrix in packed representation (lower triangle) */
379 // double *cov_diag; /* Diagonal covariance matrix */
380 // MNELIB::FiffSparseMatrix* cov_sparse; /* A sparse covariance matrix (Note: data are floats in this which is an inconsistency) */
381 // double *lambda; /* Eigenvalues of cov */
382 // double *inv_lambda; /* Inverses of the square roots of the eigenvalues of cov */
383 // float **eigen; /* Eigenvectors of cov */
384 // double *chol; /* Cholesky decomposition */
385 // MNELIB::MneProjOp* proj; /* The projection which was active when this matrix was computed */
386 // MNELIB::MneSssData* sss; /* The SSS data present in the associated raw data file */
387 // int *ch_class; /* This will allow grouping of channels for regularization (MEG [T/m], MEG [T], EEG [V] */
388 // char **bads; /* Which channels were designated bad when this noise covariance matrix was computed? */
389 // int nbad; /* How many of them */
390 //} *MNELIB::MneCovMatrix*,MNELIB::MneCovMatrix*Rec;
391 
392 //typedef struct { /* A forward solution */
393 // char *fwdname; /* Name of the file this was loaded from */
394 // fiffId meas_id; /* The assosiated measurement ID */
395 // mneSourceSpace *spaces; /* The source spaces */
396 // int nspace; /* Number of source spaces */
397 // fiffCoordTrans mri_head_t; /* MRI <-> head coordinate transformation */
398 // fiffCoordTrans meg_head_t; /* MEG <-> head coordinate transformation */
399 // int methods; /* EEG, MEG or EEG+MEG (see mne_fiff.h) */
400 // int coord_frame; /* The coordinate frame employed in the forward calculations */
401 // int source_ori; /* Fixed or free source orientations */
402 // float **rr_source; /* The active source points */
403 // float **nn_source; /* The source orientations
404 // * (These are equal to the cortex normals
405 // * in the fixed orientation case) */
406 // int nsource; /* Number of source (recalculated for convenience) */
407 // fiffChInfo chs; /* The channel list */
408 // int nch; /* Number of channels */
409 // mneNamedMatrix fwd; /* The forward solution (may be whitened) */
410 // mneNamedMatrix fwd_proc; /* This is an alternate matrix for a processed forward matrix (linear projection
411 // * and whitening) As a rule, this field is not used but rater the operations are
412 // * applied to the field fwd itself */
413 // float *patch_areas; /* Contains the patch areas if the CSD transformation has been applied */
414 // int fwd_whitened; /* Has the noise covariance been applied to the field fwd? */
415 // MNELIB::MneCovMatrix* noise_cov; /* The noise covariance matrix employed in whitening */
416 // mneProjOp proj; /* Associated projection operator */
417 //} *mneForwardSolution,mneForwardSolutionRec;
418 
419 //typedef struct { /* An inverse operator */
420 // FIFFLIB::fiffId meas_id; /* The assosiated measurement ID */
421 // MNELIB::MneSurfaceOrVolume::MneCSourceSpace* *spaces; /* The source spaces */
422 // int nspace; /* Number of source spaces */
423 // MNELIB::FiffCoordTransOld* meg_head_t; /* MEG device <-> head coordinate transformation */
424 // MNELIB::FiffCoordTransOld* mri_head_t; /* MRI device <-> head coordinate transformation */
425 // int methods; /* EEG, MEG or EEG+MEG (see mne_fiff.h) */
426 // int nchan; /* Number of measurement channels */
427 // int nsource; /* Number of source points */
428 // int fixed_ori; /* Fixed source orientations? */
429 // float **rr_source; /* The active source points */
430 // float **nn_source; /* The source orientations
431 // * (These are equal to the cortex normals
432 // * in the fixed orientation case) */
433 // int coord_frame; /* Which coordinates are the locations and orientations given in? */
434 // MNELIB::MneCovMatrix* sensor_cov; /* Sensor covariance matrix */
435 // int nave; /* Number of averaged responses (affects scaling of the noise covariance) */
436 // int current_unit; /* This can be FIFF_UNIT_AM, FIFF_UNIT_AM_M2, FIFF_UNIT_AM_M3 */
437 // MNELIB::MneCovMatrix* source_cov; /* Source covariance matrix */
438 // MNELIB::MneCovMatrix* orient_prior; /* Orientation prior applied */
439 // MNELIB::MneCovMatrix* depth_prior; /* Depth-weighting prior applied */
440 // MNELIB::MneCovMatrix* fMRI_prior; /* fMRI prior applied */
441 // float *sing; /* Singular values of the inverse operator */
442 // MNELIB::MneNamedMatrix* eigen_leads; /* The eigen leadfields */
443 // int eigen_leads_weighted; /* Have the above been already weighted with R^0.5? */
444 // MNELIB::MneNamedMatrix* eigen_fields; /* Associated field patterns */
445 // float trace_ratio; /* tr(GRG^T)/tr(C) */
446 // MNELIB::MneProjOp* proj; /* The associated projection operator */
447 //} *mneInverseOperator,mneInverseOperatorRec;
448 
449 //typedef struct { /* For storing the wdata */
450 // int id; /* Surface id these data belong to */
451 // int kind; /* What kind of data */
452 // float lat; /* Latency */
453 // int nvert; /* Number of vertices */
454 // int *vertno; /* Vertex numbers */
455 // float *vals; /* The values */
456 //} *mneWdata,mneWdataRec;
457 
458 //typedef struct {
459 // int id; /* Surface id these data belong to */
460 // int kind; /* What kind of data */
461 // float tmin; /* First time */
462 // float tstep; /* Step between times */
463 // int ntime; /* Number of times */
464 // int nvert; /* Number of vertices */
465 // int *vertno; /* The vertex numbers */
466 // float **data; /* The data, time by time */
467 //} *mneStcData,mneStcDataRec;
468 
469 //typedef struct { /* Information about raw data in fiff file */
470 // char *filename; /* The name of the file this comes from */
471 // FIFFLIB::fiffId id; /* Measurement id from the file */
472 // int nchan; /* Number of channels */
473 // QList<FIFFLIB::FiffChInfo> chInfo; /* Channel info data */
474 // int coord_frame; /*
475 // * Which coordinate frame are the
476 // * positions defined in?
477 // */
478 // FIFFLIB::FiffCoordTransOld* trans; /* This is the coordinate transformation
479 // * FIFF_COORD_HEAD <--> FIFF_COORD_DEVICE
480 // */
481 // float sfreq; /* Sampling frequency */
482 // float lowpass; /* Lowpass filter setting */
483 // float highpass; /* Highpass filter setting */
484 // FIFFLIB::fiffTimeRec start_time; /* Starting time of the acquisition
485 // * taken from the meas date
486 // * or the meas block id
487 // * whence it may be inaccurate. */
488 // int buf_size; /**< Buffer size in samples. */
489 // int maxshield_data; /**< Are these unprocessed MaxShield data. */
490 // QList<FIFFLIB::FiffDirEntry::SPtr> rawDir; /**< Directory of raw data tags
491 // * These may be of type
492 // * FIFF_DATA_BUFFER
493 // * FIFF_DATA_SKIP
494 // * FIFF_DATA_SKIP_SAMP
495 // * FIFF_NOP
496 // */
497 // int ndir; /* Number of tags in the above
498 // * directory */
499 //} mneRawInfoRec, *mneRawInfo;
500 
501 //typedef struct { /* Spatiotemporal map */
502 // int kind; /* What kind of data */
503 // int coord_frame; /* Coordinate frame for vector values */
504 // int nvert; /* Number of vertex values */
505 // int ntime; /* Number of time points */
506 // int nval_vert; /* Number of values per vertex */
507 // float tmin; /* First time point */
508 // float tstep; /* Step between the time points */
509 // int *vertno; /* Vertex numbers in the full triangulation (starting with zero) */
510 // float **data; /* The data values (time by time) */
511 //} mneMapRec, *mneMap;
512 
513 typedef struct { /* Plotter layout port definition */
514  int portno; /* Running number of this viewport */
515  int invert; /* Invert the signal coming to this port */
516  float xmin,xmax,ymin,ymax; /* Limits */
517  char *names; /* Channels to go into this port (one line, separated by colons) */
518  int match; /* Does this port match with our present channel? */
520 
521 typedef struct { /* Plotter layout */
522  char *name; /* File where this came from */
523  float xmin,xmax,ymin,ymax; /* The VDC limits */
524  float cxmin,cxmax,cymin,cymax; /* The confined VDC limits */
525  int nport; /* Number of viewports */
526  mneLayoutPort ports; /* Array of viewports */
527  int **match; /* Matching matrix */
528  int nmatch; /* How many channels in matching matrix */
530 
531 /*
532  * The following relate to high-level handling of raw data
533  */
534 #define MNE_CH_SELECTION_UNKNOWN 0
535 #define MNE_CH_SELECTION_FILE 1
536 #define MNE_CH_SELECTION_USER 2
537 
538 typedef struct {
539  QString name; /* Name of this selection */
540  QStringList chdef; /* Channel definitions (may contain regular expressions) */
541  int ndef; /* How many of them */
542  QStringList chspick; /* Translated into channel names using the present data */
543  QStringList chspick_nospace; /* The same without spaces */
544  int *pick; /* These are the corresponding channels in the raw data
545  (< 0 indicates missing) */
546  int *pick_deriv; /* These are the corresponding derivations in the raw data */
547  int nderiv; /* How many derivations in the above */
548  int *ch_kind; /* Kinds of the channels corresponding to picks (< 0 indicates missing) */
549  int nchan; /* How many picked channels? */
550  int kind; /* Loaded from file or created here? */
552 
553 //typedef struct {
554 // char *name; /* Name of this set */
555 // mneChSelection *sels; /* These are the selections */
556 // int nsel; /* How many */
557 // int current; /* Which is active now? */
558 //} *mneChSelectionSet, mneChSelectionSetRec;
559 
560 typedef struct {
561  unsigned int from; /* Source transition value */
562  unsigned int to; /* Destination transition value */
563  int sample; /* Sample number */
564  int show; /* Can be used as desired */
565  int created_here; /* Was this event created in the program */
566  char *comment; /* Event comment */
568 
569 typedef struct { /* List of the above. */
570  mneEvent *events;
571  int nevent;
573 
574 #ifndef MNEFILTERDEF
575 #define MNEFILTERDEF
576 typedef struct {
577  bool filter_on; /* Is it on? */
578  int size; /* Length in samples (must be a power of 2) */
579  int taper_size; /* How long a taper in the beginning and end */
580  float highpass; /* Highpass in Hz */
581  float highpass_width; /* Highpass transition width in Hz */
582  float lowpass; /* Lowpass in Hz */
583  float lowpass_width; /* Lowpass transition width in Hz */
584  float eog_highpass; /* EOG highpass in Hz */
585  float eog_highpass_width; /* EOG highpass transition width in Hz */
586  float eog_lowpass; /* EOG lowpass in Hz */
587  float eog_lowpass_width; /* EOG lowpass transition width in Hz */
589 #endif
590 
591 //typedef struct {
592 // FIFFLIB::FiffDirEntry::SPtr ent; /* Where is this in the file (file bufs only, pointer to info) */
593 // int firsts,lasts; /* First and last sample */
594 // int ntaper; /* For filtered buffers: taper length */
595 // int ns; /* Number of samples (last - first + 1) */
596 // int nchan; /* Number of channels */
597 // int is_skip; /* Is this a skip? */
598 // float **vals; /* Values (null if not in memory) */
599 // int valid; /* Are the data meaningful? */
600 // int *ch_filtered; /* For filtered buffers: has this channel filtered already */
601 // int comp_status; /* For raw buffers: compensation status */
602 //} *mneRawBufDef,mneRawBufDefRec;
603 
604 /*
605  * CTF compensation stuff
606  */
607 #define MNE_CTFV_NOGRAD 0
608 #define MNE_CTFV_GRAD1 1
609 #define MNE_CTFV_GRAD2 2
610 #define MNE_CTFV_GRAD3 3
611 /*
612  * 4D compensation stuff
613  */
614 #define MNE_4DV_COMP1 101
615 
616 //typedef struct {
617 // int kind; /* The compensation kind (CTF) */
618 // int mne_kind; /* Our kind */
619 // int calibrated; /* Are the coefficients in the file calibrated already? */
620 // MNELIB::MneNamedMatrix* data; /* The compensation data */
621 // MNELIB::FiffSparseMatrix* presel; /* Apply this selector prior to compensation */
622 // MNELIB::FiffSparseMatrix* postsel; /* Apply this selector after compensation */
623 // float *presel_data; /* These are used for the intermediate results in the calculations */
624 // float *comp_data;
625 // float *postsel_data;
626 //} *mneCTFcompData,mneCTFcompDataRec;
627 
628 //typedef struct {
629 // QList<MNELIB::MneCTFCompData*> comps; /* All available compensation data sets */
630 // int ncomp; /* How many? */
631 // FIFFLIB::fiffChInfo chs; /* Channel information */
632 // int nch; /* How many of the above */
633 // MNELIB::MneCTFCompData* undo; /* Compensation data to undo the current compensation before applying current */
634 // MNELIB::MneCTFCompData* current; /* The current compensation data composed from the above taking into account channels presently available */
635 //} *mneCTFcompDataSet,mneCTFcompDataSetRec;
636 
637 //typedef struct { /* One item in a derivation data set */
638 // char *filename; /* Source file name */
639 // char *shortname; /* Short nickname for this derivation */
640 // mneSparseNamedMatrix deriv_data; /* The derivation data itself */
641 // int *in_use; /* How many non-zero elements on each column of the derivation data
642 // * (This field is not always used) */
643 // int *valid; /* Which of the derivations are valid considering the units of the input
644 // * channels (This field is not always used) */
645 // FIFFLIB::fiffChInfo chs; /* First matching channel info in each derivation */
646 //} *mneDeriv,mneDerivRec;
647 
648 //typedef struct { /* A collection of derivations */
649 // int nderiv; /* How many? */
650 // mneDeriv *derivs; /* Pointers to the items */
651 //} *mneDerivSet,mneDerivSetRec;
652 
653 //typedef struct { /* A comprehensive raw data structure */
654 // char *filename; /* This is our file */
656 // FIFFLIB::FiffStream::SPtr stream;
657 // mneRawInfo info; /* Loaded using the mne routines */
658 // char **ch_names; /* Useful to have the channel names as a single list */
659 // char **badlist; /* Bad channel names */
660 // int nbad; /* How many? */
661 // int *bad; /* Which channels are bad? */
662 // mneRawBufDef bufs; /* These are the data */
663 // int nbuf; /* How many? */
664 // mneRawBufDef filt_bufs; /* These are the filtered ones */
665 // int nfilt_buf;
666 // int first_samp; /* First sample? */
667 // int omit_samp; /* How many samples of skip omitted in the beginning */
668 // int first_samp_old; /* This is the value first_samp would have in the old versions */
669 // int omit_samp_old; /* This is the value omit_samp would have in the old versions */
670 // int nsamp; /* How many samples in total? */
671 // float *first_sample_val; /* Values at the first sample (for dc offset correction before filtering) */
672 // MNELIB::MneProjOp* proj; /* Projection operator */
673 // MNELIB::MneSssData* sss; /* SSS data found in this file */
674 // MNELIB::MneCTFCompDataSet* comp; /* Compensation data */
675 // int comp_file; /* Compensation status of these raw data in file */
676 // int comp_now; /* Compensation status of these raw data in file */
677 // mneFilterDef filter; /* Filter definition */
678 // void *filter_data; /* This can be whatever the filter needs */
679 // mneUserFreeFunc filter_data_free; /* Function to free the above */
680 // mneEventList event_list; /* Trigger events */
681 // unsigned int max_event; /* Maximum event number in usenest */
682 // char *dig_trigger; /* Name of the digital trigger channel */
683 // unsigned int dig_trigger_mask; /* Mask applied to digital trigger channel before considering it */
684 // float *offsets; /* Dc offset corrections for display */
685 // void *ring; /* The ringbuffer (structure is of no
686 // * interest to us) */
687 // void *filt_ring; /* Separate ring buffer for filtered data */
688 // MNELIB::MneDerivSet* deriv; /* Derivation data */
689 // MNELIB::MneDeriv* deriv_matched; /* Derivation data matched to this raw data and
690 // * collected into a single item */
691 // float *deriv_offsets; /* Dc offset corrections for display of the derived channels */
692 // void *user; /* Whatever */
693 // mneUserFreeFunc user_free; /* How this is freed */
694 //} *mneRawData,mneRawDataRec;
695 
696 //typedef struct { /* Data associated with MNE computations for each mneMeasDataSet */
697 // float **datap; /* Projection of the whitened data onto the field eigenvectors */
698 // float **predicted; /* The predicted data */
699 // float *SNR; /* Estimated power SNR as a function of time */
700 // float *lambda2_est; /* Regularization parameter estimated from available data */
701 // float *lambda2; /* Regularization parameter to be used (as a function of time) */
702 //} *mneMneData,mneMneDataRec;
703 
704 //typedef struct { /* One data set, used in mneMeasData */
705 // /*
706 // * These are unique to each data set
707 // */
708 // char *comment; /* Comment associated with these data */
709 // float **data; /* The measured data */
710 // float **data_proj; /* Some programs maybe interested in keeping the data after SSP separately */
711 // float **data_filt; /* Some programs maybe interested in putting a filtered version here */
712 // float **data_white; /* The whitened data */
713 // float *stim14; /* Data from the digital stimulus channel */
714 // int first; /* First sample index for raw data processing */
715 // int np; /* Number of times */
716 // int nave; /* Number of averaged responses */
717 // int kind; /* Which aspect of data */
718 // float tmin; /* Starting time */
719 // float tstep; /* Time step */
720 // float *baselines; /* Baseline values currently applied to the data */
721 // MNELIB::MneMneData* mne; /* These are the data associated with MNE computations */
722 // void *user_data; /* Anything else we want */
723 // mneUserFreeFunc user_data_free;/* Function to set the above free */
724 //} *mneMeasDataSet,mneMeasDataSetRec;
725 
726 //typedef struct { /* Measurement data representation in MNE calculations */
727 // /*
728 // * These are common to all data sets
729 // */
730 // char *filename; /* The source file name */
731 // FIFFLIB::fiffId meas_id; /* The id from the measurement file */
732 // FIFFLIB::fiffTimeRec meas_date; /* The measurement date from the file */
733 // FIFFLIB::fiffChInfo chs; /* The channel information */
734 // MNELIB::FiffCoordTransOld* meg_head_t; /* MEG device <-> head coordinate transformation */
735 // MNELIB::FiffCoordTransOld* mri_head_t; /* MRI device <-> head coordinate transformation
736 // (duplicated from the inverse operator or loaded separately) */
737 // float sfreq; /* Sampling frequency */
738 // int nchan; /* Number of channels */
739 // float highpass; /* Highpass filter setting */
740 // float lowpass; /* Lowpass filter setting */
741 // mneProjOp proj; /* Associated projection operator (useful if inverse operator is not included) */
742 // mneCTFcompDataSet comp; /* The software gradient compensation data */
743 // mneInverseOperator op; /* Associated inverse operator */
744 // mneNamedMatrix fwd; /* Forward operator for dipole fitting */
745 // mneRawData raw; /* This will be non-null if the data stems from a raw data file */
746 // mneChSelection chsel; /* Channel selection for raw data */
747 // char **badlist; /* Bad channel names */
748 // int nbad; /* How many? */
749 // int *bad; /* Which channels are bad? */
750 // /*
751 // * These are the data sets loaded
752 // */
753 // int ch_major; /* Rows are channels rather than times */
754 // MNELIB::MneMeasDataSet* *sets; /* All loaded data sets */
755 // int nset; /* How many */
756 // MNELIB::MneMeasDataSet* current; /* Which is the current one */
757 //} *mneMeasData,mneMeasDataRec;
758 
759 //typedef struct { /* Identifier for the automatic parcellation */
760 // char *name; /* Name of this area */
761 // int index; /* Index in the parcellation */
762 // int flag; /* Flag read from the color table (whatever it means) */
763 // float r,g,b,alpha; /* The color values */
764 // int *vert; /* The vertices belonging to this one */
765 // int nvert;
766 //} *mneParc,mneParcRec;
767 
768 //typedef struct { /* A set of the above */
769 // int *vert; /* The assignment of each vertex */
770 // int nvert; /* How many */
771 // mneParc *parcs; /* The 'parcels' */
772 // int nparc;
773 //} *mneParcSet,mneParcSetRec;
774 
775 //typedef struct {
776 // mneParcSet lh_parc;
777 // mneParcSet rh_parc;
778 //} *mneParcData,mneParcDataRec; /* This is the complete parcellation data */
779 
781 // * The following are included for reading and writing MRI data in the mgh and mgz formats
782 // */
783 //#define MNE_MRI_VERSION 1
784 //#define MNE_MRI_UCHAR 0
785 //#define MNE_MRI_INT 1
786 //#define MNE_MRI_LONG 2
787 //#define MNE_MRI_FLOAT 3
788 //#define MNE_MRI_SHORT 4
789 //#define MNE_MRI_BITMAP 5
790 //#define MNE_MRI_TENSOR 6
791 
792 //#define MNE_MRI_ALL_FRAMES -1 /* Load all frames */
793 //#define MNE_MRI_NO_FRAMES -2 /* Do not load data at all */
794 
795 //typedef union {
796 // unsigned char uval;
797 // short sval;
798 // int ival;
799 // float fval;
800 //} mneMRIvoxelVal;
801 
802 //typedef union {
803 // unsigned char ***uslices; /* Different types of voxels */
804 // short ***sslices;
805 // int ***islices;
806 // float ***fslices;
807 //} mneMRIvoxels;
808 
809 //typedef struct {
810 // int type; /* Data type duplicated from mneMRIdata */
811 // int width; /* Size of the stack duplicated from mneMRIdata*/
812 // int height;
813 // int depth;
814 // void *data; /* These are the actual voxels stored sequentially */
815 // int nbytes; /* How many bytes in data (just a convenience) */
816 // mneMRIvoxels voxels; /* Different types of voxels */
817 // int frame; /* Which frame is this in the original data */
818 // void *user_data; /* Anything else we want */
819 // mneUserFreeFunc user_data_free; /* Function to set the above free */
820 //} *mneMRIvolume,mneMRIvolumeRec; /* One volume of data */
821 
822 //typedef struct {
823 // char *filename; /* Name of the source file */
824 // int version; /* Version number of the data file */
825 // int width; /* Size of the stack */
826 // int height;
827 // int depth;
828 // int nframes; /* Number of frames in the original */
829 // int dof;
830 // int ras_good; /* Indicates that the values below are good */
831 // float xsize,ysize,zsize; /* Increments in the three voxel directions */
832 // float x_ras[3],y_ras[3],z_ras[3]; /* these are the RAS distances across the whole volume */
833 // float c_ras[3]; /* Center of the RAS coordinates
834 // * This is irrelevant to the MNE software because we work in
835 // * surface RAS coordinates */
836 // fiffCoordTrans voxel_surf_RAS_t; /* Transform from voxel coordinate to the surface RAS (MRI) coordinates */
837 // fiffCoordTrans surf_RAS_RAS_t; /* Transform from surface RAS to RAS (nonzero origin) coordinates */
838 // fiffCoordTrans head_surf_RAS_t; /* Transform from MEG head coordinates to surface RAS */
839 // fiffCoordTrans RAS_MNI_tal_t; /* Transform from RAS (nonzero origin) to MNI Talairach coordinates */
840 // fiffCoordTrans MNI_tal_tal_gtz_t; /* Transform MNI Talairach to FreeSurfer Talairach coordinates (z > 0) */
841 // fiffCoordTrans MNI_tal_tal_ltz_t; /* Transform MNI Talairach to FreeSurfer Talairach coordinates (z < 0) */
842 // int type; /* Data type for voxels */
843 // mneMRIvolume *volumes; /* The volumes loaded */
844 // int nvol; /* How many loaded volumes */
845 // int current_vol; /* Which volume is the current destination for modifications */
846 // float TR; /* Recovery time */
847 // float TE; /* Echo time time */
848 // float TI; /* Inversion time */
849 // float flip_angle; /* Flip angle */
850 // float fov; /* Field of view */
851 // void *tags; /* The format of the tag information is kept private */
852 // void *user_data; /* Anything else we want */
853 // mneUserFreeFunc user_data_free; /* Function to set the above free */
854 //} *mneMRIdata,mneMRIdataRec; /* MRI data description suitable for handling mgh and mgz data files */
855 
857 // * Wavelet transform structures
858 // */
859 //typedef struct {
860 // float sfreq; /* The sampling frequency */
861 // int nfreq; /* How many frequencies */
862 // float **W; /* The corresponding wavelets */
863 // float **W_power; /* Power spectra of the above */
864 // int *np; /* Number of points in each */
865 // float *freqs; /* The corresponding frequencies */
866 // float **W_fft; /* Fourier transforms of the wavelets for convolution */
867 // int *np_fft; /* Number of points in each the above */
868 // /*
869 // * Possibility to add user-defined data
870 // */
871 // void *user_data; /* Anything else we want */
872 // mneUserFreeFunc user_data_free; /* Function to set the above free */
873 //} *mneWaveletSet,mneWaveletSetRec;
874 
875 //typedef struct { /* Used to store the wavelet transform */
876 // int type; /* What is stored here? */
877 // int nchan; /* Number of channels */
878 // int nsamp; /* Number of time samples */
879 // float sfreq; /* Sampling frequency */
880 // float *freqs; /* Wavelet frequencies */
881 // int nfreq; /* Number of frequencies */
882 // float tmin; /* Time scale minimum */
883 // float ***trans; /* The transforms */
884 //} *mneWaveletTransform,mneWaveletTransformRec;
885 
886 //#define MNE_WAVELET_COMPLEX 1
887 //#define MNE_WAVELET_POWER 2
888 
889 /*
890  * Environment variables and others
891  */
892 #define MNE_DEFAULT_TRIGGER_CH "STI 014"
893 #define MNE_ENV_TRIGGER_CH "MNE_TRIGGER_CH_NAME"
894 //#define MNE_ENV_TRIGGER_CH_MASK "MNE_TRIGGER_CH_MASK"
895 #define MNE_ENV_ROOT "MNE_ROOT"
896 
897 #if defined(__cplusplus)
898 }
899 #endif
900 
901 } // Namespace
902 
903 #endif
MNELIB::mneLayoutRec
Definition: mne_types.h:521
MNELIB::mneSparseNamedMatrix
Definition: mne_types.h:316
MNELIB::mneFilterDef
Definition: mne_types.h:576
mne_ctf_comp_data.h
MneCTFCompData class declaration.
fiff_sparse_matrix.h
FiffSparseMatrix class declaration.
FIFFLIB::FiffSparseMatrix
Data associated with MNE computations for each mneMeasDataSet.
Definition: fiff_sparse_matrix.h:74
mne_cov_matrix.h
MneCovMatrix class declaration.
mne_sss_data.h
MNE SSS Data (MneSssData) class declaration.
MNELIB::mneLayoutPortRec
Definition: mne_types.h:513
fiff_stream.h
FiffStream class declaration.
mne_deriv_set.h
MNE Derivation Set (MneDerivSet) class declaration.
MNELIB::mneChSelection
Definition: mne_types.h:538
MNELIB::mneEventList
Definition: mne_types.h:569
mne_proj_op.h
MNEProjOp class declaration.
mne_named_matrix.h
MNE Named Matrix (MneNamedMatrix) class declaration.
fiff_types.h
Definitions for describing the objects in a FIFF file.
mne_proj_item.h
MNEProjItem class declaration.
MNELIB::mneNamedVector
Definition: mne_types.h:324
fiff_coord_trans_old.h
FiffCoordTransOld class declaration.
mne_ctf_comp_data_set.h
MneCTFCompDataSet class declaration.
MNELIB::mneEvent
Definition: mne_types.h:560