@@ -14,7 +14,7 @@ namespace shapeworks {
1414
1515// ---------------------------------------------------------------------------
1616static json get_eigen_vectors (ParticleShapeStatistics* stats) {
17- auto values = stats->Eigenvectors ();
17+ auto values = stats->get_eigen_vectors ();
1818
1919 std::vector<double > vals;
2020 for (size_t i = values.cols () - 1 , ii = 0 ; i > 0 ; i--, ii++) {
@@ -173,8 +173,8 @@ void Analyze::run_offline_analysis(std::string outfile, float range, float steps
173173 double increment = range / half_steps;
174174
175175 std::vector<double > eigen_vals;
176- for (int i = stats_.Eigenvalues ().size () - 1 ; i > 0 ; i--) {
177- eigen_vals.push_back (stats_.Eigenvalues ()[i]);
176+ for (int i = stats_.get_eigen_values ().size () - 1 ; i > 0 ; i--) {
177+ eigen_vals.push_back (stats_.get_eigen_values ()[i]);
178178 }
179179 double sum = std::accumulate (eigen_vals.begin (), eigen_vals.end (), 0.0 );
180180
@@ -213,7 +213,7 @@ void Analyze::run_offline_analysis(std::string outfile, float range, float steps
213213 // export modes
214214 std::vector<json> modes;
215215 for (int mode = 0 ; mode < num_modes; mode++) {
216- unsigned int m = stats_.Eigenvectors ().cols () - (mode + 1 );
216+ unsigned int m = stats_.get_eigen_vectors ().cols () - (mode + 1 );
217217 json jmode;
218218 jmode[" mode" ] = mode + 1 ;
219219 double eigen_value = eigen_vals[mode];
@@ -231,8 +231,8 @@ void Analyze::run_offline_analysis(std::string outfile, float range, float steps
231231 jmode[" cumulative_explained_variance" ] = cumulative_explained_variance;
232232 SW_LOG (" explained_variance [{}]: {:.2f}" , mode, explained_variance);
233233 SW_LOG (" cumulative_explained_variance [{}]: {:.2f}" , mode, cumulative_explained_variance);
234-
235- double lambda = sqrt (stats_.Eigenvalues ()[m]);
234+
235+ double lambda = sqrt (stats_.get_eigen_values ()[m]);
236236
237237 std::vector<json> jmodes;
238238 for (int i = 1 ; i <= half_steps; i++) {
@@ -278,7 +278,7 @@ void Analyze::run_offline_analysis(std::string outfile, float range, float steps
278278 }
279279
280280 j[" eigen_vectors" ] = get_eigen_vectors (&stats_);
281- j[" eigen_values" ] = stats_.Eigenvalues ();
281+ j[" eigen_values" ] = stats_.get_eigen_values ();
282282 j[" modes" ] = modes;
283283 j[" charts" ] = create_charts (&stats_);
284284
@@ -322,7 +322,7 @@ Particles Analyze::get_mean_shape_points() {
322322 return Particles ();
323323 }
324324
325- return convert_from_combined (stats_.Mean ());
325+ return convert_from_combined (stats_.get_mean ());
326326}
327327
328328// ---------------------------------------------------------------------------
@@ -336,30 +336,30 @@ ShapeHandle Analyze::get_mean_shape() {
336336
337337// ---------------------------------------------------------------------------
338338Particles Analyze::get_shape_points (int mode, double value) {
339- if (!compute_stats () || stats_.Eigenvectors ().size () <= 1 ) {
339+ if (!compute_stats () || stats_.get_eigen_vectors ().size () <= 1 ) {
340340 return Particles ();
341341 }
342- if (mode + 2 > stats_.Eigenvalues ().size ()) {
343- mode = stats_.Eigenvalues ().size () - 2 ;
342+ if (mode + 2 > stats_.get_eigen_values ().size ()) {
343+ mode = stats_.get_eigen_values ().size () - 2 ;
344344 }
345-
346- unsigned int m = stats_.Eigenvectors ().cols () - (mode + 1 );
347-
348- Eigen::VectorXd e = stats_.Eigenvectors ().col (m);
349-
350- double lambda = sqrt (stats_.Eigenvalues ()[m]);
345+
346+ unsigned int m = stats_.get_eigen_vectors ().cols () - (mode + 1 );
347+
348+ Eigen::VectorXd e = stats_.get_eigen_vectors ().col (m);
349+
350+ double lambda = sqrt (stats_.get_eigen_values ()[m]);
351351
352352 std::vector<double > vals;
353- for (int i = stats_.Eigenvalues ().size () - 1 ; i > 0 ; i--) {
354- vals.push_back (stats_.Eigenvalues ()[i]);
353+ for (int i = stats_.get_eigen_values ().size () - 1 ; i > 0 ; i--) {
354+ vals.push_back (stats_.get_eigen_values ()[i]);
355355 }
356356 double sum = std::accumulate (vals.begin (), vals.end (), 0.0 );
357357 double cumulation = 0 ;
358358 for (size_t i = 0 ; i < mode + 1 ; ++i) {
359359 cumulation += vals[i];
360360 }
361361
362- auto temp_shape = stats_.Mean () + (e * (value * lambda));
362+ auto temp_shape = stats_.get_mean () + (e * (value * lambda));
363363
364364 return convert_from_combined (temp_shape);
365365}
@@ -489,9 +489,9 @@ bool Analyze::compute_stats() {
489489 return false ;
490490 }
491491 }
492-
493- stats_.ImportPoints (points, group_ids);
494- stats_.ComputeModes ();
492+
493+ stats_.import_points (points, group_ids);
494+ stats_.compute_modes ();
495495
496496 stats_ready_ = true ;
497497 SW_LOG (" Computed stats successfully" );
@@ -522,7 +522,7 @@ Particles Analyze::convert_from_combined(const Eigen::VectorXd& points) {
522522
523523// ---------------------------------------------------------------------------
524524void Analyze::initialize_mesh_warper () {
525- int median = stats_.ComputeMedianShape (-32 ); // -32 = both groups
525+ int median = stats_.compute_median_shape (-32 ); // -32 = both groups
526526
527527 if (median < 0 || median >= get_shapes ().size ()) {
528528 SW_ERROR (" Unable to set reference mesh, stats returned invalid median index" );
@@ -555,9 +555,9 @@ void Analyze::initialize_mesh_warper() {
555555int Analyze::get_num_subjects () { return shapes_.size (); }
556556
557557// ---------------------------------------------------------------------------
558- Eigen::VectorXf Analyze::get_subject_features (int subject, std::string feature_name) {
558+ Eigen::VectorXd Analyze::get_subject_features (int subject, std::string feature_name) {
559559 if (subject >= shapes_.size ()) {
560- return Eigen::VectorXf ();
560+ return Eigen::VectorXd ();
561561 }
562562
563563 auto shape = shapes_[subject];
@@ -617,8 +617,8 @@ Particles Analyze::get_group_shape_particles(double ratio) {
617617 if (!compute_stats ()) {
618618 return Particles ();
619619 }
620-
621- auto particles = stats_.Group1Mean () + (stats_.GroupDifference () * ratio);
620+
621+ auto particles = stats_.get_group1_mean () + (stats_.get_group_difference () * ratio);
622622
623623 return convert_from_combined (particles);
624624}
0 commit comments