Skip to content

shapeworks::CorrespondenceEvaluation

More...

#include <CorrespondenceEvaluation.h>

Public Types

Name
enum class DistanceMethod

Public Functions

Name
CorrespondenceQualityReport evaluate(ProjectHandle project, DistanceMethod method =DistanceMethod::PointToCell, const std::string & output_meshes_dir ="")
CorrespondenceQualityRow evaluate_reconstruction(vtkSmartPointer< vtkPolyData > reconstructed, const Mesh & groomed, DistanceMethod method, vtkSmartPointer< vtkDataArray > * out_distance =nullptr)
CorrespondenceQualityStats summarize(std::vector< double > values)
Summary statistics (mean/median/p95/max) over a set of values.
void compute_aggregates(CorrespondenceQualityReport & report)
Fill num_evaluated, num_template_rows, agg_raw and agg_norm from report.rows.

Detailed Description

class shapeworks::CorrespondenceEvaluation;

Per-subject correspondence-quality metric: reconstruct each subject's shape from its local particles via biharmonic mesh warp from the cohort L1-medoid template (matches Studio's median-subject selection), then measure distance from the reconstruction to that subject's groomed mesh. Distances are also normalized by each subject's bounding-box diagonal so the metric is scale-invariant.

The template row itself is included in rows (with is_template=true) but excluded from aggregate statistics — its reconstruction is near-identity and would skew small cohorts.

[evaluate()](../Classes/classshapeworks_1_1CorrespondenceEvaluation.md#function-evaluate) drives the whole thing from a project file. Callers that already have reconstructions in memory (Studio, which reconstructs through its own configured mesh warper) should use [evaluate_reconstruction()](../Classes/classshapeworks_1_1CorrespondenceEvaluation.md#function-evaluate-reconstruction) and [compute_aggregates()](../Classes/classshapeworks_1_1CorrespondenceEvaluation.md#function-compute-aggregates) instead so the metric definition stays in one place.

Public Types Documentation

enum DistanceMethod

Enumerator Value Description
PointToCell
PointToPoint

Public Functions Documentation

function evaluate

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

Evaluate. Project is expected to be already loaded, and the current working directory must be one from which the project's relative paths (groomed, local particles) resolve.

If output_meshes_dir is non-empty, per-subject reconstructed meshes are written there as .vtk with an embedded per-vertex "distance" field. The path is used verbatim (interpreted relative to the current CWD if not absolute).

Throws std::runtime_error on setup failures (no subjects, warp failure, mismatched particle counts across subjects).

function evaluate_reconstruction

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

Score a single already-reconstructed mesh against its groomed target.

Fills everything on the row except subject, domain and is_template, which the caller owns. If out_distance is non-null it receives the per-vertex distance field (named "distance"), for surface display or writing alongside the mesh.

Returns a default-constructed row if reconstructed is null or empty.

function summarize

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

Summary statistics (mean/median/p95/max) over a set of values.

function compute_aggregates

static void compute_aggregates(
    CorrespondenceQualityReport & report
)

Fill num_evaluated, num_template_rows, agg_raw and agg_norm from report.rows.


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