15#ifndef PROGRAM_VERSION
16#define PROGRAM_VERSION "2.10"
38 if (!check_args(argc,argv))
42 printf(
"%s version %s compiled at %s %s\n",argv[0],
PROGRAM_VERSION,__DATE__,__TIME__);
59 qCritical(
"Source space name is missing. Use the --src option to specify it.");
64 qCritical(
"MRI <-> head coordinate transformation is missing. Use the --mri or --trans option to specify it.");
69 qCritical(
"Source of coil and electrode locations is missing. Use the --meas option to specify it.");
73 qCritical(
"Solution name is missing. Use the --fwd option to specify it.");
77 qCritical(
"Employ the --meg and --eeg options to select MEG and/or EEG");
84void ComputeFwdSettings::initMembers()
87 r0 << 0.0f,0.0f,0.04f;
111void ComputeFwdSettings::usage(
char *
name)
113 printf(
"usage : %s [options]\n",
name);
114 printf(
"\t--meg to compute the MEG forward solution\n");
115 printf(
"\t--eeg to compute the EEG forward solution\n");
116 printf(
"\t--grad compute the gradient of the field with respect to the dipole coordinates as well\n");
117 printf(
"\t--fixed to calculate only for the source orientation given by the surface normals\n");
118 printf(
"\t--mricoord do calculations in MRI coordinates instead of head coordinates\n");
119 printf(
"\t--accurate use more accurate coil definitions in MEG forward computation\n");
120 printf(
"\t--src name specify the source space\n");
121 printf(
"\t--label name label file to select the sources (can have multiple of these)\n");
122 printf(
"\t--mri name take head/MRI coordinate transform from here (Neuromag MRI description file)\n");
123 printf(
"\t--trans name take head/MRI coordinate transform from here (text file)\n");
124 printf(
"\t--notrans head and MRI coordinate systems are identical.\n");
125 printf(
"\t--meas name take MEG sensor and EEG electrode locations from here\n");
126 printf(
"\t--bem name BEM model name\n");
127 printf(
"\t--origin x:y:z/mm use a sphere model with this origin (head coordinates/mm)\n");
128 printf(
"\t--eegscalp scale the electrode locations to the surface of the scalp when using a sphere model\n");
129 printf(
"\t--eegmodels name read EEG sphere model specifications from here.\n");
130 printf(
"\t--eegmodel name name of the EEG sphere model to use (default : Default)\n");
131 printf(
"\t--eegrad rad/mm radius of the scalp surface to use in EEG sphere model (default : %7.1f mm)\n",1000*
eeg_sphere_rad);
132 printf(
"\t--mindist dist/mm minimum allowable distance of the sources from the inner skull surface.\n");
133 printf(
"\t--mindistout name Output the omitted source space points here.\n");
134 printf(
"\t--includeall Omit all source space checks\n");
135 printf(
"\t--all calculate forward solution in all nodes instead the selected ones only.\n");
136 printf(
"\t--fwd name save the solution here\n");
137 printf(
"\t--help print this info.\n");
138 printf(
"\t--version print version info.\n\n");
144QString ComputeFwdSettings::build_command_line(QString old, QString new_item)
146 if (!new_item.isEmpty() && new_item.size() > 0) {
147 if (!old.isEmpty()) {
157bool ComputeFwdSettings::check_unrecognized_args(
int argc,
char **argv)
162 printf(
"Unrecognized arguments : ");
163 for (k = 1; k < argc; k++)
164 printf(
"%s ",argv[k]);
166 qCritical(
"Check the command line.");
174bool ComputeFwdSettings::check_args (
int *argc,
char **argv)
179 if ((last = strrchr(argv[0],
'/')) == NULL)
184 for (
int k = 0; k < *argc; k++) {
186 if (strcmp(argv[k],
"--version") == 0) {
187 printf(
"%s version %s compiled at %s %s\n", argv[0],
PROGRAM_VERSION,__DATE__,__TIME__);
190 else if (strcmp(argv[k],
"--help") == 0) {
194 else if (strcmp(argv[k],
"--meg") == 0) {
198 else if (strcmp(argv[k],
"--eeg") == 0) {
202 else if (strcmp(argv[k],
"--grad") == 0) {
206 else if (strcmp(argv[k],
"--all") == 0) {
210 else if (strcmp(argv[k],
"--accurate") == 0) {
214 else if (strcmp(argv[k],
"--fixed") == 0) {
218 else if (strcmp(argv[k],
"--src") == 0) {
220 if (k == *argc - 1) {
221 qCritical(
"--src: argument required.");
226 else if (strcmp(argv[k],
"--mri") == 0) {
228 if (k == *argc - 1) {
229 qCritical(
"--mri: argument required.");
236 else if (strcmp(argv[k],
"--trans") == 0) {
238 if (k == *argc - 1) {
239 qCritical(
"--trans: argument required.");
246 else if (strcmp(argv[k],
"--notrans") == 0) {
252 else if (strcmp(argv[k],
"--meas") == 0) {
254 if (k == *argc - 1) {
255 qCritical(
"--meas: argument required.");
260 else if (strcmp(argv[k],
"--bem") == 0) {
262 if (k == *argc - 1) {
263 qCritical(
"--bem: argument required.");
268 else if (strcmp(argv[k],
"--origin") == 0) {
270 if (k == *argc - 1) {
271 qCritical(
"--origin: argument required.");
274 if (sscanf(argv[k+1],
"%f:%f:%f",
r0[
X],
r0[
Y],
r0[
Z]) != 3) {
275 qCritical(
"Could not interpret the origin.");
282 else if (strcmp(argv[k],
"--eegrad") == 0) {
284 if (k == *argc - 1) {
285 qCritical(
"--eegrad: argument required.");
289 qCritical(
"Incomprehensible radius : %s",argv[k+1]);
293 qCritical(
"Radius must be positive");
298 else if (strcmp(argv[k],
"--eegmodels") == 0) {
300 if (k == *argc - 1) {
301 qCritical(
"--eegmodels: argument required.");
306 else if (strcmp(argv[k],
"--eegmodel") == 0) {
308 if (k == *argc - 1) {
309 qCritical(
"--eegmodel: argument required.");
314 else if (strcmp(argv[k],
"--eegscalp") == 0) {
318 else if (strcmp(argv[k],
"--mindist") == 0) {
320 if (k == *argc - 1) {
321 qCritical(
"--mindist: argument required.");
324 if (sscanf(argv[k+1],
"%f",&
mindist) != 1) {
325 qCritical(
"Could not interpret the distance.");
332 else if (strcmp(argv[k],
"--includeall") == 0) {
336 else if (strcmp(argv[k],
"--mindistout") == 0) {
338 if (k == *argc - 1) {
339 qCritical(
"--mindistout: argument required.");
344 else if (strcmp(argv[k],
"--mricoord") == 0) {
348 else if (strcmp(argv[k],
"--fwd") == 0) {
350 if (k == *argc - 1) {
351 qCritical(
"--fwd: argument required.");
356 else if (strcmp(argv[k],
"--label") == 0) {
358 if (k == *argc - 1) {
359 qCritical(
"--label: argument required.");
362 labels.append(QString(argv[k+1]));
366 for (
int p = k; p < k + found; p++)
368 for (
int p = k; p < *argc-found; p++)
369 argv[p] = argv[p+found];
370 *argc = *argc - found;
374 return check_unrecognized_args(*argc,argv);
Compute Forward Setting class declaration.
FIFF file I/O and data structures (raw, epochs, evoked, covariance, forward).
Forward modelling (BEM, MEG/EEG lead fields).
Coordinate transformation description.
FIFFLIB::FiffCoordTrans meg_head_t
virtual ~ComputeFwdSettings()
QSharedPointer< FIFFLIB::FiffInfo > pFiffInfo