Blame view

options.h 18.3 KB
3f56f1f9   dmayerich   initial commit
1
2
3
  //AnyOption for command-line processing
  //#include "anyoption.h"
  
d6f53e68   dmayerich   rts organization
4
  #include "rts/optics/material.h"
3f56f1f9   dmayerich   initial commit
5
6
7
  
  #include "nearfield.h"
  #include "microscope.h"
3f36b18e   David Mayerich   Adding planewave ...
8
  #include "rts/visualization/colormap.h"
3f56f1f9   dmayerich   initial commit
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  #include "fileout.h"
  //extern nearfieldStruct* NF;
  extern microscopeStruct* SCOPE;
  extern fileoutStruct gFileOut;
  
  //default values
  #include "defaults.h"
  
  #include <string>
  #include <sstream>
  #include <fstream>
  #include <limits>
  using namespace std;
  
  #include <boost/program_options.hpp>
  namespace po = boost::program_options;
  
51b6469a   dmayerich   added look-up tables
26
  extern bool verbose;
3f36b18e   David Mayerich   Adding planewave ...
27
  extern bool gui;
51b6469a   dmayerich   added look-up tables
28
29
30
31
32
  
  
  
  static void lNearfield(po::variables_map vm)
  {
3f36b18e   David Mayerich   Adding planewave ...
33
34
35
36
37
38
      //test to see if we are running a vector field simulation
      bool vectorField = false;
      if(vm.count("vector"))
          vectorField = true;
      SCOPE->scalarSim = !vectorField;
  
51b6469a   dmayerich   added look-up tables
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
  	//test to see if we are simulating a plane wave
  	bool planeWave = DEFAULT_PLANEWAVE;
  	if(vm.count("plane-wave"))
  		planeWave = !planeWave;
  	SCOPE->nf.planeWave = planeWave;
  
  	//get the incident field amplitude
  	SCOPE->nf.A = vm["amplitude"].as<ptype>();
  
  	//get the condenser parameters
      SCOPE->nf.condenser[0] = DEFAULT_CONDENSER_MIN;
      SCOPE->nf.condenser[1] = DEFAULT_CONDENSER_MAX;
  
      if(vm.count("condenser"))
      {
          vector<ptype> cparams = vm["condenser"].as< vector<ptype> >();
  
          if(cparams.size() == 1)
              SCOPE->nf.condenser[1] = cparams[0];
          else
          {
              SCOPE->nf.condenser[0] = cparams[0];
              SCOPE->nf.condenser[1] = cparams[1];
          }
      }
  
  
  	//get the focal rtsPoint position
      SCOPE->nf.focus[0] = DEFAULT_FOCUS_X;
      SCOPE->nf.focus[1] = DEFAULT_FOCUS_Y;
      SCOPE->nf.focus[2] = DEFAULT_FOCUS_Z;
      if(vm.count("focus"))
      {
          vector<ptype> fpos = vm["focus"].as< vector<ptype> >();
          if(fpos.size() != 3)
          {
              cout<<"BIMSIM Error - the incident focal point is incorrectly specified; it must have three components."<<endl;
              exit(1);
          }
          SCOPE->nf.focus[0] = fpos[0];
          SCOPE->nf.focus[1] = fpos[1];
          SCOPE->nf.focus[2] = fpos[2];
      }
  
  	//get the incident light direction (k-vector)
  	bsVector spherical(1, 0, 0);
  
      //if a k-vector is specified
      if(vm.count("k"))
      {
          vector<ptype> kvec = vm["k"].as< vector<ptype> >();
          if(kvec.size() != 2)
          {
              cout<<"BIMSIM Error - k-vector is not specified correctly: it must contain two elements"<<endl;
              exit(1);
          }
          spherical[1] = kvec[0];
          spherical[2] = kvec[1];
      }
  	SCOPE->nf.k = spherical.sph2cart();
  
  
      //incident field order
      SCOPE->nf.m = vm["field-order"].as<int>();
  
      //number of Monte-Carlo samples
      SCOPE->nf.nWaves = vm["samples"].as<int>();
  
  	//random number seed for Monte-Carlo samples
  	if(vm.count("seed"))
  		srand(vm["seed"].as<unsigned int>());
  
  
  
  }
  
  
  static void loadOutputParams(po::variables_map vm)
  {
      //append simulation results to previous binary files
      gFileOut.append = DEFAULT_APPEND;
      if(vm.count("append"))
          gFileOut.append = true;
  
  	//image parameters
  	//component of the field to be saved
  	std::string fieldStr;
      fieldStr = vm["output-type"].as<string>();
  
      if(fieldStr == "magnitude")
          gFileOut.field = fileoutStruct::fieldMag;
      else if(fieldStr == "intensity")
          gFileOut.field = fileoutStruct::fieldIntensity;
      else if(fieldStr == "polarization")
          gFileOut.field = fileoutStruct::fieldPolar;
      else if(fieldStr == "imaginary")
          gFileOut.field = fileoutStruct::fieldImag;
      else if(fieldStr == "real")
          gFileOut.field = fileoutStruct::fieldReal;
      else if(fieldStr == "angular-spectrum")
          gFileOut.field = fileoutStruct::fieldAngularSpectrum;
  
  
  	//image file names
  	gFileOut.intFile = vm["intensity"].as<string>();
  	gFileOut.absFile = vm["absorbance"].as<string>();
  	gFileOut.transFile = vm["transmittance"].as<string>();
  	gFileOut.nearFile = vm["near-field"].as<string>();
  	gFileOut.farFile = vm["far-field"].as<string>();
  
  	//colormap
  	std::string cmapStr;
      cmapStr = vm["colormap"].as<string>();
      if(cmapStr == "brewer")
          gFileOut.colormap = rts::cmBrewer;
      else if(cmapStr == "gray")
          gFileOut.colormap = rts::cmGrayscale;
      else
          cout<<"color-map value not recognized (using default): "<<cmapStr<<endl;
  }
  
  void lFlags(po::variables_map vm, po::options_description desc)
  {
      //display help and exit
  	if(vm.count("help"))
  	{
  		cout<<desc<<endl;
  		exit(1);
  	}
  
      //flag for verbose output
  	if(vm.count("verbose"))
          verbose = true;
  
      if(vm.count("recursive"))
      {
          SCOPE->nf.lut_us = false;
          SCOPE->nf.lut_uf = false;
      }
      else if(vm.count("recursive-us"))
      {
          SCOPE->nf.lut_us = false;
      }
      else if(vm.count("lut-uf"))
      {
          SCOPE->nf.lut_uf = true;
      }
3f36b18e   David Mayerich   Adding planewave ...
186
187
188
189
  
      //gui
      if(vm.count("gui"))
          gui = true;
51b6469a   dmayerich   added look-up tables
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
  }
  
  void lWavelength(po::variables_map vm)
  {
      //load the wavelength
  	if(vm.count("nu"))
  	{
  		//wavelength is given in wavenumber - transform and flag
  		SCOPE->nf.lambda = 10000/vm["nu"].as<ptype>();
  		gFileOut.wavenumber = true;
  	}
  	//otherwise we are using lambda = wavelength
  	else
  	{
  		SCOPE->nf.lambda = vm["lambda"].as<ptype>();
  		gFileOut.wavenumber = false;
  	}
  }
  
  static void lSpheres(string sphereList)
