v2.0.0
Loading...
Searching...
No Matches
inv_dipole_fit_settings.cpp
Go to the documentation of this file.
1
2
4
5using namespace Eigen;
6using namespace INVLIB;
7
8//=============================================================================================================
9// DEFINE MEMBER METHODS
10//=============================================================================================================
11
16
17//=============================================================================================================
18
20{
21 initMembers();
22
23 if (!check_args(argc,argv))
24 return;
25
27}
28
29//=============================================================================================================
30
34
35//=============================================================================================================
36
37void InvDipoleFitSettings::initMembers()
38{
39 // Init origin
40 r0 << 0.0f,0.0f,0.04f;
41
42 filter.filter_on = true;
43 filter.size = 4096;
44 filter.taper_size = 2048;
45 filter.highpass = 0.0;
47 filter.lowpass = 40.0;
49 filter.eog_highpass = 0.0;
51 filter.eog_lowpass = 40.0;
53
54 accurate = false;
55
56 guess_rad = 0.080f;
57 guess_mindist = 0.010f;
58 guess_exclude = 0.020f;
59 guess_grid = 0.010f;
60
61 grad_std = 5e-13f;
62 mag_std = 20e-15f;
63 eeg_std = 0.2e-6f;
64 diagnoise = false;
65
66 is_raw = false;
67 include_meg = false;
68 include_eeg = false;
69 tmin = -2*BIG_TIME;
70 tmax = 2*BIG_TIME;
71 tstep = -1.0;
72 integ = 0.0;
73 bmin = BIG_TIME;
74 bmax = BIG_TIME;
75 do_baseline = false;
76 setno = 1;
77 verbose = false;
78 omit_data_proj = false;
79
80
81 eeg_sphere_rad = 0.09f;
82 scale_eeg_pos = false;
83 mag_reg = 0.1f;
84 fit_mag_dipoles = false;
85
86 grad_reg = 0.1f;
87 eeg_reg = 0.1f;
88
89 gui = false;
90}
91
92//=============================================================================================================
93
95{
97
98 if (measname.isEmpty()) {
99 qCritical ("Data file name missing. Please specify one using the --meas option.");
100 return;
101 }
102 if (dipname.isEmpty() && bdipname.isEmpty()) {
103 qCritical ("Output file name missing. Please use the --dip or --bdip options to do this.");
104 return;
105 }
106 if (guessname.isEmpty()) {
107 if (bemname.isEmpty() && !guess_surfname.isEmpty() && mriname.isEmpty()) {
108 qCritical ("Please specify the MRI/head coordinate transformation with the --mri option");
109 return;
110 }
111 }
112 if (!include_meg && !include_eeg) {
113 qCritical ("Specify one or both of the --eeg and --meg options");
114 return;
115 }
116 if (!omit_data_proj)
117 projnames.prepend(measname);
118
119 if (!bemname.isEmpty())
120 qInfo("BEM : %s",bemname.toUtf8().data());
121 else {
122 qInfo("Sphere model : origin at (% 7.2f % 7.2f % 7.2f) mm",
123 1000*r0[0],1000*r0[1],1000*r0[2]);
124 }
125 qInfo("Using %s MEG coil definitions.",accurate ? "accurate" : "standard");
126 if (!mriname.isEmpty())
127 qInfo("MRI transform : %s",mriname.toUtf8().data());
128 if (!guessname.isEmpty())
129 qInfo("Guesses : %s",guessname.toUtf8().data());
130 else {
131 if (!guess_surfname.isEmpty())
132 qInfo("Guess space bounded by %s",guess_surfname.toUtf8().data());
133 else
134 qInfo("Spherical guess space, rad = %.1f mm",1000*guess_rad);
135 qInfo("Guess grid : %6.1f mm",1000*guess_grid);
136 if (guess_mindist > 0.0)
137 qInfo("Guess mindist : %6.1f mm",1000*guess_mindist);
138 if (guess_exclude > 0)
139 qInfo("Guess exclude : %6.1f mm",1000*guess_exclude);
140 }
141 qInfo("Data : %s",measname.toUtf8().data());
142 if (projnames.size() > 0) {
143 qInfo("SSP sources :");
144 for (int k = 0; k < projnames.size(); k++)
145 qInfo("\t%s",projnames[k].toUtf8().data());
146 }
147 if (!badname.isEmpty())
148 qInfo("Bad channels : %s",badname.toUtf8().data());
149 if (do_baseline)
150 qInfo("Baseline : %10.2f ... %10.2f ms", 1000*bmin,1000*bmax);
151 if (!noisename.isEmpty()) {
152 qInfo("Noise covariance : %s",noisename.toUtf8().data());
153 if (include_meg) {
154 if (mag_reg > 0.0)
155 qInfo("\tNoise-covariance regularization (mag) : %-5.2f",mag_reg);
156 if (grad_reg > 0.0)
157 qInfo("\tNoise-covariance regularization (grad) : %-5.2f",grad_reg);
158 }
159 if (include_eeg && eeg_reg > 0.0)
160 qInfo("\tNoise-covariance regularization (EEG) : %-5.2f",eeg_reg);
161 }
162 if (fit_mag_dipoles)
163 qInfo("Fit data with magnetic dipoles");
164 if (!dipname.isEmpty())
165 qInfo("dip output : %s",dipname.toUtf8().data());
166 if (!bdipname.isEmpty())
167 qInfo("bdip output : %s",bdipname.toUtf8().data());
168}
169
170//=============================================================================================================
171
172void InvDipoleFitSettings::usage(const char *name)
173{
174 qInfo("usage: %s [options]",name);
175 qInfo("This is a program for sequential single dipole fitting.");
176 qInfo("\nInput data:\n");
177 qInfo("\t--meas name specify an evoked-response data file");
178 qInfo("\t--set no evoked data set number to use (default: 1)");
179 qInfo("\t--bad name take bad channel list from here");
180
181 qInfo("\nModality selection:\n");
182 qInfo("\t--meg employ MEG data in fitting");
183 qInfo("\t--eeg employ EEG data in fitting");
184
185 qInfo("\nTime scale selection:\n");
186 qInfo("\t--tmin time/ms specify the starting analysis time");
187 qInfo("\t--tmax time/ms specify the ending analysis time");
188 qInfo("\t--tstep time/ms specify the time step between frames (default 1/(sampling frequency))");
189 qInfo("\t--integ time/ms specify the time integration for each frame (default 0)");
190
191 qInfo("\nPreprocessing:\n");
192 qInfo("\t--bmin time/ms specify the baseline starting time (evoked data only)");
193 qInfo("\t--bmax time/ms specify the baseline ending time (evoked data only)");
194 qInfo("\t--proj name Load the linear projection from here");
195 qInfo("\t Multiple projections can be specified.");
196 qInfo("\t The data file will be automatically included, unless --noproj is present.");
197 qInfo("\t--noproj Do not load the projection from the data file, just those given with the --proj option.");
198 qInfo("\n\tFiltering (raw data only):\n");
199 qInfo("\t--filtersize size desired filter length (default = %d)",filter.size);
200 qInfo("\t--highpass val/Hz highpass corner (default = %6.1f Hz)",filter.highpass);
201 qInfo("\t--lowpass val/Hz lowpass corner (default = %6.1f Hz)",filter.lowpass);
202 qInfo("\t--lowpassw val/Hz lowpass transition width (default = %6.1f Hz)",filter.lowpass_width);
203 qInfo("\t--filteroff do not filter the data");
204
205 qInfo("\nNoise specification:\n");
206 qInfo("\t--noise name take the noise-covariance matrix from here");
207 qInfo("\t--gradnoise val specify a gradiometer noise value in fT/cm");
208 qInfo("\t--magnoise val specify a magnetometer noise value in fT");
209 qInfo("\t--eegnoise val specify an EEG value in uV");
210 qInfo("\t NOTE: The above will be used only if --noise is missing");
211 qInfo("\t--diagnoise omit off-diagonal terms from the noise-covariance matrix");
212 qInfo("\t--reg amount Apply regularization to the noise-covariance matrix (same fraction for all channels).");
213 qInfo("\t--gradreg amount Apply regularization to the MEG noise-covariance matrix (planar gradiometers, default = %6.2f).",grad_reg);
214 qInfo("\t--magreg amount Apply regularization to the MEG noise-covariance matrix (axial gradiometers and magnetometers, default = %6.2f).",mag_reg);
215 qInfo("\t--eegreg amount Apply regularization to the EEG noise-covariance matrix (default = %6.2f).",eeg_reg);
216
217 qInfo("\nForward model:\n");
218 qInfo("\t--mri name take head/MRI coordinate transform from here (Neuromag MRI description file)");
219 qInfo("\t--bem name BEM model name");
220 qInfo("\t--origin x:y:z/mm use a sphere model with this origin (head coordinates/mm)");
221 qInfo("\t--eegscalp scale the electrode locations to the surface of the scalp when using a sphere model");
222 qInfo("\t--eegmodels name read EEG sphere model specifications from here.");
223 qInfo("\t--eegmodel name name of the EEG sphere model to use (default : Default)");
224 qInfo("\t--eegrad val radius of the scalp surface to use in EEG sphere model (default : %7.1f mm)",1000*eeg_sphere_rad);
225 qInfo("\t--accurate use accurate coil definitions in MEG forward computation");
226
227 qInfo("\nFitting parameters:\n");
228 qInfo("\t--guess name The source space of initial guesses.");
229 qInfo("\t If not present, the values below are used to generate the guess grid.");
230 qInfo("\t--guesssurf name Read the inner skull surface from this fif file to generate the guesses.");
231 qInfo("\t--guessrad value Radius of a spherical guess volume if neither of the above is present (default : %.1f mm)",1000*guess_rad);
232 qInfo("\t--exclude dist/mm Exclude points which are closer than this distance from the CM of the inner skull surface (default = %6.1f mm).",1000*guess_exclude);
233 qInfo("\t--mindist dist/mm Exclude points which are closer than this distance from the inner skull surface (default = %6.1f mm).",1000*guess_mindist);
234 qInfo("\t--grid dist/mm Source space grid size (default = %6.1f mm).",1000*guess_grid);
235 qInfo("\t--magdip Fit magnetic dipoles instead of current dipoles.");
236 qInfo("\nOutput:\n");
237 qInfo("\t--dip name xfit dip format output file name");
238 qInfo("\t--bdip name xfit bdip format output file name");
239 qInfo("\nGeneral:\n");
240 qInfo("\t--gui Enables the gui.");
241 qInfo("\t--help print this info.");
242 qInfo("\t--version print version info.");
243}
244
245//=============================================================================================================
246
247bool InvDipoleFitSettings::check_unrecognized_args(int argc, char **argv)
248{
249 if ( argc > 1 ) {
250 QString args;
251 for (int k = 1; k < argc; k++)
252 args += QString(argv[k]) + " ";
253 qCritical("Unrecognized arguments : %s", args.trimmed().toUtf8().data());
254 return false;
255 }
256 return true;
257}
258
259//=============================================================================================================
260
261bool InvDipoleFitSettings::check_args (int *argc,char **argv)
262{
263 int found;
264 float fval;
265 int ival,filter_size;
266
267 for (int k = 0; k < *argc; k++) {
268 found = 0;
269 if (strcmp(argv[k],"--gui") == 0) {
270 found = 1;
271 gui = true;
272 }
273 else if (strcmp(argv[k],"--version") == 0) {
274 qInfo("%s compiled at %s %s",
275 argv[0],__DATE__,__TIME__);
276 exit(0);
277 }
278 else if (strcmp(argv[k],"--help") == 0) {
279 usage(argv[0]);
280 exit(1);
281 }
282 else if (strcmp(argv[k],"--guess") == 0) {
283 found = 2;
284 if (k == *argc - 1) {
285 qCritical ("--guess: argument required.");
286 return false;
287 }
288 guessname = QString(argv[k+1]);
289 }
290 else if (strcmp(argv[k],"--gsurf") == 0) {
291 found = 2;
292 if (k == *argc - 1) {
293 qCritical ("--gsurf: argument required.");
294 return false;
295 }
296 guess_surfname = QString(argv[k+1]);
297 }
298 else if (strcmp(argv[k],"--guesssurf") == 0) {
299 found = 2;
300 if (k == *argc - 1) {
301 qCritical ("--guesssurf: argument required.");
302 return false;
303 }
304 guess_surfname = QString(argv[k+1]);
305 }
306 else if (strcmp(argv[k],"--guessrad") == 0) {
307 found = 2;
308 if (k == *argc - 1) {
309 qCritical ("--guessrad: argument required.");
310 return false;
311 }
312 if (sscanf(argv[k+1],"%f",&fval) != 1) {
313 qCritical ("Could not interpret the radius.");
314 return false;
315 }
316 if (fval <= 0.0) {
317 qCritical ("Radius should be positive");
318 return false;
319 }
320 guess_rad = fval/1000.0;
321 }
322 else if (strcmp(argv[k],"--mindist") == 0) {
323 found = 2;
324 if (k == *argc - 1) {
325 qCritical ("--mindist: argument required.");
326 return false;
327 }
328 if (sscanf(argv[k+1],"%f",&fval) != 1) {
329 qCritical ("Could not interpret the distance.");
330 return false;
331 }
332 guess_mindist = fval/1000.0;
333 if (guess_mindist <= 0.0)
334 guess_mindist = 0.0;
335 }
336 else if (strcmp(argv[k],"--exclude") == 0) {
337 found = 2;
338 if (k == *argc - 1) {
339 qCritical ("--exclude: argument required.");
340 return false;
341 }
342 if (sscanf(argv[k+1],"%f",&fval) != 1) {
343 qCritical ("Could not interpret the distance.");
344 return false;
345 }
346 guess_exclude = fval/1000.0;
347 if (guess_exclude <= 0.0)
348 guess_exclude = 0.0;
349 }
350 else if (strcmp(argv[k],"--grid") == 0) {
351 found = 2;
352 if (k == *argc - 1) {
353 qCritical ("--grid: argument required.");
354 return false;
355 }
356 if (sscanf(argv[k+1],"%f",&fval) != 1) {
357 qCritical ("Could not interpret the distance.");
358 return false;
359 }
360 if (fval <= 0.0) {
361 qCritical ("Grid spacing should be positive");
362 return false;
363 }
364 guess_grid = guess_grid/1000.0;
365 }
366 else if (strcmp(argv[k],"--mri") == 0) {
367 found = 2;
368 if (k == *argc - 1) {
369 qCritical ("--mri: argument required.");
370 return false;
371 }
372 mriname = QString(argv[k+1]);
373 }
374 else if (strcmp(argv[k],"--bem") == 0) {
375 found = 2;
376 if (k == *argc - 1) {
377 qCritical ("--bem: argument required.");
378 return false;
379 }
380 bemname = QString(argv[k+1]);
381 }
382 else if (strcmp(argv[k],"--accurate") == 0) {
383 found = 1;
384 accurate = true;
385 }
386 else if (strcmp(argv[k],"--meg") == 0) {
387 found = 1;
388 include_meg = true;
389 }
390 else if (strcmp(argv[k],"--eeg") == 0) {
391 found = 1;
392 include_eeg = true;
393 }
394 else if (strcmp(argv[k],"--origin") == 0) {
395 found = 2;
396 if (k == *argc - 1) {
397 qCritical ("--origin: argument required.");
398 return false;
399 }
400 if (sscanf(argv[k+1],"%f:%f:%f",&r0[0],&r0[1],&r0[2]) != 3) {
401 qCritical ("Could not interpret the origin.");
402 return false;
403 }
404 r0[0] = r0[0]/1000.0f;
405 r0[1] = r0[1]/1000.0f;
406 r0[2] = r0[2]/1000.0f;
407 }
408 else if (strcmp(argv[k],"--eegrad") == 0) {
409 found = 2;
410 if (k == *argc - 1) {
411 qCritical ("--eegrad: argument required.");
412 return false;
413 }
414 if (sscanf(argv[k+1],"%g",&eeg_sphere_rad) != 1) {
415 qCritical () << "Incomprehensible radius:" << argv[k+1];
416 return false;
417 }
418 if (eeg_sphere_rad <= 0) {
419 qCritical ("Radius must be positive");
420 return false;
421 }
423 }
424 else if (strcmp(argv[k],"--eegmodels") == 0) {
425 found = 2;
426 if (k == *argc - 1) {
427 qCritical ("--eegmodels: argument required.");
428 return false;
429 }
430 eeg_model_file = QString(argv[k+1]);
431 }
432 else if (strcmp(argv[k],"--eegmodel") == 0) {
433 found = 2;
434 if (k == *argc - 1) {
435 qCritical ("--eegmodel: argument required.");
436 return false;
437 }
438 eeg_model_name = QString(argv[k+1]);
439 }
440 else if (strcmp(argv[k],"--eegscalp") == 0) {
441 found = 1;
442 scale_eeg_pos = true;
443 }
444 else if (strcmp(argv[k],"--meas") == 0) {
445 found = 2;
446 if (k == *argc - 1) {
447 qCritical ("--meas: argument required.");
448 return false;
449 }
450 measname = QString(argv[k+1]);
451 is_raw = false;
452 }
453 else if (strcmp(argv[k],"--raw") == 0) {
454 found = 2;
455 if (k == *argc - 1) {
456 qCritical ("--raw: argument required.");
457 return false;
458 }
459 measname = QString(argv[k+1]);
460 is_raw = true;
461 }
462 else if (strcmp(argv[k],"--proj") == 0) {
463 found = 2;
464 if (k == *argc - 1) {
465 qCritical ("--proj: argument required.");
466 return false;
467 }
468 projnames.append(QString(argv[k+1]));
469 }
470 else if (strcmp(argv[k],"--noproj") == 0) {
471 found = 1;
472 omit_data_proj = true;
473 }
474 else if (strcmp(argv[k],"--bad") == 0) {
475 found = 2;
476 if (k == *argc - 1) {
477 qCritical ("--bad: argument required.");
478 return false;
479 }
480 badname = QString(argv[k+1]);
481 }
482 else if (strcmp(argv[k],"--noise") == 0) {
483 found = 2;
484 if (k == *argc - 1) {
485 qCritical ("--noise: argument required.");
486 return false;
487 }
488 noisename = QString(argv[k+1]);
489 }
490 else if (strcmp(argv[k],"--gradnoise") == 0) {
491 found = 2;
492 if (k == *argc - 1) {
493 qCritical ("--gradnoise: argument required.");
494 return false;
495 }
496 if (sscanf(argv[k+1],"%g",&fval) != 1) {
497 qCritical() << "Incomprehensible value:" << argv[k+1];
498 return false;
499 }
500 if (fval < 0.0) {
501 qCritical ("Value should be positive");
502 return false;
503 }
504 grad_std = 1e-13*fval;
505 }
506 else if (strcmp(argv[k],"--magnoise") == 0) {
507 found = 2;
508 if (k == *argc - 1) {
509 qCritical ("--magnoise: argument required.");
510 return false;
511 }
512 if (sscanf(argv[k+1],"%g",&fval) != 1) {
513 qCritical() << "Incomprehensible value:" << argv[k+1];
514 return false;
515 }
516 if (fval < 0.0) {
517 qCritical ("Value should be positive");
518 return false;
519 }
520 mag_std = 1e-15*fval;
521 }
522 else if (strcmp(argv[k],"--eegnoise") == 0) {
523 found = 2;
524 if (k == *argc - 1) {
525 qCritical ("--eegnoise: argument required.");
526 return false;
527 }
528 if (sscanf(argv[k+1],"%g",&fval) != 1) {
529 qCritical () << "Incomprehensible value:" << argv[k+1];
530 return false;
531 }
532 if (fval < 0.0) {
533 qCritical ("Value should be positive");
534 return false;
535 }
536 eeg_std = 1e-6*fval;
537 }
538 else if (strcmp(argv[k],"--diagnoise") == 0) {
539 found = 1;
540 diagnoise = true;
541 }
542 else if (strcmp(argv[k],"--eegreg") == 0) {
543 found = 2;
544 if (k == *argc - 1) {
545 qCritical ("--eegreg: argument required.");
546 return false;
547 }
548 if (sscanf(argv[k+1],"%g",&fval) != 1) {
549 qCritical () << "Incomprehensible value:" << argv[k+1];
550 return false;
551 }
552 if (fval < 0 || fval > 1) {
553 qCritical ("Regularization value should be positive and smaller than one.");
554 return false;
555 }
556 eeg_reg = fval;
557 }
558 else if (strcmp(argv[k],"--magreg") == 0) {
559 found = 2;
560 if (k == *argc - 1) {
561 qCritical ("--magreg: argument required.");
562 return false;
563 }
564 if (sscanf(argv[k+1],"%g",&fval) != 1) {
565 qCritical () << "Incomprehensible value:" << argv[k+1];
566 return false;
567 }
568 if (fval < 0 || fval > 1) {
569 qCritical ("Regularization value should be positive and smaller than one.");
570 return false;
571 }
572 mag_reg = fval;
573 }
574 else if (strcmp(argv[k],"--gradreg") == 0) {
575 found = 2;
576 if (k == *argc - 1) {
577 qCritical ("--gradreg: argument required.");
578 return false;
579 }
580 if (sscanf(argv[k+1],"%g",&fval) != 1) {
581 qCritical () << "Incomprehensible value:" << argv[k+1] ;
582 return false;
583 }
584 if (fval < 0 || fval > 1) {
585 qCritical ("Regularization value should be positive and smaller than one.");
586 return false;
587 }
588 grad_reg = fval;
589 }
590 else if (strcmp(argv[k],"--reg") == 0) {
591 found = 2;
592 if (k == *argc - 1) {
593 qCritical ("--reg: argument required.");
594 return false;
595 }
596 if (sscanf(argv[k+1],"%g",&fval) != 1) {
597 qCritical () << "Incomprehensible value:" << argv[k+1];
598 return false;
599 }
600 if (fval < 0 || fval > 1) {
601 qCritical ("Regularization value should be positive and smaller than one.");
602 return false;
603 }
604 grad_reg = fval;
605 mag_reg = fval;
606 eeg_reg = fval;
607 }
608 else if (strcmp(argv[k],"--tstep") == 0) {
609 found = 2;
610 if (k == *argc - 1) {
611 qCritical ("--tstep: argument required.");
612 return false;
613 }
614 if (sscanf(argv[k+1],"%g",&fval) != 1) {
615 qCritical() << "Incomprehensible tstep:" << argv[k+1];
616 return false;
617 }
618 if (fval < 0.0) {
619 qCritical ("Time step should be positive");
620 return false;
621 }
622 tstep = fval/1000.0;
623 }
624 else if (strcmp(argv[k],"--integ") == 0) {
625 found = 2;
626 if (k == *argc - 1) {
627 qCritical ("--integ: argument required.");
628 return false;
629 }
630 if (sscanf(argv[k+1],"%g",&fval) != 1) {
631 qCritical() << "Incomprehensible integration time:" << argv[k+1];
632 return false;
633 }
634 if (fval <= 0.0) {
635 qCritical ("Integration time should be positive.");
636 return false;
637 }
638 integ = fval/1000.0f;
639 }
640 else if (strcmp(argv[k],"--tmin") == 0) {
641 found = 2;
642 if (k == *argc - 1) {
643 qCritical ("--tmin: argument required.");
644 return false;
645 }
646 if (sscanf(argv[k+1],"%g",&fval) != 1) {
647 qCritical() << "Incomprehensible tmin:" << argv[k+1];
648 return false;
649 }
650 tmin = fval/1000.0f;
651 }
652 else if (strcmp(argv[k],"--tmax") == 0) {
653 found = 2;
654 if (k == *argc - 1) {
655 qCritical ("--tmax: argument required.");
656 return false;
657 }
658 if (sscanf(argv[k+1],"%g",&fval) != 1) {
659 qCritical() << "Incomprehensible tmax:" << argv[k+1];
660 return false;
661 }
662 tmax = fval/1000.0;
663 }
664 else if (strcmp(argv[k],"--bmin") == 0) {
665 found = 2;
666 if (k == *argc - 1) {
667 qCritical ("--bmin: argument required.");
668 return false;
669 }
670 if (sscanf(argv[k+1],"%g",&fval) != 1) {
671 qCritical() << "Incomprehensible bmin:" << argv[k+1];
672 return false;
673 }
674 bmin = fval/1000.0f;
675 }
676 else if (strcmp(argv[k],"--bmax") == 0) {
677 found = 2;
678 if (k == *argc - 1) {
679 qCritical ("--bmax: argument required.");
680 return false;
681 }
682 if (sscanf(argv[k+1],"%g",&fval) != 1) {
683 qCritical() << "Incomprehensible bmax:" << argv[k+1];
684 return false;
685 }
686 bmax = fval/1000.0f;
687 }
688 else if (strcmp(argv[k],"--set") == 0) {
689 found = 2;
690 if (k == *argc - 1) {
691 qCritical ("--set: argument required.");
692 return false;
693 }
694 if (sscanf(argv[k+1],"%d",&setno) != 1) {
695 qCritical() << "Incomprehensible data set number:" << argv[k+1];
696 return false;
697 }
698 if (setno <= 0) {
699 qCritical ("Data set number must be > 0");
700 return false;
701 }
702 }
703 else if (strcmp(argv[k],"--filteroff") == 0) {
704 found = 1;
705 filter.filter_on = false;
706 }
707 else if (strcmp(argv[k],"--lowpass") == 0) {
708 found = 2;
709 if (k == *argc - 1) {
710 qCritical ("--lowpass: argument required.");
711 return false;
712 }
713 if (sscanf(argv[k+1],"%g",&fval) != 1) {
714 qCritical() << "Illegal number:" << argv[k+1];
715 return false;
716 }
717 if (fval <= 0) {
718 qCritical ("Lowpass corner must be positive");
719 return false;
720 }
721 filter.lowpass = fval;
722 }
723 else if (strcmp(argv[k],"--lowpassw") == 0) {
724 found = 2;
725 if (k == *argc - 1) {
726 qCritical ("--lowpassw: argument required.");
727 return false;
728 }
729 if (sscanf(argv[k+1],"%g",&fval) != 1) {
730 qCritical() << "Illegal number:" << argv[k+1];
731 return false;
732 }
733 if (fval <= 0) {
734 qCritical ("Lowpass width must be positive");
735 return false;
736 }
737 filter.lowpass_width = fval;
738 }
739 else if (strcmp(argv[k],"--highpass") == 0) {
740 found = 2;
741 if (k == *argc - 1) {
742 qCritical ("--highpass: argument required.");
743 return false;
744 }
745 if (sscanf(argv[k+1],"%g",&fval) != 1) {
746 qCritical() << "Illegal number:" << argv[k+1];
747 return false;
748 }
749 if (fval <= 0) {
750 qCritical ("Highpass corner must be positive");
751 return false;
752 }
753 filter.highpass = fval;
754 }
755 else if (strcmp(argv[k],"--filtersize") == 0) {
756 found = 2;
757 if (k == *argc - 1) {
758 qCritical ("--filtersize: argument required.");
759 return false;
760 }
761 if (sscanf(argv[k+1],"%d",&ival) != 1) {
762 qCritical() << "Illegal number:" << argv[k+1];
763 return false;
764 }
765 if (ival < 1024) {
766 qCritical ("Filtersize should be at least 1024.");
767 return false;
768 }
769 for (filter_size = 1024; filter_size < ival; filter_size = 2*filter_size)
770 ;
771 filter.size = filter_size;
772 filter.taper_size = filter_size/2;
773 }
774 else if (strcmp(argv[k],"--magdip") == 0) {
775 found = 1;
776 fit_mag_dipoles = true;
777 }
778 else if (strcmp(argv[k],"--dip") == 0) {
779 found = 2;
780 if (k == *argc - 1) {
781 qCritical ("--dip: argument required.");
782 return false;
783 }
784 dipname = QString(argv[k+1]);
785 }
786 else if (strcmp(argv[k],"--bdip") == 0) {
787 found = 2;
788 if (k == *argc - 1) {
789 qCritical ("--bdip: argument required.");
790 return false;
791 }
792 bdipname = QString(argv[k+1]);
793 }
794 else if (strcmp(argv[k],"--verbose") == 0) {
795 found = 1;
796 verbose = true;
797 }
798 if (found) {
799 for (int p = k; p < *argc-found; p++)
800 argv[p] = argv[p+found];
801 *argc = *argc - found;
802 k = k - found;
803 }
804 }
805 return check_unrecognized_args(*argc,argv);
806}
Dipole Fit Setting class declaration.
#define BIG_TIME
Inverse source estimation (MNE, dSPM, sLORETA, dipole fitting).