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, vtkSmartPointer< vtkDataArray > * out_disagreement =nullptr, vtkSmartPointer< vtkDataArray > * out_push =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 and the aggregates 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 how far that reconstruction and the subject's groomed mesh disagree.

Both directions are measured. Pull, from each reconstructed vertex to the groomed surface, catches reconstruction that departs from the surface: folds, flaps, spikes. Push, from each groomed vertex to the reconstruction, catches groomed surface the reconstruction never reaches: tears and collapsed openings. Disagreement combines them into one field on the groomed mesh, the only surface that can show a gap. 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 pull "distance" field, and the groomed meshes alongside them with "disagreement" and "push" fields. 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,
    vtkSmartPointer< vtkDataArray > * out_disagreement =nullptr,
    vtkSmartPointer< vtkDataArray > * out_push =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 pull field on the reconstruction's vertices (named "distance"). out_disagreement and out_push receive fields on the groomed mesh's vertices (named "disagreement" and "push"); disagreement is the field to color by, since a gap in the reconstruction has no reconstructed surface to show it on.

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 and the aggregates from report.rows.


Updated on 2026-09-20 at 15:51:01 +0000