Skip to content

Libs/Particles/CorrespondenceEvaluation.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)

Classes

Name
struct shapeworks::CorrespondenceQualityRow
Per-subject-per-domain correspondence quality result row.
struct shapeworks::CorrespondenceQualityStats
Aggregate summary statistics.
struct shapeworks::CorrespondenceQualityReport
Full evaluation report.
class shapeworks::CorrespondenceEvaluation

Source code

#pragma once

#include <vtkSmartPointer.h>

#include <Eigen/Core>
#include <memory>
#include <string>
#include <vector>

class vtkDataArray;
class vtkPolyData;

namespace shapeworks {

class Mesh;
class Project;
using ProjectHandle = std::shared_ptr<Project>;

struct CorrespondenceQualityRow {
  std::string subject;
  int domain = 0;
  double mean_dist = 0.0;    
  double median_dist = 0.0;  
  double p99_dist = 0.0;     
  double max_dist = 0.0;     
  double bbox_diag = 0.0;    
  double norm_mean = 0.0;    
  double norm_median = 0.0;  
  double norm_p99 = 0.0;     
  double norm_max = 0.0;     
  bool is_template = false;  
};

struct CorrespondenceQualityStats {
  double mean = 0.0;
  double median = 0.0;
  double p95 = 0.0;
  double max = 0.0;
};

struct CorrespondenceQualityReport {
  std::vector<CorrespondenceQualityRow> rows;
  std::string template_subject;
  int num_evaluated = 0;                 
  int num_template_rows = 0;
  CorrespondenceQualityStats agg_raw;    
  CorrespondenceQualityStats agg_norm;   
};

class CorrespondenceEvaluation {
 public:
  enum class DistanceMethod { PointToCell, PointToPoint };

  static CorrespondenceQualityReport evaluate(ProjectHandle project,
                                              DistanceMethod method = DistanceMethod::PointToCell,
                                              const std::string& output_meshes_dir = "");

  static CorrespondenceQualityRow evaluate_reconstruction(vtkSmartPointer<vtkPolyData> reconstructed,
                                                          const Mesh& groomed, DistanceMethod method,
                                                          vtkSmartPointer<vtkDataArray>* out_distance = nullptr);

  static CorrespondenceQualityStats summarize(std::vector<double> values);

  static void compute_aggregates(CorrespondenceQualityReport& report);
};

}  // namespace shapeworks

Updated on 2026-08-30 at 04:03:18 +0000