MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
sphere.h
Go to the documentation of this file.
1//=============================================================================================================
35#ifndef SPHERE_H
36#define SPHERE_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "utils_global.h"
43
44//=============================================================================================================
45// EIGEN INCLUDES
46//=============================================================================================================
47
48#include <Eigen/Core>
49
50//=============================================================================================================
51// DEFINE NAMESPACE UTILSLIB
52//=============================================================================================================
53
54namespace UTILSLIB
55{
56
57//=============================================================================================================
58// TYPEDEFS
59//=============================================================================================================
60
61typedef struct {
62 Eigen::MatrixXf rr;
63 bool report;
65
66//=============================================================================================================
73{
74public:
75
76 //=========================================================================================================
83 Sphere(const Eigen::Vector3f& center, float radius);
84
85 //=========================================================================================================
93 static Sphere fit_sphere(const Eigen::MatrixX3f& points);
94
95 //=========================================================================================================
104 static Sphere fit_sphere_simplex(const Eigen::MatrixX3f& points, double simplex_size = 2e-2);
105
106 //=========================================================================================================
112 Eigen::Vector3f& center() { return m_center; }
113
114 //=========================================================================================================
120 float& radius() { return m_r; }
121
122 //=========================================================================================================
133 static bool fit_sphere_to_points(const Eigen::MatrixXf &rr, float simplex_size, Eigen::VectorXf &r0, float &R);
134 static bool fit_sphere_to_points(float **rr, int np, float simplex_size, float *r0, float *R);
135
136private:
137 Eigen::Vector3f m_center;
138 float m_r;
140 //=========================================================================================================
148 static void calculate_cm_ave_dist(const Eigen::MatrixXf &rr, Eigen::VectorXf &cm, float &avep);
149
150 //=========================================================================================================
159 static Eigen::MatrixXf make_initial_simplex(const Eigen::VectorXf &pars, float size);
160
161 //=========================================================================================================
170 static float fit_eval(const Eigen::VectorXf &fitpar, const void *user_data);
171
172 //=========================================================================================================
182 static bool report_func(int loop, const Eigen::VectorXf &fitpar, double fval);
183
184 //=========================================================================================================
193 static float opt_rad(const Eigen::VectorXf &r0, const fitUserNew user);
194};
195} // NAMESPACE
196
197#endif // SPHERE_H
utils library export/import macros.
#define UTILSSHARED_EXPORT
Describes a 3D sphere object.
Definition sphere.h:73
static bool fit_sphere_to_points(const Eigen::MatrixXf &rr, float simplex_size, Eigen::VectorXf &r0, float &R)
Eigen::Vector3f & center()
Definition sphere.h:112
float & radius()
Definition sphere.h:120