SIMBIO/Releasenotes/Adding user scenarios

From SimBio - A generic environment for bio-numerical simulations

Jump to: navigation, search

Adding new methods to the inverse toolbox or the wish to create new combinations of already implemented methods evoke the need of creating new user scenarios. This can be done by combining methods of the inverse toolbox to a new user scenarios. This chapter shall give a brief guideline to implement a new scenario for the three interface levels.

User interface I is defined as a class. Thus in the corresponding include file a new method has to be added. To provide an example, a part of the class definition can be found in the appendix part C. The method must have arguments specifying input and output parameters as for example reference data, sensor configurations and result data. Additional switches are possible to allow a greater variability of combinations of methods. Inside the implementation of the methods, a constructor for all classes which are necessary for the determination of the source parameters has to be invoked. Then the run() method for the parameter determination can be called, followed by a call of getResult(), which delivers a matrix with the estimated source parameters as it is shown in the following example.

// prepare method 
 
// initialize simulator   
anSimulatorEEGSpheres_c        sim(sensorconfig,inRadii,Center,inConductivities); 
 
// Initialize searcg volume   
anSearchVolumeSphere_c         SearchVolume(Center, inRadii[2]); 
 
// initialize weighter 
anUnaryWeighter_c              weighter(sim);                        
       
// initialize regulatizer 
anRegularizerTruncSVD_c        regularizer;  
         
// initialize criterium 
anCriteriaMinimumSquareError_c squareerror;   
   
// initialize initial guess 
anInitialGuessStandard_c       initialguess; 
 
// initialize grid generator 
anGridGeneratorSingleDipoles_c dipolegrid; 
 
 
// initialize linear estimator 
anAnalyzerInverseLinear_c linearestimator(refdata,sim,dipolegrid,weighter,regularizer); 

// initialize goal function 
anGoalFunctionDipoleRotating_c goalfunction(refdata,sim,squareerror,searchsolume, 
             linearestimator); 
 
// initialize optimizer 
anOptimizerMarquardt_c         optimizer(goalfunction); 
 
// inverse methos        
anAnalyzerInverseDipoleFit_c   method(numdip,initialguess,optimizer); 
   
// run dipole fit and get resultmatrix 
utMatrix_t<double> resultmatrix; 
method.run(); 
method.getResult(resultmatrix);

User interface II is also realized as a class. Methods of user interface II create data matrices and classes from files before calling the method of user interface I. The results can be written in a file subsequent to the call of the method of UIF I. An example is given inside appendix C.

User Interface III uses the argument argc (argument count) and the array of arguments argv (argument value) of the main function of a program. Thus the values of argv can be used to identify the name of the scenario and to define names of input and output files as well as switches. To ensure that the array argv contains reasonable values, their contents should be checked before calling a method of user interface II.

Personal tools