MNE-CPP  0.1.9
A Framework for Electrophysiology
mne_source_space_old.cpp
Go to the documentation of this file.
1 //=============================================================================================================
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 
41 #include "mne_source_space_old.h"
42 
43 #define X_51 0
44 #define Y_51 1
45 #define Z_51 2
46 
47 #define ALLOC_INT_51(x) MALLOC_51(x,int)
48 
49 #define MALLOC_51(x,t) (t *)malloc((x)*sizeof(t))
50 
51 #define ALLOC_CMATRIX_51(x,y) mne_cmatrix_51((x),(y))
52 
53 #ifndef TRUE
54 #define TRUE 1
55 #endif
56 
57 #ifndef FALSE
58 #define FALSE 0
59 #endif
60 
61 static void matrix_error_51(int kind, int nr, int nc)
62 
63 {
64  if (kind == 1)
65  printf("Failed to allocate memory pointers for a %d x %d matrix\n",nr,nc);
66  else if (kind == 2)
67  printf("Failed to allocate memory for a %d x %d matrix\n",nr,nc);
68  else
69  printf("Allocation error for a %d x %d matrix\n",nr,nc);
70  if (sizeof(void *) == 4) {
71  printf("This is probably because you seem to be using a computer with 32-bit architecture.\n");
72  printf("Please consider moving to a 64-bit platform.");
73  }
74  printf("Cannot continue. Sorry.\n");
75  exit(1);
76 }
77 
78 float **mne_cmatrix_51(int nr,int nc)
79 
80 {
81  int i;
82  float **m;
83  float *whole;
84 
85  m = MALLOC_51(nr,float *);
86  if (!m) matrix_error_51(1,nr,nc);
87  whole = MALLOC_51(nr*nc,float);
88  if (!whole) matrix_error_51(2,nr,nc);
89 
90  for(i=0;i<nr;i++)
91  m[i] = whole + i*nc;
92  return m;
93 }
94 
95 //=============================================================================================================
96 // USED NAMESPACES
97 //=============================================================================================================
98 
99 using namespace Eigen;
100 using namespace MNELIB;
101 
102 //=============================================================================================================
103 // DEFINE MEMBER METHODS
104 //=============================================================================================================
105 
106 MneSourceSpaceOld::MneSourceSpaceOld(int np)
107 {
108  this->np = np;
109  if (np > 0) {
110  rr = ALLOC_CMATRIX_51(np,3);
111  nn = ALLOC_CMATRIX_51(np,3);
112  inuse = ALLOC_INT_51(np);
113  vertno = ALLOC_INT_51(np);
114  }
115  else {
116  rr = Q_NULLPTR;
117  nn = Q_NULLPTR;
118  inuse = Q_NULLPTR;
119  vertno = Q_NULLPTR;
120  }
121  nuse = 0;
122  ntri = 0;
123  tris = Q_NULLPTR;
124  itris = Q_NULLPTR;
125  tot_area = 0.0;
126 
127  nuse_tri = 0;
128  use_tris = Q_NULLPTR;
129  use_itris = Q_NULLPTR;
130 
131  neighbor_tri = Q_NULLPTR;
132  nneighbor_tri = Q_NULLPTR;
133  curv = Q_NULLPTR;
134  val = Q_NULLPTR;
135 
136  neighbor_vert = Q_NULLPTR;
137  nneighbor_vert = Q_NULLPTR;
138  vert_dist = Q_NULLPTR;
139 
140  coord_frame = FIFFV_COORD_MRI;
141  id = FIFFV_MNE_SURF_UNKNOWN;
142  subject = "";
143  type = FIFFV_MNE_SPACE_SURFACE;
144 
145  nearest = Q_NULLPTR;
146  patches = Q_NULLPTR;
147  npatch = 0;
148 
149  dist = Q_NULLPTR;
150  dist_limit = -1.0;
151 
152  voxel_surf_RAS_t = Q_NULLPTR;
153  vol_dims[0] = vol_dims[1] = vol_dims[2] = 0;
154 
155  MRI_volume = "";
156  MRI_surf_RAS_RAS_t = Q_NULLPTR;
157  MRI_voxel_surf_RAS_t = Q_NULLPTR;
158  MRI_vol_dims[0] = MRI_vol_dims[1] = MRI_vol_dims[2] = 0;
159  interpolator = Q_NULLPTR;
160 
161  vol_geom = Q_NULLPTR;
162  mgh_tags = Q_NULLPTR;
163  user_data = Q_NULLPTR;
164  user_data_free = Q_NULLPTR;
165 
166  cm[X_51] = cm[Y_51] = cm[Z_51] = 0.0;
167 }
168 
169 //=============================================================================================================
170 
171 MneSourceSpaceOld::~MneSourceSpaceOld()
172 {
173 }
174 
mne_source_space_old.h
MneSourceSpaceOld class declaration.