MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
analyze_types.h
1#ifndef _analyze_types_h
2#define _analyze_types_h
3
4#define SURF_UNKNOWN -1
5
6#define SURF_LEFT_HEMI FIFFV_MNE_SURF_LEFT_HEMI
7#define SURF_RIGHT_HEMI FIFFV_MNE_SURF_RIGHT_HEMI
8
9#define SURF_BOTH_HEMIS 103
10
11#define SURF_LEFT_MORPH_HEMI (1 << 16 | FIFFV_MNE_SURF_LEFT_HEMI)
12#define SURF_RIGHT_MORPH_HEMI (1 << 16 | FIFFV_MNE_SURF_RIGHT_HEMI)
13
14#define LABEL_TASK_NONE -1
15#define LABEL_TASK_MAX 1
16#define LABEL_TASK_AVE 2
17#define LABEL_TASK_L2 3
18#define LABEL_TASK_L1 4
19#define LABEL_TASK_TIME_L2 5
20
21#define SHOW_CURVATURE_NONE 0
22#define SHOW_CURVATURE_OVERLAY 1
23
24#define SHOW_OVERLAY_NONE 0
25#define SHOW_OVERLAY_HEAT 1
26#define SHOW_OVERLAY_NEGPOS 2
27
28#define ESTIMATE_NONE 0
29#define ESTIMATE_MNE 1
30#define ESTIMATE_dSPM 2
31#define ESTIMATE_sLORETA 3
32#define ESTIMATE_fMRI 4
33#define ESTIMATE_NOISE 5
34#define ESTIMATE_OTHER 6
35#define ESTIMATE_PSF 7
36
37#define FIELD_MAP_UNKNOWN 0
38#define FIELD_MAP_MEG 8
39#define GRAD_MAP_MEG 9
40#define FIELD_MAP_EEG 10
41#define OVERLAY_MAP 11
42
43#define MAIN_SURFACES 0
44#define ALT_SURFACES 1
45
46#define OVERLAY_CORTEX 1
47#define OVERLAY_SCALP 2
48
49#define TIMECOURSE_SOURCE_UNKNOWN -1
50#define TIMECOURSE_SOURCE_DATA 1
51#define TIMECOURSE_SOURCE_OVERLAY 2
52
53#define MNEV_REG_NOISE 1
54#define MNEV_REG_PEARSON 2
55#define MNEV_REG_GCV 3
56
57#define NOISE_NORMALIZED(e) ((e) == ESTIMATE_dSPM || (e) == ESTIMATE_sLORETA)
58
59#include <fiff/fiff_types.h>
61#include <fwd/fwd_coil_set.h>
62#include "../c/mne_meas_data.h"
69
70//=============================================================================================================
71// DEFINE NAMESPACE INVERSELIB
72//=============================================================================================================
73
74namespace INVERSELIB
75{
76
77typedef struct {
78 float megmin,megmax; /* MEG gradiometer vertical scale [T/m] */
79 float megaxmult; /* Multiplier for the magnetometer scaling [m] */
80 float eegmin,eegmax; /* EEG scale [V] */
81 float tmin,tmax; /* Time limits [sec] */
82 float full_range; /* Use the full time range available */
83 float basemin,basemax; /* Baseline limits [sec] */
84 int use_baseline; /* Baseline active */
85 int show_stim; /* Show the digital stimulus channel in the sample display? */
86 float cursor_step; /* How much to step in time when using the keyboard to go back and forth [sec] */
88
89//typedef struct { /* The celebrated tksurfer-style values */
90// int type; /* What is this scale setting good for? */
91// float mult; /* Convenience multiplier from internal units to displayed numbers */
92// float fthresh; /* Threshold */
93// float fmid; /* This is in the middle */
94// float fslope; /* We still use the slope internally (sigh) */
95// float tc_mult; /* Multiply the scales by this value for timecourses */
96// int relative; /* Are fthresh and fmid relative to the maximum value over the surface? */
97//} *mshColorScaleDef,mshColorScaleDefRec;
98
99typedef struct {
100 int meg_mapping_grade; /* Icosahedron downsampling grade for the scalp MEG map (only applies to the head surface map) */
101 int eeg_mapping_grade; /* Icosahedron downsampling grade for the scalp EEG map*/
102 float miss_meg; /* Smoothing criterion for MEG */
103 float miss_eeg; /* Smoothing criterion for EEG */
104 float intrad; /* Integration radius */
105 int meg_nsmooth; /* Smoothing for the MEG head surface maps (only applies to the head surface map) */
106 int eeg_nsmooth; /* Smoothing for the EEG head surface maps */
107 float meg_origin[3]; /* MEG sphere model origin (default to origin of MRI coordinates) */
108 int meg_origin_frame; /* Which coordinate frame? (set to FIFFV_COORD_UNKNOWN for automatic setting) */
109 float eeg_origin[3]; /* EEG sphere model origin (Default to sphere fitting the electrodes best) */
110 int eeg_origin_frame; /* Which coordinate frame? (set to FIFFV_COORD_UNKNOWN for automatic setting) */
111 int head_surface_meg_map; /* Calculate the MEG map on the head surface? */
112 float meg_contour_step; /* Primary source of steps */
113 float eeg_contour_step; /* Primary source of steps */
114 float meg_maxval; /* Maximum absolute value at the time the MEG contour step was recalculated */
115 float eeg_maxval; /* Maximum absolute value at the time the EEG contour step was recalculated */
117
118typedef struct {
119 int reg_method; /* The method used to compute regularization estimates */
120 float reg_SNR; /* The virtual (power) SNR employed in regularization */
121 int estimate; /* What to calculate (MNE, dSPM, sLORETA) */
122 int do_sqrt; /* do square root? */
123 int do_signed; /* Preserve sign (current orientation) */
124 int do_normal_comp; /* Omit the components tangential to the cortex */
125 int do_alt_noise; /* Try an alternate noise normalization */
126 MNELIB::MneMshColorScaleDef scale_MNE; /* MNE scale */
127 MNELIB::MneMshColorScaleDef scale_dSPM; /* SPM scale */
128 MNELIB::MneMshColorScaleDef scale_sLORETA; /* sLORETA scale */
129 int nstep; /* Desired number of smoothsteps */
130 float integ; /* Time integration to apply */
131 int show_scale_bar; /* Display the color scale? */
132 int show_comments; /* Show the comment text */
133 int sketch_mode; /* Use sketch mode? */
134 int thresh_estimate; /* Use this statistic to threshold */
135 float thresh; /* Threshold the data at this value */
136 float alpha; /* Opacity 0...1 */
137 int simulate; /* Simulate data on picking points from the surface */
138 /*
139 * More to come
140 */
142
143typedef struct { /* Stores label information */
144 char *file_name; /* True file name */
145 char *short_name; /* Nickname */
146 char *comment; /* Comment read from the label file (first line) */
147 int hemi; /* Which hemisphere */
148 int *sel; /* Vertices */
149 int nsel; /* How many? */
150 float color[4]; /* Color for this label */
152
153typedef struct {
154 mshLabel *labels;
155 int nlabel;
157
158typedef struct {
159 char *short_name; /* Short name for this overlay */
160 int surf_type; /* OVERLAY_CORTEX or OVERLAY_SCALP */
161 int type; /* Type of the overlay data */
162 int is_signed; /* Are these data signed? */
163 MNELIB::MneMshColorScaleDef scale; /* Scale to use */
164 int show_comments; /* Show the comment text */
165 int show_scale_bar; /* Show the scale bar */
166 int show_contours; /* Show the contour map for OVERLAY_SCALP */
167 float contour_step; /* Step between the OVERLAY_SCALP contours */
168 float alpha; /* Determines the opacity */
169 int nstep; /* Number of smoothsteps to take */
170 float time; /* Timeslice to pick from stc data (in seconds) */
171 float integ; /* Time integration */
172// mneWdata lh_data; /* LH wdata loaded from an overlay file */
173// mneWdata rh_data; /* RH wdata loaded from an overlay file */
174// mneStcData lh_stc_data; /* LH stc data loaded from an overlay file */
175// mneStcData rh_stc_data; /* RH stc data loaded from an overlay file */
176 int lh_sparse; /* Is LH data sparse */
177 int rh_sparse; /* Is RH data sparse */
178 int lh_match_surf; /* What kind of surface does the data match to */
179 int rh_match_surf; /* What kind of surface does the data match to */
180 float **hist; /* The value histogram */
181 int nbin; /* How many bins */
183
184typedef struct { /* Overlay preferences. This structure can be kept private */
185 int type; /* What kind of overlay? (fMRI, other) */
186 int do_signed; /* Preserve sign (current orientation)
187 * This is never changed, just copied from the current overlay */
188 MNELIB::MneMshColorScaleDef scale_MNE; /* MNE scale */
189 MNELIB::MneMshColorScaleDef scale_dSPM; /* SPM scale */
190 MNELIB::MneMshColorScaleDef scale_sLORETA; /* sLORETA scale */
191 MNELIB::MneMshColorScaleDef scale_fMRI; /* Scale */
192 MNELIB::MneMshColorScaleDef scale_other; /* Scale */
193 int nstep; /* Desired number of smoothsteps */
194 float alpha; /* opacity */
195 int show_comments; /* Show comment text */
196 int show_scale_bar; /* Show the scale bar */
197 int show_contours; /* Show the contour map */
198 float contour_step; /* Step between contours */
199 int surf_type; /* OVERLAY_SCALP or OVERLAY_CORTEX */
201
202typedef struct { /* This is used for field mapping with help of the sphere-model MNE */
203 int kind; /* Either FIELD_MAP_MEG or FIELD_MAP_EEG */
204 MNELIB::MneSurfaceOld* surf; /* The surface on which we are mapping */
205 char *surfname; /* The name of the file where the above surface came from */
206 int *surface_sel; /* We may calculate the interpolation only in a subset of vertices */
207 int nsurface_sel; /* How many points in the above */
208 int nsmooth; /* How many smoothsteps to take after the extrapolation/interpolation */
209 float **smooth_weights; /* The smoothing weights */
210 int nch; /* How many channels */
211 int *pick; /* Which channels are of this modality in the original data */
212 FWDLIB::FwdCoilSet* coils; /* Coils */
213 float origin[3]; /* Origin */
214 float miss; /* Amount of unexplained variance */
215 float **self_dots; /* Dot products between the original leads */
216 float **surface_dots; /* Dot products from the original leads to the virtual leads */
217 float intrad; /* The integration radius used */
218 MNELIB::MneCovMatrix* noise; /* Noise-covariance matrix to use */
219 int nest; /* How many singular values to include? */
220 float **mapping_mat; /* The mapping matrix */
222
223typedef struct { /* This is used for the calculated contours */
224 int kind; /* Either FIELD_MAP_MEG or FIELD_MAP_EEG */
225 float *map; /* The contour map values at the vertices of the surface (could go to the overlay data as well) */
226 int nmap; /* How many values */
227 int show; /* Should we really show this map */
228 float step; /* Contour step */
230
231//typedef struct { /* The digitizer data will be loaded from the measurement file or elsewhere */
232// char *filename; /* Where did these come from */
233// FIFFLIB::FiffCoordTransOld* head_mri_t; /* This is relevant for us */
234// FIFFLIB::FiffCoordTransOld* head_mri_t_adj; /* This is the adjusted transformation */
235// FIFFLIB::fiffDigPoint points; /* The points */
236// int coord_frame; /* The coordinate frame of the above points */
237// int *active; /* Which are active */
238// int *discard; /* Which should be discarded? */
239// int npoint; /* How many? */
240// FIFFLIB::fiffDigPoint mri_fids; /* MRI coordinate system fiducials picked here */
241// int nfids; /* How many? */
242// int show; /* Should the digitizer data be shown */
243// int show_minimal; /* Show fiducials and coils only? */
244// float *dist; /* Distance of each point from the head surface */
245// int *closest; /* Closest vertex # on the head surface */
246// float **closest_point; /* Closest vertex locations on the head surface */
247// int dist_valid; /* Are the above data valid at this point? */
248//} *digitizerData,digitizerDataRec;
249
250typedef struct { /* These are the data from the HPI result block */
251 char *filename; /* Where did these come from */
252 FIFFLIB::FiffCoordTransSet* meg_head_t; /* The MEG device <-> head coordinate system transformation */
253 FIFFLIB::FiffDigPoint *hpi_coils; /* Locations of the HPI coils in MEG device coordinates */
254 int ncoil; /* How many of them? */
255 int *dig_order; /* Which digitized HPI coil corresponds to each of the above coils */
256 int *coils_used; /* Which coils were used? */
257 int nused; /* How many were used? */
258 float *g_values; /* Goodness of fit for each of the coils */
259 float g_limit; /* Goodness-of-fit acceptance requirement */
260 float dist_limit; /* Distance acceptance requirement */
261 int fit_accept; /* Was the fit accepted */
263
264typedef struct { /* One saved timecourse */
265 char *file_name; /* The associated file name */
266 char *comment; /* Descriptive comment */
267 int source; /* Does this come from the data or from an overlay */
268 int quantity; /* What is this all about */
269 int fixed_ori; /* Fixed orientations? */
270 int active; /* Is this to be shown */
271 mshLabel label; /* Label for this timecourse */
272 float **timecourses; /* Timecourses for the points in label */
273 int *sel; /* Vertex numbers in the complete triangulation for each time course */
274 float **rr; /* Locations of these points */
275 int coord_frame; /* Which coordinate frame? */
276 int nsel; /* How many? */
277 int label_task; /* What has been done with it */
278 float *timecourse_task; /* The corresponding waveform */
279 int is_signed; /* Does this timecourse contain positive and negative data */
280 int np; /* How many data points? */
281 float tmin; /* Starting time */
282 float tstep; /* Time between points */
283 float color[3]; /* Color for drawing */
285
286typedef struct { /* A collection of the above */
287 timecourseData *timecourses; /* Pointers to the above structures */
288 int ncourse; /* How many */
290
291typedef struct {
292 int sample; /* Which channel is the sample */
293 float picked_time; /* Current time point */
294 int have_picked; /* Have we picked a time */
295 mshScales scales;
296 mnePref mne_prefs;
297} *dataSetData,dataSetDataRec; /* These have to be kept between data set changes */
298
299typedef struct {
300 char *meas_file; /* The measurement file */
301 char *inv_file; /* Inverse operator file */
302 char *mri_trans_file; /* Where does the MRI transform come from */
303 int nave; /* If nave < 0 use nave from the measurement data? */
304 INVERSELIB::MneMeasData* meas; /* The measurement */
305 float raw_tmin,raw_tmax; /* Time range for raw data segments */
306 int sample; /* Which channel is the sample */
307 int firstp; /* First data point in the current time range selection */
308 int np; /* Number of data points in the current time range selection */
309 float tmin,tmax; /* Corresponding time values (precalculated for convenience) */
310 float picked_time; /* Current time point */
311 int have_picked; /* Have we picked a time */
312 double abs_picked_time; /* Absolute time picked from the start of the raw data
313 * (good to use double because of the possibly long time span) */
314 int *bads; /* Which channels are bad */
315 int *sels; /* Which channels have been selected for dipole fitting? */
316 char *selname; /* Name of the current channel selection (if any) */
317 MNELIB::mneLayout lout; /* This is the layout */
318 mshScales scales; /* Time and vertical scale and baseline */
319
320 float *custom_data; /* Custom data to use instead of data picked from the responses */
321 char *custom_desc; /* Description of the custom data */
322
323 mnePref mne_prefs; /* MNE calculation preferences */
324 float *cur_vals; /* Current values */
325 FIFFLIB::FiffSparseMatrix* nn_vals; /* Noise normalization values */
326 MNELIB::MneMshColorScaleDef scale; /* Scale presently used for display */
327
328 FIFFLIB::FiffDigitizerData *dig; /* These are the Polhemus data */
329
330 fieldMappingData meg_mapping; /* Data for field interpolations (MEG on helmet) */
331 fieldMappingData meg_mapping_head; /* Data for field interpolations (MEG on scalp) */
332 fieldMappingData eeg_mapping; /* Data for field interpolations (EEG on scalp) */
333 fieldMappingPref mapping_pref; /* Desired settings */
334
335 void *dipole_fit_setup; /* Dipole fitting data (opaque for us) */
336 mneUserFreeFunc dipole_fit_setup_free;
337
338 void *user_data; /* Can be used to store whatever */
339 mneUserFreeFunc user_data_free; /* Called to free the above object */
341
342//typedef struct { /* Definition of lighting */
343// int state; /* On or off? */
344// float pos[3]; /* Where is the light? */
345// float diff[3]; /* Diffuse intensity */
346//} *mshLight,mshLightRec; /* We are only using diffuse lights here */
347
348//typedef struct { /* Light set */
349// char *name; /* Name of this set */
350// mshLight lights; /* Which lights */
351// int nlight; /* How many */
352//} *mshLightSet,mshLightSetRec;
353
354//typedef struct {
355// int vert; /* Vertex # */
356// int sparse; /* Is this a isolated point? */
357//} *mshPicked,mshPickedRec;
358
359//typedef struct {
360// FIFFLIB::FiffSparseMatrix* map; /* Multiply the data in the from surface with this to get to
361// * 'this' surface from the 'from' surface */
362// int *best; /* For each point on 'this' surface, the closest point on 'from' surface */
363// int from_kind; /* The kind field of the other surface */
364// char *from_subj; /* Name of the subject of the other surface */
365//} *morphMap,morphMapRec;
366
367//typedef struct { /* Display surface properties */
368// char *filename; /* Where did this surface come from? */
369// time_t time_loaded; /* When was the surface loaded */
370// char *subj; /* The name of the subject in SUBJECTS_DIR */
371// char *surf_name; /* The name of the surface */
372// MNELIB::MneSurfaceOld* s; /* This is the surface */
373// float eye[3]; /* Eye position for viewing */
374// float up[3]; /* Up vector for viewing */
375// float rot[3]; /* Rotation angles of the MRI (in radians) */
376// float move[3]; /* Possibly move the origin, too */
377
378// float fov; /* Field of view (extent of the surface) */
379// float fov_scale; /* How much space to leave */
380// float minv[3]; /* Minimum values along the three coordinate axes */
381// float maxv[3]; /* Maximum values along the three coordinate axes */
382// float *trans; /* Extra transformation for this surface */
383// int sketch; /* Use sketch mode if decimated triangulation is available? */
384
385// morphMap *maps; /* Morphing maps from other surfaces to this */
386// int nmap; /* Normally just one */
387
388// int overlay_type; /* What are the overlay values? */
389// float *overlay_values; /* Overlay value array */
390// int alt_overlay_type; /* A second choice for overlay */
391// float *alt_overlay_values;
392// float *marker_values; /* Marker values (will be shown in shades of marker color) */
393
394// float *vertex_colors; /* Vertex color array */
395// mshColorScaleDef* color_scale; /* Color scale used to define these colors */
396// int nvertex_colors; /* How many components? */
397// float even_vertex_color[4]; /* This is going to be employed in case of uniform coloring */
398
399// float *marker_colors; /* Vertex color array (for the markers) */
400// int nmarker_colors; /* How many components? */
401// int **marker_tri; /* Triangles containing markers */
402// int *marker_tri_no; /* Numbers of the marker triangles */
403// int nmarker_tri; /* How many */
404// float marker_color[4]; /* Marker color */
405// int curvature_color_mode; /* How to show curvature */
406
407// int overlay_color_mode; /* How to show overlay data */
408// int transparent; /* Is this surface going to be transparent? */
409
410// int show_aux_data; /* Show auxilliary data related to this surface */
411
412// mshPicked* picked; /* Picked locations in world coordinates */
413// int npicked; /* How many */
414
415// void *user_data; /* Can be used to store whatever */
416// mneUserFreeFunc* user_data_free; /* Function to free the above */
417//} *mshDisplaySurface,mshDisplaySurfaceRec;
418
419//typedef struct {
420// FIFFLIB::FiffCoordTransOld* head_surf_RAS_t; /* Transform from MEG head coordinates to surface RAS */
421// FIFFLIB::FiffCoordTransOld* surf_RAS_RAS_t; /* Transform from surface RAS to RAS (nonzero origin) coordinates */
422// FIFFLIB::FiffCoordTransOld* RAS_MNI_tal_t; /* Transform from RAS (nonzero origin) to MNI Talairach coordinates */
423// FIFFLIB::FiffCoordTransOld* MNI_tal_tal_gtz_t; /* Transform MNI Talairach to FreeSurfer Talairach coordinates (z > 0) */
424// FIFFLIB::FiffCoordTransOld* MNI_tal_tal_ltz_t; /* Transform MNI Talairach to FreeSurfer Talairach coordinates (z < 0) */
425//} *coordTransSet,coordTransSetRec;
426
427//typedef struct { /* Set of display surfaces */
428// char *subj; /* The name of the subject */
429// char *morph_subj; /* The subject we are morphing to */
430// FIFFLIB::FiffCoordTransSet* main_t; /* Coordinate transformations for the main surfaces */
431// FIFFLIB::FiffCoordTransSet* morph_t; /* Coordinate transformations for the morph surfaces */
432// MNELIB::MneMshDisplaySurface **surfs; /* These are the surfaces */
433// MNELIB::MneSurfacePatch **patches; /* Optional patches for display */
434// float *patch_rot; /* Rotation angles for the (flat) patches */
435// int nsurf; /* How many? */
436// int use_patches; /* Use patches for display? */
437// int *active; /* Which surfaces are currently active */
438// int *drawable; /* Which surfaces could be drawn? */
439// mshLightSet lights; /* Lighting */
440// float rot[3]; /* Rotation angles of the MRI (in radians) */
441// float move[3]; /* Possibly move the origin, too */
442// float fov; /* Field of view (extent of the surface) */
443// float fov_scale; /* How much space to leave */
444// float eye[3]; /* Eye position for viewing (used in composite views) */
445// float up[3]; /* Up vector for viewing */
446// float bg_color[3]; /* Background color */
447// float text_color[3]; /* Text color */
448// void *user_data; /* Can be used to store whatever */
449// mneUserFreeFunc user_data_free;
450//} *mshDisplaySurfaceSet,mshDisplaySurfaceSetRec;
451
452//typedef struct { /* Where to look at the surfaces from */
453// char *name; /* Name of this definition */
454// float left[3]; /* Left hemisphere viewpoint */
455// float right[3]; /* Right hemisphere viewpoint */
456// float left_up[3]; /* The up vectors */
457// float right_up[3]; /* The up vectors */
458//} *mshEyes,mshEyesRec;
459
460typedef void (*colorEditorDoneFunc)(float *color, void *user);
461
462typedef struct {
463 float time; /* Time point */
464 int samp; /* Corresponding sample number */
465 float quater[4]; /* The unit quaternion */
466 float move[3]; /* Translation */
467 float good; /* Geometric mean of the goodness of fits */
468 FIFFLIB::FiffCoordTransOld *t; /* The corresponding fiff coordinate transformation */
470
471typedef struct {
472 contHpiData *hpi; /* The data records */
473 int nhpi; /* How many of them */
474 int omit_samp; /* How many samples were omitted from the beginning (first_samp + initial skip) */
475 float sfreq; /* Sampling frequency of the data file */
476 /*
477 * The following are needed in the the viewing
478 */
479 int current; /* Which point is the interesting one now? */
480 float max_coil_move; /* Average coil movement scale */
481 float max_velocity; /* Angular velocity scale */
483
484} // Namespace
485
486#endif
FiffCoordTransSet class declaration.
FiffCoordTransOld class declaration.
FiffDigitizerData class declaration.
Definitions for describing the objects in a FIFF file.
MneCovMatrix class declaration.
MneSurfacePatch class declaration.
MneMshColorScaleDef class declaration.
MNE Surface or Volume (MneSurfaceOrVolume) class declaration.
FwdCoilSet class declaration.
Coordinate transformation descriptor.
Coordinate transformation descriptor.
Digitization points container and description.
Data associated with MNE computations for each mneMeasDataSet.
Digitization point description.
FwdCoilSet description.
easurement data representation in MNE calculations
Covariance matrix storage.
The MneMshColorScaleDef class.
This defines a surface.