MNE-CPP  beta 1.0
layoutmaker.h
Go to the documentation of this file.
1 //=============================================================================================================
37 #ifndef LAYOUTMAKER_H
38 #define LAYOUTMAKER_H
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
45 #include "minimizersimplex.h"
46 #include "utils_global.h"
47 #include <iostream>
48 
49 
50 //*************************************************************************************************************
51 //=============================================================================================================
52 // Qt INCLUDES
53 //=============================================================================================================
54 
55 #include <QVector>
56 #include <QList>
57 #include <QStringList>
58 #include <QFile>
59 #include <QTextStream>
60 #include <QDebug>
61 
62 
63 //*************************************************************************************************************
64 //=============================================================================================================
65 // Eigen INCLUDES
66 //=============================================================================================================
67 
68 #include <Eigen/Eigen>
69 
70 
71 //*************************************************************************************************************
72 //=============================================================================================================
73 // DEFINE NAMESPACE MNELIB
74 //=============================================================================================================
75 
76 namespace UTILSLIB
77 {
78 
79 
80 //*************************************************************************************************************
81 //=============================================================================================================
82 // USED NAMESPACES
83 //=============================================================================================================
84 
85 using namespace Eigen;
86 
87 
88 //*************************************************************************************************************
89 //=============================================================================================================
90 // DEFINES
91 //=============================================================================================================
92 #ifndef FAIL
93 #define FAIL -1
94 #endif
95 
96 #ifndef OK
97 #define OK 0
98 #endif
99 
100 #ifndef FALSE
101 #define FALSE 0
102 #endif
103 
104 #ifndef TRUE
105 #define TRUE 1
106 #endif
107 #define EPS 1e-6
108 
109 #ifndef M_PI
110 #define M_PI 3.14159265358979323846 /* pi */
111 #endif
112 
113 
114 //*************************************************************************************************************
115 //=============================================================================================================
116 // TYPEDEFS
117 //=============================================================================================================
118 
119 typedef struct {
120  MatrixXf rr;
121  int np;
122  int report;
124 
125 //=============================================================================================================
132 {
133 public:
134  //=========================================================================================================
138  LayoutMaker();
139 
140  //=========================================================================================================
148  static bool makeLayout(const QList<QVector<double> > &inputPoints,
149  QList<QVector<double> > &outputPoints,
150  const QStringList &names,
151  QFile &outFile,
152  bool do_fit,
153  float prad,
154  float w,
155  float h,
156  bool writeFile = false);
157 
158 private:
159  static void sphere_coord(float x,
160  float y,
161  float z,
162  float *r,
163  float *theta,
164  float *phi);
165 
166  static int report_func(int loop,
167  const VectorXf &fitpar,
168  int npar,
169  double fval);
170 
171  static float fit_eval(const VectorXf &fitpar,
172  int npar,
173  void *user_data);
174 
175  static float opt_rad(VectorXf &r0,
176  fitUser user);
177 
178  static void calculate_cm_ave_dist(MatrixXf &rr,
179  int np,
180  VectorXf &cm,
181  float &avep);
182 
183  static MatrixXf make_initial_simplex(VectorXf &pars,
184  int npar,
185  float size);
186 
187  static int fit_sphere_to_points(MatrixXf &rr,
188  int np,
189  float simplex_size,
190  VectorXf &r0,
191  float &R);
192 };
193 
194 } //NAMESPACE
195 
196 #endif // LAYOUTMAKER_H
#define UTILSSHARED_EXPORT
Definition: utils_global.h:57
utils library export/import macros.
Make layout files from given 3D points.
Definition: layoutmaker.h:131
MinimizerSimplex class declaration.