Blame view

options.h 17.7 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"
51b6469a   dmayerich   added look-up tables
8
  #include "rts/graphics/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
27
28
29
30
31
32
33
34
35
36
37
38
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
186
187
188
189
190
191
192
193
194
195
196
197
198
  extern bool verbose;
  
  
  
  static void lNearfield(po::variables_map vm)
  {
  	//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;
      }
  }
  
  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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
  {
      /*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
233
  }
3f56f1f9   dmayerich   initial commit
234
  
51b6469a   dmayerich   added look-up tables
235
236
237
238
239
240
241
  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
242
  
51b6469a   dmayerich   added look-up tables
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
          //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
258
  
51b6469a   dmayerich   added look-up tables
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
          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
282
  
3f56f1f9   dmayerich   initial commit
283
284
285
      //if a files are specified
      if(vm.count("sphere-file"))
      {
51b6469a   dmayerich   added look-up tables
286
  
3f56f1f9   dmayerich   initial commit
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
          vector<string> filenames = vm["sphere-file"].as< vector<string> >();
          //load each file
          for(int iS=0; iS<filenames.size(); iS++)
          {
              //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
303
              lSpheres(instr);
3f56f1f9   dmayerich   initial commit
304
305
306
          }
      }
  
51b6469a   dmayerich   added look-up tables
307
308
      //make sure the appropriate materials are loaded
      unsigned int nS = SCOPE->nf.sVector.size();
3f56f1f9   dmayerich   initial commit
309
  
51b6469a   dmayerich   added look-up tables
310
311
312
313
314
315
316
317
318
319
      //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;
              exit(1);
          }
3f56f1f9   dmayerich   initial commit
320
321
322
      }
  }
  
51b6469a   dmayerich   added look-up tables
323
  static void lMaterials(po::variables_map vm)
3f56f1f9   dmayerich   initial commit
324
325
326
327
328
  {
  	//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
329
330
331
332
333
334
  		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
335
336
337
338
  		{
  			cout<<"BIMSim Error: materials must be specified in n, k pairs"<<endl;
  			exit(1);
  		}
51b6469a   dmayerich   added look-up tables
339
  		else
3f56f1f9   dmayerich   initial commit
340
  		{
51b6469a   dmayerich   added look-up tables
341
342
343
344
345
  			for(int i=0; i<matVec.size(); i+=2)
  			{
  				rts::material<ptype> newM(SCOPE->nf.lambda, matVec[i], matVec[i+1]);
  				SCOPE->nf.mVector.push_back(newM);
  			}
3f56f1f9   dmayerich   initial commit
346
347
  		}
  	}
3f56f1f9   dmayerich   initial commit
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
  
  	//if file names are specified, load the materials
  	if(vm.count("material-file"))
  	{
          vector<string> filenames = vm["material-file"].as< vector<string> >();
          for(int i=0; i<filenames.size(); i++)
          {
              //load the file into a string
              std::ifstream ifs(filenames[i].c_str());
  
              std::string instr((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
  
              //load the list of spheres from a string
              rts::material<ptype> newM;
              newM.fromStr(instr, "");
              SCOPE->nf.mVector.push_back(newM);
          }
  	}
  
  }
  
51b6469a   dmayerich   added look-up tables
369
  static void lOptics(po::variables_map vm)
3f56f1f9   dmayerich   initial commit
370
  {
51b6469a   dmayerich   added look-up tables
371
372
373
374
375
      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
376
  
51b6469a   dmayerich   added look-up tables
377
378
379
380
381
382
383
384
          if(oparams.size() == 1)
              SCOPE->objective[1] = oparams[0];
          else
          {
              SCOPE->objective[0] = oparams[0];
              SCOPE->objective[1] = oparams[1];
          }
      }
3f56f1f9   dmayerich   initial commit
385
386
  }
  
51b6469a   dmayerich   added look-up tables
387
  static void lImagePlane(po::variables_map vm)
3f56f1f9   dmayerich   initial commit
388
  {
51b6469a   dmayerich   added look-up tables
389
390
391
  	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
392
393
  
  	//set the default values for the slice position and orientation
51b6469a   dmayerich   added look-up tables
394
395
396
397
398
399
400
401
402
403
404
405
406
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
  	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
472
473
474
475
476
477
478
479
480
481
482
483
484
  	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
485
486
487
488
  }
  
  static void OutputOptions()
  {
51b6469a   dmayerich   added look-up tables
489
  	cout<<SCOPE->toStr();
3f56f1f9   dmayerich   initial commit
490
  
967e46a1   dmayerich   added spectral sc...
491
492
  	cout<<"# of source points: "<<SCOPE->focalPoints.size()<<endl;
  
3f56f1f9   dmayerich   initial commit
493
494
  }
  
51b6469a   dmayerich   added look-up tables
495
  vector<ptype> test;
3f56f1f9   dmayerich   initial commit
496
497
498
  static void SetOptions(po::options_description &desc)
  {
  	desc.add_options()
51b6469a   dmayerich   added look-up tables
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
  		("help", "prints this help")
  		("verbose", "verbose output\n")
  
  		("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)")
  		("extended-source", po::value<string>()->default_value(DEFAULT_EXTENDED_SOURCE), "image of source at focus (filename)\n")
  
  		("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")
  		("material-file", po::value< vector<string> >()->multitoken(), "material file:\n [lambda n k]\n")
  
  		("lambda", po::value<ptype>()->default_value(DEFAULT_LAMBDA), "incident wavelength")
b6179de6   dmayerich   added scripts for...
515
  		("nu", po::value<ptype>(), "incident frequency (in cm^-1)\n(if specified, lambda is ignored)")
51b6469a   dmayerich   added look-up tables
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
  		("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)")
  		("plane-wave", "simulates an incident plane wave\n")
  
  		("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)")
  		("yz", po::value< vector<ptype> >()->multitoken(), "specify a y-z image plane\n (cross-section of the focal volume)\n")
  
  		("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
533
  		("supersample", po::value<unsigned int>()->default_value(DEFAULT_SUPERSAMPLE), "super-sampling rate for the detector field")
51b6469a   dmayerich   added look-up tables
534
535
536
537
538
539
540
  		("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")
  
  		("output-type", po::value<string>()->default_value(DEFAULT_FIELD_TYPE), "output field value:\n magnitude, polarization, real, imaginary, angular-spectrum")
3f56f1f9   dmayerich   initial commit
541
542
  		("colormap", po::value<string>()->default_value(DEFAULT_COLORMAP), "colormap: gray, brewer")
  		("append", "append result to an existing file\n (binary files only)")
51b6469a   dmayerich   added look-up tables
543
  		;
3f56f1f9   dmayerich   initial commit
544
545
546
547
548
  }
  
  static void LoadParameters(int argc, char *argv[])
  {
  	//create an option description
51b6469a   dmayerich   added look-up tables
549
  	po::options_description desc("BimSim arguments");
3f56f1f9   dmayerich   initial commit
550
551
552
553
554
  
  	//fill it with options
  	SetOptions(desc);
  
      po::variables_map vm;
51b6469a   dmayerich   added look-up tables
555
  	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
556
557
  	po::notify(vm);
  
3f56f1f9   dmayerich   initial commit
558
  
51b6469a   dmayerich   added look-up tables
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
      //load flags (help, verbose output)
      lFlags(vm, desc);
  
      //load the wavelength
      lWavelength(vm);
  
      //load materials
  	//loadMaterials(vm);
  	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...
577
  
3f56f1f9   dmayerich   initial commit
578
  	//load spheres
51b6469a   dmayerich   added look-up tables
579
580
  	//loadSpheres(vm);
  
3f56f1f9   dmayerich   initial commit
581
  
3f56f1f9   dmayerich   initial commit
582
  
51b6469a   dmayerich   added look-up tables
583
  	lNearfield(vm);
3f56f1f9   dmayerich   initial commit
584
585
586
  
  	loadOutputParams(vm);
  
51b6469a   dmayerich   added look-up tables
587
  	//loadMicroscopeParams(vm);
3f56f1f9   dmayerich   initial commit
588
  
51b6469a   dmayerich   added look-up tables
589
  	//loadSliceParams(vm);
3f56f1f9   dmayerich   initial commit
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
  
      //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);
  
      }
  
  
  
  
  
  }