OpenMS
Loading...
Searching...
No Matches
WNetMatcher Class Reference

Pairwise point-set matching using Wasserstein optimal transport. More...

#include <OpenMS/ANALYSIS/MAPMATCHING/WNetMatcher.h>

Classes

struct  MatchResult
 Result of a pairwise matching. More...
 

Public Types

enum class  DistanceMetric { L1 , L2 , LINF }
 Distance metric for comparing point positions. More...
 

Static Public Member Functions

static MatchResult match (const std::vector< std::array< double, 2 > > &positions_a, const std::vector< double > &intensities_a, const std::vector< std::array< double, 2 > > &positions_b, const std::vector< double > &intensities_b, DistanceMetric metric=DistanceMetric::LINF, double max_distance=100.0, double trash_cost=100.0)
 Match two sets of 2D points using optimal transport.
 
static DistanceMetric metricFromString (const std::string &s)
 Convert a string to a DistanceMetric enum value.
 

Detailed Description

Pairwise point-set matching using Wasserstein optimal transport.

Matches two sets of 2D points (with associated intensities) by solving a minimum-cost network flow problem. Returns 1-to-1 matched index pairs selected greedily by descending transport flow.

This provides a minimal, FeatureMap-independent interface to the WNetAlign algorithm. For feature-level grouping across multiple maps, use FeatureGroupingAlgorithmWNet instead.


Class Documentation

◆ OpenMS::WNetMatcher::MatchResult

struct OpenMS::WNetMatcher::MatchResult

Result of a pairwise matching.

Collaboration diagram for WNetMatcher::MatchResult:
[legend]
Class Members
double cost = 0.0 Total transport cost.
vector< pair< Size, Size > > matched_pairs (index_a, index_b) of matched points

Member Enumeration Documentation

◆ DistanceMetric

enum class DistanceMetric
strong

Distance metric for comparing point positions.

Enumerator
L1 
L2 
LINF 

Member Function Documentation

◆ match()

static MatchResult match ( const std::vector< std::array< double, 2 > > &  positions_a,
const std::vector< double > &  intensities_a,
const std::vector< std::array< double, 2 > > &  positions_b,
const std::vector< double > &  intensities_b,
DistanceMetric  metric = DistanceMetric::LINF,
double  max_distance = 100.0,
double  trash_cost = 100.0 
)
static

Match two sets of 2D points using optimal transport.

Points are matched by minimizing the total transport cost between their positions, weighted by intensity. Unmatched points are sent to a "trash" node at the specified cost.

Parameters
[in]positions_aPositions of first point set (each {dim0, dim1})
[in]intensities_aIntensities/weights of first point set
[in]positions_bPositions of second point set (each {dim0, dim1})
[in]intensities_bIntensities/weights of second point set
[in]metricDistance metric (L1, L2, or LINF)
[in]max_distanceMaximum distance to consider a match
[in]trash_costCost of leaving a point unmatched
Returns
MatchResult with paired indices and total cost

◆ metricFromString()

static DistanceMetric metricFromString ( const std::string &  s)
static

Convert a string to a DistanceMetric enum value.

Recognizes "L1", "L2", and "LINF" (maps to DistanceMetric::L1/L2/LINF respectively). Any other input emits a warning via OPENMS_LOG_WARN and returns DistanceMetric::LINF as the fallback.