3f56f1f9   dmayerich   initial commit
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
  {
      /*This function loads a list of sphere given in the string sphereList
          The format is:
              x y z a m
          where
              x, y, z = sphere position (required)
              a = sphere radius (required)
              m = material ID (optional) */
  
      std::stringstream ss(sphereList);
  
      while(!ss.eof())
      {
          //create a new sphere
          sphere newS;
  
          //get the sphere data
          ss>>newS.p[0];
          ss>>newS.p[1];
          ss>>newS.p[2];
          ss>>newS.a;
  
          if(ss.peek() != '\n')
              ss>>newS.iMaterial;
  
          //add the new sphere to the sphere vector
          SCOPE->nf.sVector.push_back(newS);
  
          //ignore the rest of the line
          ss.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
  
          //check out the next element (this should set the EOF error flag)
          ss.peek();
      }
51b6469a   dmayerich   added look-up tables
244
  }
3f56f1f9   dmayerich   initial commit
245
  
51b6469a   dmayerich   added look-up tables
246
247
248
249
250
251
252
  void lSpheres(po::variables_map vm)
  {
      //if a sphere is specified at the command line
      if(vm.count("spheres"))
      {
          //convert the sphere to a string
          vector<ptype> sdesc = vm["spheres"].as< vector<ptype> >();
3f56f1f9   dmayerich   initial commit
253
  
51b6469a   dmayerich   added look-up tables
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
          //compute the number of spheres specified
          unsigned int nS;
          if(sdesc.size() <= 5)
              nS = 1;
          else
          {
              //if the number of parameters is divisible by 4, compute the number of spheres
              if(sdesc.size() % 5 == 0)
                  nS = sdesc.size() / 5;
              else
              {
                  cout<<"BIMSIM Error: Invalid number of sphere parameters."<<endl;
                  exit(1);
              }
          }
3f56f1f9   dmayerich   initial commit
269
  
51b6469a   dmayerich   added look-up tables
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
          stringstream ss;
  
          //for each sphere
          for(unsigned int s=0; s<nS; s++)
          {
              //compute the number of sphere parameters
              unsigned int nP;
              if(nS == 1) nP = sdesc.size();
              else nP = 5;
  
              //store each parameter as a string
              for(unsigned int i=0; i<nP; i++)
              {
                  ss<<sdesc[s*5 + i]<<" ";
              }
              ss<<endl;
          }
  
  
  
          //convert the string to a sphere list
          lSpheres(ss.str());
      }
3f56f1f9   dmayerich   initial commit
293
  
3f56f1f9   dmayerich   initial commit
294
295
296
      //if a files are specified
      if(vm.count("sphere-file"))
      {
51b6469a   dmayerich   added look-up tables
297
  
3f56f1f9   dmayerich   initial commit
298
299
          vector<string> filenames = vm["sphere-file"].as< vector<string> >();
          //load each file
274c3d2b   dmayerich   fixed visual stud...
300
          for(unsigned int iS=0; iS<filenames.size(); iS++)
3f56f1f9   dmayerich   initial commit
301
302
303
304
305
306
307
308
309
310
311
312
313
          {
              //load the file into a string
              std::ifstream ifs(filenames[iS].c_str());
  
              if(!ifs)
              {
                  cout<<"Error loading sphere file."<<endl;
                  exit(1);
              }
  
              std::string instr((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
  
              //load the list of spheres from a string
51b6469a   dmayerich   added look-up tables
314
              lSpheres(instr);
3f56f1f9   dmayerich   initial commit
315
316
317
          }
      }
  
51b6469a   dmayerich   added look-up tables
318
319
      //make sure the appropriate materials are loaded
      unsigned int nS = SCOPE->nf.sVector.size();
3f56f1f9   dmayerich   initial commit
320
  
51b6469a   dmayerich   added look-up tables
321
322
323
324
325
326
327
328
      //for each sphere
      for(unsigned int s = 0; s<nS; s++)
      {
          //make sure the corresponding material exists
          if(SCOPE->nf.sVector[s].iMaterial + 1 > SCOPE->nf.mVector.size())
          {
              //otherwise output an error
              cout<<"BIMSIM Error - A material is not loaded for sphere "<<s+1<<"."<<endl;
3f36b18e   David Mayerich   Adding planewave ...
329
330
              cout<<"Material requested: "<<SCOPE->nf.sVector[s].iMaterial + 1<<endl;
              cout<<"Number of materials: "<<SCOPE->nf.mVector.size()<<endl;
51b6469a   dmayerich   added look-up tables
331
332
              exit(1);
          }
3f56f1f9   dmayerich   initial commit
333
334
335
      }
  }
  
51b6469a   dmayerich   added look-up tables
336
  static void lMaterials(po::variables_map vm)
3f56f1f9   dmayerich   initial commit
337
338
339
340
341
  {
  	//if materials are specified at the command line
  	if(vm.count("materials"))
  	{
  		vector<ptype> matVec = vm["materials"].as< vector<ptype> >();
51b6469a   dmayerich   added look-up tables
342
343
344
345
346
347
  		if(matVec.size() == 1)
  		{
  			rts::material<ptype> newM(SCOPE->nf.lambda, matVec[0], 0);
  			SCOPE->nf.mVector.push_back(newM);
  		}
  		else if(matVec.size() %2 != 0)
3f56f1f9   dmayerich   initial commit
348
349
350
351
  		{
  			cout<<"BIMSim Error: materials must be specified in n, k pairs"<<endl;
  			exit(1);
  		}
51b6469a   dmayerich   added look-up tables
352
  		else
3f56f1f9   dmayerich   initial commit
353
  		{
274c3d2b   dmayerich   fixed visual stud...
354
  			for(unsigned int i=0; i<matVec.size(); i+=2)
51b6469a   dmayerich   added look-up tables
355
356
357
358
  			{
  				rts::material<ptype> newM(SCOPE->nf.lambda, matVec[i], matVec[i+1]);
  				SCOPE->nf.mVector.push_back(newM);
  			}
3f56f1f9   dmayerich   initial commit
359
360
  		}
  	}
3f56f1f9   dmayerich   initial commit
361
362
363
364
365
  
  	//if file names are specified, load the materials
  	if(vm.count("material-file"))
  	{
          vector<string> filenames = vm["material-file"].as< vector<string> >();
274c3d2b   dmayerich   fixed visual stud...
366
          for(unsigned int i=0; i<filenames.size(); i++)
3f56f1f9   dmayerich   initial commit
367
368
          {
              //load the file into a string
3f36b18e   David Mayerich   Adding planewave ...
369
              //std::ifstream ifs(filenames[i].c_str());
3f56f1f9   dmayerich   initial commit
370
  
3f36b18e   David Mayerich   Adding planewave ...
371
              //std::string instr((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
3f56f1f9   dmayerich   initial commit
372
373
  
              //load the list of spheres from a string
3f36b18e   David Mayerich   Adding planewave ...
374
375
              rts::material<ptype> newM(filenames[i].c_str());
              //newM.fromStr(instr, "");
3f56f1f9   dmayerich   initial commit
376
377
378
379
380
381
              SCOPE->nf.mVector.push_back(newM);
          }
  	}
  
  }
  
51b6469a   dmayerich   added look-up tables
382
  static void lOptics(po::variables_map vm)
3f56f1f9   dmayerich   initial commit
383
  {
51b6469a   dmayerich   added look-up tables
384
385
386
387
388
      SCOPE->objective[0] = DEFAULT_OBJECTIVE_MIN;
      SCOPE->objective[1] = DEFAULT_OBJECTIVE_MAX;
      if(vm.count("objective"))
      {
          vector<ptype> oparams = vm["objective"].as< vector<ptype> >();
3f56f1f9   dmayerich   initial commit
389
  
51b6469a   dmayerich   added look-up tables
390
391
392
393
394
395
396
397
          if(oparams.size() == 1)
              SCOPE->objective[1] = oparams[0];
          else
          {
              SCOPE->objective[0] = oparams[0];
              SCOPE->objective[1] = oparams[1];
          }
      }
3f56f1f9   dmayerich   initial commit
398
399
  }
  
51b6469a   dmayerich   added look-up tables
400
  static void lImagePlane(po::variables_map vm)
3f56f1f9   dmayerich   initial commit
401
  {
51b6469a   dmayerich   added look-up tables
402
403
404
  	bsPoint pMin(DEFAULT_PLANE_MIN_X, DEFAULT_PLANE_MIN_Y, DEFAULT_PLANE_MIN_Z);
  	bsPoint pMax(DEFAULT_PLANE_MAX_X, DEFAULT_PLANE_MAX_Y, DEFAULT_PLANE_MAX_Z);
  	bsVector normal(DEFAULT_PLANE_NORM_X, DEFAULT_PLANE_NORM_Y, DEFAULT_PLANE_NORM_Z);
3f56f1f9   dmayerich   initial commit
405
406
  
  	//set the default values for the slice position and orientation
51b6469a   dmayerich   added look-up tables
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
  	if(vm.count("plane-lower-left") && vm.count("plane-upper-right") && vm.count("plane-normal"))
  	{
  		vector<ptype> ll = vm["plane-lower-left"].as< vector<ptype> >();
  		if(ll.size() != 3)
  		{
  			cout<<"BIMSIM Error - The lower-left corner of the image plane is incorrectly specified."<<endl;
  			exit(1);
  		}
  
  		vector<ptype> ur = vm["plane-lower-left"].as< vector<ptype> >();
  		if(ur.size() != 3)
  		{
  			cout<<"BIMSIM Error - The upper-right corner of the image plane is incorrectly specified."<<endl;
  			exit(1);
  		}
  
  		vector<ptype> norm = vm["plane-lower-left"].as< vector<ptype> >();
  		if(norm.size() != 3)
  		{
  			cout<<"BIMSIM Error - The normal of the image plane is incorrectly specified."<<endl;
  			exit(1);
  		}
  
  		pMin = bsPoint(ll[0], ll[1], ll[2]);
  		pMax = bsPoint(ur[0], ur[1], ur[2]);
  		normal = bsVector(norm[0], norm[1], norm[2]);
  	}
  	else if(vm.count("xy"))
  	{
  		//default plane size in microns
  		ptype s = DEFAULT_PLANE_SIZE;
  		ptype pos = DEFAULT_PLANE_POSITION;
  
  		vector<ptype> xy = vm["xy"].as< vector<ptype> >();
  		if(xy.size() >= 1)
  			s = xy[0];
  		if(xy.size() >= 2)
  			pos = xy[1];
  
  		//calculate the plane corners and normal based on the size and position
  		pMin = bsPoint(-s/2, -s/2, pos);
  		pMax = bsPoint(s/2, s/2, pos);
  		normal = bsVector(0, 0, 1);
  	}
  	else if(vm.count("xz"))
  	{
  		//default plane size in microns
  		ptype size = DEFAULT_PLANE_SIZE;
  		ptype pos = DEFAULT_PLANE_POSITION;
  
  		vector<ptype> xz = vm["xz"].as< vector<ptype> >();
  		if(xz.size() >= 1)
  			size = xz[0];
  		if(xz.size() >= 2)
  			pos = xz[1];
  
  		//calculate the plane corners and normal based on the size and position
  		pMin = bsPoint(-size/2, pos, -size/2);
  		pMax = bsPoint(size/2, pos, size/2);
  		normal = bsVector(0, -1, 0);
  	}
  	else if(vm.count("yz"))
  	{
  		//default plane size in microns
  		ptype size = DEFAULT_PLANE_SIZE;
  		ptype pos = DEFAULT_PLANE_POSITION;
  
  		vector<ptype> yz = vm["yz"].as< vector<ptype> >();
  		if(yz.size() >= 1)
  			size = yz[0];
  		if(yz.size() >= 2)
  			pos = yz[1];
  
  		//calculate the plane corners and normal based on the size and position
  		pMin = bsPoint(pos, -size/2, -size/2);
  		pMax = bsPoint(pos, size/2, size/2);
  		normal = bsVector(1, 0, 0);
  	}
3f56f1f9   dmayerich   initial commit
485
486
487
488
489
490
491
492
493
494
495
496
497
  	SCOPE->setPos(pMin, pMax, normal);
  
  	//resolution
  	SCOPE->setRes(vm["resolution"].as<unsigned int>(),
  				  vm["resolution"].as<unsigned int>(),
  				  vm["padding"].as<unsigned int>(),
  				  vm["supersample"].as<unsigned int>());
  
  
  
  
  
  	SCOPE->setNearfield();
3f56f1f9   dmayerich   initial commit
498
499
500
501
  }
  
  static void OutputOptions()
  {
51b6469a   dmayerich   added look-up tables
502
  	cout<<SCOPE->toStr();
3f56f1f9   dmayerich   initial commit
503
  
967e46a1   dmayerich   added spectral sc...
504
505
  	cout<<"# of source points: "<<SCOPE->focalPoints.size()<<endl;
  
3f56f1f9   dmayerich   initial commit
506
507
  }
  
51b6469a   dmayerich   added look-up tables
508
  vector<ptype> test;
3f56f1f9   dmayerich   initial commit
509
510
511
  static void SetOptions(po::options_description &desc)
  {
  	desc.add_options()
51b6469a   dmayerich   added look-up tables
512
  		("help", "prints this help")
3f36b18e   David Mayerich   Adding planewave ...
513
514
  		("gui", "run using the Qt GUI")
  		("verbose", "verbose output\n\nOutput Parameters\n--------------------------")
51b6469a   dmayerich   added look-up tables
515
  
3f36b18e   David Mayerich   Adding planewave ...
516
          ("vector", "run a vector field simulation")
51b6469a   dmayerich   added look-up tables
517
518
519
520
521
  		("intensity", po::value<string>()->default_value(DEFAULT_INTENSITY_FILE), "output measured intensity (filename)")
  		("absorbance", po::value<string>()->default_value(DEFAULT_ABSORBANCE_FILE), "output measured absorbance (filename)")
  		("transmittance", po::value<string>()->default_value(DEFAULT_TRANSMITTANCE_FILE), "output measured transmittance (filename)")
  		("far-field", po::value<string>()->default_value(DEFAULT_FAR_FILE), "output far-field at detector (filename)")
  		("near-field", po::value<string>()->default_value(DEFAULT_NEAR_FILE), "output field at focal plane (filename)")
3f36b18e   David Mayerich   Adding planewave ...
522
523
524
525
  		("extended-source", po::value<string>()->default_value(DEFAULT_EXTENDED_SOURCE), "image of source at focus (filename)")
  		("output-type", po::value<string>()->default_value(DEFAULT_FIELD_TYPE), "output field value:\n magnitude, polarization, real, imaginary, angular-spectrum")
  		("colormap", po::value<string>()->default_value(DEFAULT_COLORMAP), "colormap: gray, brewer")
  		("append", "append result to an existing file\n (binary files only)\n\nSphere Parameters\n--------------------------")
51b6469a   dmayerich   added look-up tables
526
527
528
529
  
  		("spheres", po::value< vector<ptype> >()->multitoken(), "sphere position: x y z a m")
  		("sphere-file", po::value< vector<string> >()->multitoken(), "sphere file:\n [x y z radius material]")
  		("materials", po::value< vector<ptype> >()->multitoken(), "refractive indices as n, k pairs:\n ex. -m n0 k0 n1 k1 n2 k2")
3f36b18e   David Mayerich   Adding planewave ...
530
  		("material-file", po::value< vector<string> >()->multitoken(), "material file:\n [lambda n k]\n\nOptics\n--------------------------")
51b6469a   dmayerich   added look-up tables
531
532
  
  		("lambda", po::value<ptype>()->default_value(DEFAULT_LAMBDA), "incident wavelength")
b6179de6   dmayerich   added scripts for...
533
  		("nu", po::value<ptype>(), "incident frequency (in cm^-1)\n(if specified, lambda is ignored)")
51b6469a   dmayerich   added look-up tables
534
535
536
537
538
  		("k", po::value< vector<ptype> >()->multitoken(), "k-vector direction: -k theta phi\n theta = [0 2*pi], phi = [0 pi]")
  		("amplitude", po::value<ptype>()->default_value(DEFAULT_AMPLITUDE), "incident field amplitude")
  		("condenser", po::value< vector<ptype> >()->multitoken(), "condenser numerical aperature\nA pair of values can be used to specify an inner obscuration: -c NAin NAout")
  		("objective", po::value< vector<ptype> >()->multitoken(), "objective numerical aperature\nA pair of values can be used to specify an inner obscuration: -c NAin NAout")
  		("focus", po::value< vector<ptype> >()->multitoken(), "focal position for the incident point source\n (default = --focus 0 0 0)")
3f36b18e   David Mayerich   Adding planewave ...
539
  		("plane-wave", "simulates an incident plane wave\n\n\nImaging Parameters\n--------------------------")
51b6469a   dmayerich   added look-up tables
540
541
542
543
544
545
546
  
  		("resolution", po::value<unsigned int>()->default_value(DEFAULT_SLICE_RES), "resolution of the detector")
  		("plane-lower-left", po::value< vector<ptype> >()->multitoken(), "lower-left position of the image plane")
  		("plane-upper-right", po::value< vector<ptype> >()->multitoken(), "upper-right position of the image plane")
  		("plane-normal", po::value< vector<ptype> >()->multitoken(), "normal for the image plane")
  		("xy", po::value< vector<ptype> >()->multitoken(), "specify an x-y image plane\n (standard microscope)")
  		("xz", po::value< vector<ptype> >()->multitoken(), "specify a x-z image plane\n (cross-section of the focal volume)")
3f36b18e   David Mayerich   Adding planewave ...
547
  		("yz", po::value< vector<ptype> >()->multitoken(), "specify a y-z image plane\n (cross-section of the focal volume)\n\nSampling Parameters\n--------------------------")
51b6469a   dmayerich   added look-up tables
548
549
550
  
  		("samples", po::value<int>()->default_value(DEFAULT_SAMPLES), "Monte-Carlo samples used to compute Us")
  		("padding", po::value<unsigned int>()->default_value(DEFAULT_PADDING), "FFT padding for the objective bandpass")
3f56f1f9   dmayerich   initial commit
551
  		("supersample", po::value<unsigned int>()->default_value(DEFAULT_SUPERSAMPLE), "super-sampling rate for the detector field")
51b6469a   dmayerich   added look-up tables
552
553
554
555
556
  		("field-order", po::value<int>()->default_value(DEFAULT_FIELD_ORDER), "order of the incident field")
  		("seed", po::value<unsigned int>(), "seed for the Monte-Carlo random number generator")
  		("recursive", "evaluate all Bessel functions recursively\n")
  		("recursive-us", "evaluate scattered-field Bessel functions recursively\n")
  		("lut-uf", "evaluate the focused-field using a look-up table\n")
51b6469a   dmayerich   added look-up tables
557
  		;
3f56f1f9   dmayerich   initial commit
558
559
560
561
562
  }
  
  static void LoadParameters(int argc, char *argv[])
  {
  	//create an option description
51b6469a   dmayerich   added look-up tables
563
  	po::options_description desc("BimSim arguments");
3f56f1f9   dmayerich   initial commit
564
565
566
567
568
  
  	//fill it with options
  	SetOptions(desc);
  
      po::variables_map vm;
51b6469a   dmayerich   added look-up tables
569
  	po::store(po::parse_command_line(argc, argv, desc, po::command_line_style::unix_style ^ po::command_line_style::allow_short), vm);
3f56f1f9   dmayerich   initial commit
570
571
  	po::notify(vm);
  
3f56f1f9   dmayerich   initial commit
572
  
51b6469a   dmayerich   added look-up tables
573
574
575
576
577
578
579
      //load flags (help, verbose output)
      lFlags(vm, desc);
  
      //load the wavelength
      lWavelength(vm);
  
      //load materials
51b6469a   dmayerich   added look-up tables
580
581
582
583
584
585
586
587
588
589
  	lMaterials(vm);
  
      //load the sphere data
      lSpheres(vm);
  
      //load the optics
      lOptics(vm);
  
  	//load the position and orientation of the image plane
  	lImagePlane(vm);
b6179de6   dmayerich   added scripts for...
590
  
3f56f1f9   dmayerich   initial commit
591
  
51b6469a   dmayerich   added look-up tables
592
  	lNearfield(vm);
3f56f1f9   dmayerich   initial commit
593
594
595
  
  	loadOutputParams(vm);
  
3f56f1f9   dmayerich   initial commit
596
597
598
599
600
601
602
603
604
605
606
607
608
609
      //if an extended source will be used
      if(vm["extended-source"].as<string>() != "")
      {
          //load the point sources
          string filename = vm["extended-source"].as<string>();
          SCOPE->LoadExtendedSource(filename);
  
      }
  
  
  
  
  
  }