MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
fiff_types_mne-c.h
1/*
2 * Copyright (c) 2001-2008 Elekta Neuromag Oy
3 *
4 * No part of this program may be photocopied, reproduced,
5 * or translated to another program language without the
6 * prior written consent of the author.
7 *
8 *
9 * $Id: fiff_types.h 2696 2009-05-23 18:47:52Z msh $
10 *
11 * Revision 1.17 2008/04/15 10:59:42 mjk
12 * Defines to compile on Apple.
13 *
14 * Revision 1.16 2008/01/25 08:25:05 jne
15 * added FIFFV_COIL_CTF_GRAD
16 *
17 * Revision 1.15 2007/02/28 08:25:01 jne
18 * Some cleaning of comments
19 *
20 * Revision 1.14 2007/01/09 12:41:40 jne
21 * new structs fiffEventBitsRec, fiffHpiCoilRec, fiffHpiSubsysRec
22 * new defs FIFFV_XFIT_MAP_SURF_SENSORS, FIFFV_XFIT_MAP_SURF_HEAD, FIFFV_XFIT_MAP_SURF_SPHERE
23 *
24 * Revision 1.13 2006/05/22 11:24:24 11:24:24 jne (Jukka Nenonen)
25 * Added fiffSparseMatrixRec (equivalence fiff_sparse_matrix_t)
26 * Added FIFFV_QUAT_CH0...7, FIFFV_ESTIM_ERROR_CH, FIFFV_HEAD_MOVEMENT_CH
27 *
28 * Revision 1.12 2005/11/03 14:27:40 skesti
29 * Renumbered candela
30 *
31 * Revision 1.11 2005/07/01 09:11:03 09:11:03 skesti (Sami Kesti)
32 * Check in mjk changes
33 *
34 * Revision 1.10 2004/05/18 11:52:42 mjk
35 * Added some Doxygen tags.
36 *
37 * Revision 1.9 2003/10/23 08:38:05 mjk
38 * Fixed headers to work on Lynxos.
39 *
40 * Revision 1.8 2003/06/27 14:52:29 mjk
41 * Fixed header problem in linux.
42 *
43 * Revision 1.7 2003/01/23 15:25:55 mjk
44 * Fixed FIFFC_DATA_OFFSET and some comments having FIFF_ instead of FIFFV_.
45 *
46 * Revision 1.6 2002/12/18 15:36:45 mjk
47 * Added extractable comments.
48 *
49 * Revision 1.5 2002/08/23 22:47:40 22:47:40 mjk (Matti Kajola)
50 * Rev 1.5.1
51 *
52 * Revision 1.4 2002/08/19 11:56:42 11:56:42 mjk (Matti Kajola)
53 * Librev 1.5.0
54 *
55 * Revision 1.3 2001/09/18 09:36:25 09:36:25 mjk (Matti Kajola)
56 * Trying to close 1.4.0.
57 *
58 *----------------------------------------------------------------------*/
71#ifndef _fiff_types_h
72#define _fiff_types_h
73
74#include <stdio.h>
75#include <sys/types.h>
76
77#define FIFFC_FAIL -1
78#define FIFFC_OK 0
79
80#define FIFFV_TRUE 1
81#define FIFFV_FALSE 0
82
83/* Compatibility definitions */
84
85#define FIFF_FAIL -1
86#define FIFF_OK 0
87
88/* We need to define in objects of known size! */
89/* Unfortunetely there seems to be no consensus among */
90/* different operating systems how to do this. */
91
92#if defined(__linux) || defined(__Lynx__) || defined(__APPLE__)
93#include <stdint.h>
94#endif
95#if defined(HPRT)
96typedef int int32_t;
97typedef short int16_t;
98typedef unsigned short uint16_t;
99#endif
100#if defined(WIN32)
101typedef __int32 int32_t;
102typedef __int16 int16_t;
103typedef unsigned __int16 uint16_t;
104#endif
105
106//=============================================================================================================
107// QT INCLUDES
108//=============================================================================================================
109
110#include <qglobal.h>
111
112//=============================================================================================================
113// DEFINE NAMESPACE FIFFLIB
114//=============================================================================================================
115
116namespace FIFFLIB
117{
118
119//=============================================================================================================
120// TYPEDEFS Primitive building blocks:
121//=============================================================================================================
122
123typedef unsigned char fiff_byte_t;
124typedef char fiff_char_t;
125typedef qint16 fiff_short_t;
126typedef quint16 fiff_ushort_t;
127typedef qint32 fiff_int_t;
128typedef quint32 fiff_uint_t;
129typedef qint64 fiff_long_t;
130typedef quint64 fiff_ulong_t;
131typedef float fiff_float_t;
132typedef double fiff_double_t;
133typedef quint16 fiff_dau_pack13_t;
134typedef quint16 fiff_dau_pack14_t;
135typedef qint16 fiff_dau_pack16_t;
136typedef qint64 fiff_julian_t;
137typedef char fiff_data_t; //unsig char instead of void -> avoid void in C++ cause of its undefined behaviour using delete -> this can happen during lots of casting
138
139/*----------------------------------------------------------------------
140 *
141 * Primitive building blocks:
142 *
143 *---------------------------------------------------------------------*/
144
145/*----------------------------------------------------------------------
146 *
147 * Structured types
148 *
149 *---------------------------------------------------------------------*/
150
157typedef struct _fiffTagRec {
158 fiff_int_t kind;
160 fiff_int_t type;
162 fiff_int_t size;
165 fiff_int_t next;
169 fiff_data_t *data;
173#define FIFFV_NEXT_SEQ 0
174#define FIFFV_NEXT_NONE -1
175
176#define FIFFC_TAG_INFO_SIZE (sizeof(fiffTagRec) - sizeof(fiff_data_t *))
177#define FIFFC_DATA_OFFSET FIFFC_TAG_INFO_SIZE
178#define FIFFM_TAG_INFO(x) &((x)->kind)
179
182typedef struct _fiffTimeRec {
183 fiff_int_t secs;
184 fiff_int_t usecs;
189typedef struct _fiffDigStringRec {
190 fiff_int_t kind;
191 fiff_int_t ident;
192 fiff_int_t np;
193 fiff_float_t **rr;
197
200typedef struct _fiff_event_bits {
201 fiff_int_t from_mask;
202 fiff_int_t from_state;
203 fiff_int_t to_mask;
204 fiff_int_t to_state;
206
214typedef struct _fiffIdRec {
215 fiff_int_t version;
216 fiff_int_t machid[2];
218} *fiffId,fiffIdRec;
220typedef fiffIdRec fiff_id_t;
221
222#define FIFFV_MAGN_CH 1
223#define FIFFV_EL_CH 2
224#define FIFFV_MEG_CH FIFFV_MAGN_CH
225#define FIFFV_MCG_CH 201
226#define FIFFV_EEG_CH FIFFV_EL_CH
227#define FIFFV_STIM_CH 3
228
229#define FIFFV_EOG_CH 202
230#define FIFFV_EMG_CH 302
231#define FIFFV_ECG_CH 402
232#define FIFFV_MISC_CH 502
233#define FIFFV_RESP_CH 602 /* Respiration monitoring */
234/*
235 * Quaternion channels for head position monitoring
236 */
237#define FIFFV_QUAT_0 700 /* Quaternion parameter q0; obsolete for unit quaternion */
238#define FIFFV_QUAT_1 701 /* Quaternion parameter q1; rotation */
239#define FIFFV_QUAT_2 702 /* Quaternion parameter q2; rotation */
240#define FIFFV_QUAT_3 703 /* Quaternion parameter q3; rotation */
241#define FIFFV_QUAT_4 704 /* Quaternion parameter q4; translation */
242#define FIFFV_QUAT_5 705 /* Quaternion parameter q5; translation */
243#define FIFFV_QUAT_6 706 /* Quaternion parameter q6; translation */
244#define FIFFV_HPI_G 707 /* Goodness-of-fit in continuous hpi */
245#define FIFFV_HPI_ERR 708 /* Estimation error in continuous hpi */
246#define FIFFV_HPI_MOV 709 /* Estimated head movement speed in continuous hpi */
247
248#define FIFFM_QUAT_CH(X) ((X >= FIFFV_QUAT_0) && (X <= FIFFV_HPI_MOV)) /* Check for a quaternion channel */
249
250#define FIFFV_DIPOLE_WAVE_CH 1000 /* Dipole time curve */
251#define FIFFV_GOODNESS_FIT_CH 1001 /* Goodness of fit */
252
255typedef struct _fiffChPosRec {
256 fiff_int_t coil_type;
257 fiff_float_t r0[3];
258 fiff_float_t ex[3];
259 fiff_float_t ey[3];
260 fiff_float_t ez[3];
264
265/*
266 * Coil types
267 */
268
269/* \def FIFFV_COIL_NONE */
270
271#define FIFFV_COIL_NONE 0
272#define FIFFV_COIL_EEG 1
273#define FIFFV_COIL_NM_122 2
274#define FIFFV_COIL_NM_24 3
275#define FIFFV_COIL_NM_MCG_AXIAL 4
276#define FIFFV_COIL_EEG_BIPOLAR 5
278#define FIFFV_COIL_DIPOLE 200
281#define FIFFV_COIL_MCG_42 1000
283#define FIFFV_COIL_POINT_MAGNETOMETER 2000
284#define FIFFV_COIL_AXIAL_GRAD_5CM 2001
286#define FIFFV_COIL_VV_PLANAR_W 3011
287#define FIFFV_COIL_VV_PLANAR_T1 3012
288#define FIFFV_COIL_VV_PLANAR_T2 3013
289#define FIFFV_COIL_VV_PLANAR_T3 3014
290#define FIFFV_COIL_VV_MAG_W 3021
291#define FIFFV_COIL_VV_MAG_T1 3022
292#define FIFFV_COIL_VV_MAG_T2 3023
293#define FIFFV_COIL_VV_MAG_T3 3024
295#define FIFFV_COIL_MAGNES_MAG 4001
296#define FIFFV_COIL_MAGNES_GRAD 4002
297#define FIFFV_COIL_CTF_GRAD 5001
299#define FIFFM_IS_VV_COIL(c) ((c)/1000 == 3)
300
303//typedef struct _fiffChInfoRec {
304// fiff_int_t scanNo; /**< Scanning order number. */
305// fiff_int_t logNo; /**< Logical channel #. */
306// fiff_int_t kind; /**< Kind of channel. */
307// fiff_float_t range; /**< Voltmeter range (-1 = auto ranging). */
308// fiff_float_t cal; /**< Calibration from volts to units used. */
309// fiff_ch_pos_t chpos; /**< Channel location. */
310// fiff_int_t unit; /**< Unit of measurement. */
311// fiff_int_t unit_mul; /**< Unit multiplier exponent. */
312// fiff_char_t ch_name[16]; /**< Descriptive name for the channel. */
313//} fiffChInfoRec,*fiffChInfo; /**< Description of one channel. */
314
316//typedef fiffChInfoRec fiff_ch_info_t;
317
318#define FIFFM_CHPOS(x) &((x)->chpos)
319
320/*
321 * Units of measurement
322 */
323
324#define FIFF_UNIT_NONE -1
325/*
326 * 1. SI base units
327 */
328#define FIFF_UNIT_M 1
329#define FIFF_UNIT_KG 2
330#define FIFF_UNIT_SEC 3
331#define FIFF_UNIT_A 4
332#define FIFF_UNIT_K 5
333#define FIFF_UNIT_MOL 6
334/*
335 * 2. SI Supplementary units
336 */
337#define FIFF_UNIT_RAD 7
338#define FIFF_UNIT_SR 8
339/*
340 * 1. SI base candela
341 */
342#define FIFF_UNIT_CD 9
343/*
344 * 3. SI derived units
345 */
346#define FIFF_UNIT_HZ 101
347#define FIFF_UNIT_N 102
348#define FIFF_UNIT_PA 103
349#define FIFF_UNIT_J 104
350#define FIFF_UNIT_W 105
351#define FIFF_UNIT_C 106
352#define FIFF_UNIT_V 107
353#define FIFF_UNIT_F 108
354#define FIFF_UNIT_OHM 109
355#define FIFF_UNIT_MHO 110
356#define FIFF_UNIT_WB 111
357#define FIFF_UNIT_T 112
358#define FIFF_UNIT_H 113
359#define FIFF_UNIT_CEL 114
360#define FIFF_UNIT_LM 115
361#define FIFF_UNIT_LX 116
362/*
363 * 4. Others we need
364 */
365#define FIFF_UNIT_T_M 201 /* T/m */
366#define FIFF_UNIT_AM 202 /* Am */
367/*
368 * 5. Multipliers
369 */
370#define FIFF_UNITM_E 18
371#define FIFF_UNITM_PET 15
372#define FIFF_UNITM_T 12
373#define FIFF_UNITM_MEG 6
374#define FIFF_UNITM_K 3
375#define FIFF_UNITM_H 2
376#define FIFF_UNITM_DA 1
377#define FIFF_UNITM_NONE 0
378#define FIFF_UNITM_D -1
379#define FIFF_UNITM_C -2
380#define FIFF_UNITM_M -3
381#define FIFF_UNITM_MU -6
382#define FIFF_UNITM_N -9
383#define FIFF_UNITM_P -12
384#define FIFF_UNITM_F -15
385#define FIFF_UNITM_A -18
386
389typedef struct _fiffDirEntryRec {
390 fiff_int_t kind;
391 fiff_int_t type;
392 fiff_int_t size;
393 fiff_int_t pos;
401
404typedef struct _fiffDigPointRec {
405 fiff_int_t kind;
408 fiff_int_t ident;
409 fiff_float_t r[3];
416
417#define FIFFV_POINT_CARDINAL 1
418#define FIFFV_POINT_HPI 2
419#define FIFFV_POINT_EEG 3
420#define FIFFV_POINT_ECG FIFF_POINT_EEG
421#define FIFFV_POINT_EXTRA 4
422
423#define FIFFV_POINT_LPA 1
424#define FIFFV_POINT_NASION 2
425#define FIFFV_POINT_RPA 3
426/*
427 * These are the cardinal points for MCG data
428 * Left and right are supposed to be located below the sternum point
429 */
430#define FIFFV_POINT_CHEST_LEFT 1
431#define FIFFV_POINT_CHEST_STERNUM 2
432#define FIFFV_POINT_CHEST_RIGHT 3
433
436typedef struct _fiffCoordTransRec {
437 fiff_int_t from;
438 fiff_int_t to;
439 fiff_float_t rot[3][3];
440 fiff_float_t move[3];
441 fiff_float_t invrot[3][3];
442 fiff_float_t invmove[3];
446
447#define FIFFV_COORD_UNKNOWN 0
448#define FIFFV_COORD_DEVICE 1
449#define FIFFV_COORD_ISOTRAK 2
450#define FIFFV_COORD_HPI 3
451#define FIFFV_COORD_HEAD 4
452#define FIFFV_COORD_MRI 5
453#define FIFFV_COORD_MRI_SLICE 6
454#define FIFFV_COORD_MRI_DISPLAY 7
455#define FIFFV_COORD_XRAY FIFF_COORD_MRI
456#define FIFFV_COORD_XRAY_SLICE FIFF_COORD_MRI_SLICE
457#define FIFFV_COORD_CT FIFF_COORD_MRI
458#define FIFFV_COORD_CT_SLICE FIFF_COORD_MRI_SLICE
459
460#define FIFFV_COORD_DICOM_DEVICE 8
461#define FIFFV_COORD_IMAGING_DEVICE 9
462
463#define FIFFV_COORD_TORSO 100
464
465#define FIFFV_MOVE 1
466#define FIFFV_NO_MOVE 0
467/*
468 * Artefact removal parameters
469 */
470#define FIFFV_ARTEF_MAX 100
471#define FIFFV_ARTEF_NONE -1
472#define FIFFV_ARTEF_KEEP 0
473#define FIFFV_ARTEF_JUMP 1
474#define FIFFV_ARTEF_NOJUMP 2
475
476/*
477 * The layered sphere model
478 */
479
482//typedef struct _fiffLayerRec {
483// fiff_int_t id; /**< Id # of this layer (see below). */
484// fiff_float_t rad; /**< Radius of this layer (m). */
485//} *fiffLayer,fiffLayerRec; /**< Layer descriptor for a layered sphere model. */
486
487#define FIFFV_LAYER_BRAIN 1
488#define FIFFV_LAYER_CSF 2
489#define FIFFV_LAYER_SKULL 3
490#define FIFFV_LAYER_HEAD 4
491
492#define FIFFV_XFIT_MAP_SURF_SENSORS 0
493#define FIFFV_XFIT_MAP_SURF_HEAD 1
494#define FIFFV_XFIT_MAP_SURF_SPHERE 2
496/*----------------------------------------------------------------------
497 * Following types are used by the fiff library. They are not used
498 * within the files.
499 *---------------------------------------------------------------------*/
500
503//typedef struct _fiffDirNode {
504// int type; /**< Block type for this directory. */
505// fiffId id; /**< Id of this block if any. */
506// fiffDirEntry dir; /**< Directory of tags in this node. */
507// int nent; /**< Number of entries in this node. */
508// fiffDirEntry dir_tree; /**< Directory of tags within this node
509// * subtrees as well as FIFF_BLOCK_START and FIFF_BLOCK_END
510// * included. NOTE: While dir is allocated separately
511// * dir_tree is a pointer to the dirtree field
512// * in the fiffFile structure. The dir_tree and nent_tree
513// * fields are only used within the library to facilitate
514// * certain operations. */
515// int nent_tree; /**< Number of entries in the directory tree node. */
516// struct _fiffDirNode *parent; /**< Parent node. */
517// struct _fiffDirNode **children;/**< Child nodes. */
518// int nchild; /**< Number of child nodes. */
519//} fiffDirNodeRec,*fiffDirNode; /**< Directory tree structure used by the fiff library routines. */
520
523//typedef struct _fiffFileRec {
524// char *file_name; /**< Name of the file. */
525// FILE *fd; /**< The normal file descriptor. */
526// fiffId id; /**< The file identifier. */
527// fiffDirEntry dir; /**< This is the directory.
528// * If no directory exists, fiff_open
529// * automatically scans the file to create one. */
530// int nent; /**< How many entries?. */
531// fiffDirNode dirtree; /**< Directory compiled into a tree. */
532// char *ext_file_name; /**< Name of the file holding the external data. */
533// FILE *ext_fd; /**< The file descriptor of the above file if open . */
534//} *fiffFile,fiffFileRec; /**< FIFF file handle. fiff_open() returns this. */
535
538typedef struct _fiff_sparse_matrix {
539 fiff_int_t coding;
540 fiff_int_t m;
541 fiff_int_t n;
542 fiff_int_t nz;
543 fiff_float_t *data;
544 fiff_int_t *inds;
545 fiff_int_t *ptrs;
547
549
559
566
567typedef struct _fiff_data_ref {
568 fiff_int_t type;
569 fiff_int_t endian;
570 fiff_long_t size;
571 fiff_long_t offset;
573
574} // NAMESPACE
575
576#endif
Outdated STUFF!!!!!!!!!!!!!!!!!!!!! ToDo Remove.
ToDo Old implementation use new fiff_id.h instead.
ToDo Old implementation use new fiff_dir_entry.h instead.
ToDo Old implementation.
fiffEventBitsRec event_bits