2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/art_readin.cpp $
5 $LastChangedRevision: 85 $
6 $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
8 ***********************************************************
10 READ IN INPUT OPTIONS AND SET DEFAULTS
27 /// !!! list & weight never used !!!
29 void art_class::readin(REAL* recon, INTEGER* list, REAL* weight, BOOLEAN* flag)
31 static const INTEGER bound = CHAR2INT('b', 'o', 'u', 'n');
32 static const INTEGER vari = CHAR2INT('v', 'a', 'r', 'i');
33 static const INTEGER noise = CHAR2INT('n', 'o', 'i', 's');
34 static const INTEGER art2 = CHAR2INT('a', 'r', 't', '2');
35 static const INTEGER cons = CHAR2INT('c', 'o', 'n', 's');
36 static const INTEGER bart = CHAR2INT('b', 'a', 'r', 't');
37 static const INTEGER fixed = CHAR2INT('f', 'i', 'x', 'e');
39 static const INTEGER norm = CHAR2INT('n', 'o', 'r', 'm');
40 static const INTEGER rela = CHAR2INT('r', 'e', 'l', 'a');
41 static const INTEGER art4 = CHAR2INT('a', 'r', 't', '4');
42 static const INTEGER tole = CHAR2INT('t', 'o', 'l', 'e');
43 static const INTEGER conr = CHAR2INT('c', 'o', 'n', 'r');
44 static const INTEGER step = CHAR2INT('s', 't', 'e', 'p');
45 static const INTEGER noml = CHAR2INT('n', 'o', 'm', 'l');
46 static const INTEGER baye = CHAR2INT('b', 'a', 'y', 'e');
47 static const INTEGER art3 = CHAR2INT('a', 'r', 't', '3');
55 //REAL* delta; ///!!!!
57 // DEFAULT INITIALIZATION
62 //ArtIn.kount = GeoPar.prjnum * GeoPar.usrays; // change nrays to usrays. hstau 7/2003
64 if (RaySel.useray) // select user
65 ArtIn.kount = GeoPar.prjnum * GeoPar.usrays;
68 ArtIn.kount = GeoPar.prjnum * GeoPar.snrays;
69 } // set value to kount for select user or select snark. Wei 11/2004
89 word = InFile.getwrd(TRUE, &eol, exp0, 3);
94 "\n **** error - one and only one of the following options must be specified : art3, art4, bayesian***");
102 fprintf(output, "\n art3 method");
105 else if (word == art4)
108 fprintf(output, "\n art4 method");
114 ArtIn.snr = InFile.getnum(FALSE, &eol);
118 "\n **** error - must specify the snr in Bayesian option***");
123 ArtIn.snr2 = ArtIn.snr * ArtIn.snr;
124 if (ArtIn.snr2 <= Consts.zero)
127 "\n **** error - snr**2= %10.6f must be greater than %12.4e***",
128 ArtIn.snr2, Consts.zero);
134 fprintf(output, "\n Bayesian method with snr = %9.5f",
139 { rela, norm, tole };
140 word = InFile.getwrd(FALSE, &eol, exp1, 3);
144 fprintf(output, "\n relaxation parameter is 1.0");
145 fprintf(output, "\n norm is 2");
146 fprintf(output, "\n tolerance is 0.0");
155 word = InFile.getwrd(FALSE, &eol, exp2, 2);
160 "\n **** error - with the option relaxation, one and only one of the following options must be specified : constant or variable***");
167 ArtIn.relax = InFile.getnum(FALSE, &eol);
172 "\n **** error - must specify the relaxation constant***");
178 fprintf(output, "\n relaxation parameter is %9.4f",
185 ArtIn.rconsf = FALSE;
186 fprintf(output, "\n relaxation parameter is variable");
191 word = InFile.getwrd(FALSE, &eol, exp1a, 2);
195 else if (word == tole)
199 fprintf(output, "\n norm is 2");
200 fprintf(output, "\n tolerance is 0.0");
202 // eol: read next line
206 else if (word == norm)
208 L10: ArtIn.p = InFile.getint(FALSE, &eol);
213 "\n **** error - must specify the norm***");
217 else if (ArtIn.p < 0)
219 fprintf(output, "\n norm cannot be negative");
225 fprintf(output, "\n norm is %5i", ArtIn.p);
230 word = InFile.getwrd(FALSE, &eol, exp1b, 1);
236 fprintf(output, "\n tolerance is 0.0");
238 // eol: read next line
247 { fixed, vari, noise };
248 word = InFile.getwrd(FALSE, &eol, exp3, 3);
253 "\n **** error - with the option tolerance, one and only one of the following options must be specified : fixed, variable, or noise***");
260 ArtIn.toler = InFile.getnum(FALSE, &eol);
265 "\n **** error - must specify tolerance ***");
270 else if (ArtIn.toler < 0.0)
273 "\n **** error - tolerance can not be less than 0.0***");
280 fprintf(output, "\n tolerance is %9.4f", ArtIn.toler);
284 else if (word == vari)
286 ArtIn.tolerf = FALSE;
287 fprintf(output, "\n tolerance is variable");
293 ArtIn.ct = InFile.getnum(FALSE, &eol);
298 "\n **** error - must specify tolerance ***");
303 else if (ArtIn.ct < 0.0)
306 "\n **** error - tolerance can not be less than 0.0***");
314 "\n tolerance is data dependent, noise factor%9.4f",
325 word = InFile.getwrd(TRUE, &eol, exp4, 1);
330 "\n **** error - keyword constraint is missing***");
336 { art2, bound, bart };
338 word = InFile.getwrd(FALSE, &eol, exp5, 3);
343 "\n **** error - with the option constraint, one and only one of the following options must be specified : art2, bound, or bart***");
351 fprintf(output, "\n constraint art2 way");
354 else if (word == bound)
357 fprintf(output, "\n constraint set to boundaries");
363 if (!(Modefl.lofl && Modefl.upfl))
366 "\n *** error - both upfl and lofl must be on when bart is specified***");
371 fprintf(output, "\n constraint bart");
376 { conr, step, noml };
377 word = InFile.getwrd(FALSE, &eol, exp6, 3);
381 fprintf(output, "\n relaxation constraints with cr = 1.0");
382 fprintf(output, "\n picture is not normalized");
384 // finished reading input
390 word = InFile.getwrd(FALSE, &eol, exp7, 2);
395 "\n **** error - with the option conrelax, one and only one of the following options must be specified : constant or variable***");
402 ArtIn.cr = InFile.getnum(FALSE, &eol);
407 "\n **** error - must specify constraint relaxation constant***");
411 fprintf(output, "\n relax constraints with cr= %9.4f",
415 { //variable relax constaints
417 fprintf(output, "\n relax constraints with variable cr");
422 word = InFile.getwrd(FALSE, &eol, exp6a, 2);
426 else if (word == noml)
430 fprintf(output, "\n picture is not normalized");
434 } // constraint relaxation
436 else if (word == step)
438 L30: ArtIn.kount = InFile.getint(FALSE, &eol);
442 fprintf(output, "\n **** error - must specify kount***");
446 else if (ArtIn.kount <= 0)
449 "\n **** error - kount can not be less than 0 **");
456 word = InFile.getwrd(FALSE, &eol, exp6b, 1);
462 fprintf(output, "\n picture is not normalized");
471 "\n picture is normalized to %9.4f after each iteration",
474 L40: if (!ArtIn.art3f)
477 // ALLOCATE AND INITIALIZE DUAL VARIABLES IN ART4
481 ArtIn.totalRays = new REAL[GeoPar.nrays * GeoPar.prjnum];
482 for (i = 0; i < (GeoPar.nrays * GeoPar.prjnum); i++)
484 ArtIn.totalRays[i] = 0.0;
488 fprintf(output, "\n %5i rays are used for each iteration",
493 fprintf(output, "\n lower constraint = %9.4f", Modefl.lower);
497 fprintf(output, "\n upper constraint = %9.4f", Modefl.upper);