ViennaLS
Loading...
Searching...
No Matches
viennals::CompareChamfer< T, D > Class Template Reference

Calculate Chamfer distance between two level sets by comparing their zero-level-set surfaces. The Chamfer distance is a bidirectional metric that measures the average nearest-neighbor distance between two point sets. More...

#include <lsCompareChamfer.hpp>

Public Member Functions

 CompareChamfer ()
 CompareChamfer (SmartPointer< Domain< T, D > > passedLevelSetTarget, SmartPointer< Domain< T, D > > passedLevelSetSample)
void setLevelSetTarget (SmartPointer< Domain< T, D > > passedLevelSet)
 Set the target level set.
void setLevelSetSample (SmartPointer< Domain< T, D > > passedLevelSet)
 Set the sample level set.
void setOutputMeshTarget (SmartPointer< Mesh< T > > passedMesh)
 Set output mesh for target surface points with distance data.
void setOutputMeshSample (SmartPointer< Mesh< T > > passedMesh)
 Set output mesh for sample surface points with distance data.
void apply ()
 Apply the Chamfer distance calculation.
T getForwardDistance () const
 Get the forward distance (average distance from target to sample).
T getBackwardDistance () const
 Get the backward distance (average distance from sample to target).
T getChamferDistance () const
 Get the Chamfer distance (average of forward and backward).
T getRMSChamferDistance () const
 Get the RMS Chamfer distance.
T getMaxDistance () const
 Get the maximum nearest-neighbor distance.
unsigned getNumTargetPoints () const
 Get the number of target surface points.
unsigned getNumSamplePoints () const
 Get the number of sample surface points.

Detailed Description

template<class T, int D = 2>
class viennals::CompareChamfer< T, D >

Calculate Chamfer distance between two level sets by comparing their zero-level-set surfaces. The Chamfer distance is a bidirectional metric that measures the average nearest-neighbor distance between two point sets.

This class extracts the surface representations of both level sets and computes:

  • Forward distance: average distance from target surface to sample surface
  • Backward distance: average distance from sample surface to target surface
  • Chamfer distance: average of forward and backward distances
  • RMS Chamfer distance: root mean square of nearest-neighbor distances
  • Maximum distance: maximum nearest-neighbor distance across both directions

The code works for 2D and 3D level sets. Surfaces are represented as line segments in 2D and triangles in 3D.

Both level sets must have a width of at least 2 to extract surfaces. If not, they will be automatically expanded.

Note for the future: lsToDiskMesh could be used instead of lsToSurfaceMesh, which is probably more efficient but slightly less accurate.

Constructor & Destructor Documentation

◆ CompareChamfer() [1/2]

template<class T, int D = 2>
viennals::CompareChamfer< T, D >::CompareChamfer ( )
inline

◆ CompareChamfer() [2/2]

template<class T, int D = 2>
viennals::CompareChamfer< T, D >::CompareChamfer ( SmartPointer< Domain< T, D > > passedLevelSetTarget,
SmartPointer< Domain< T, D > > passedLevelSetSample )
inline

Member Function Documentation

◆ apply()

template<class T, int D = 2>
void viennals::CompareChamfer< T, D >::apply ( )
inline

Apply the Chamfer distance calculation.

◆ getBackwardDistance()

template<class T, int D = 2>
T viennals::CompareChamfer< T, D >::getBackwardDistance ( ) const
inline

Get the backward distance (average distance from sample to target).

◆ getChamferDistance()

template<class T, int D = 2>
T viennals::CompareChamfer< T, D >::getChamferDistance ( ) const
inline

Get the Chamfer distance (average of forward and backward).

◆ getForwardDistance()

template<class T, int D = 2>
T viennals::CompareChamfer< T, D >::getForwardDistance ( ) const
inline

Get the forward distance (average distance from target to sample).

◆ getMaxDistance()

template<class T, int D = 2>
T viennals::CompareChamfer< T, D >::getMaxDistance ( ) const
inline

Get the maximum nearest-neighbor distance.

◆ getNumSamplePoints()

template<class T, int D = 2>
unsigned viennals::CompareChamfer< T, D >::getNumSamplePoints ( ) const
inline

Get the number of sample surface points.

◆ getNumTargetPoints()

template<class T, int D = 2>
unsigned viennals::CompareChamfer< T, D >::getNumTargetPoints ( ) const
inline

Get the number of target surface points.

◆ getRMSChamferDistance()

template<class T, int D = 2>
T viennals::CompareChamfer< T, D >::getRMSChamferDistance ( ) const
inline

Get the RMS Chamfer distance.

◆ setLevelSetSample()

template<class T, int D = 2>
void viennals::CompareChamfer< T, D >::setLevelSetSample ( SmartPointer< Domain< T, D > > passedLevelSet)
inline

Set the sample level set.

◆ setLevelSetTarget()

template<class T, int D = 2>
void viennals::CompareChamfer< T, D >::setLevelSetTarget ( SmartPointer< Domain< T, D > > passedLevelSet)
inline

Set the target level set.

◆ setOutputMeshSample()

template<class T, int D = 2>
void viennals::CompareChamfer< T, D >::setOutputMeshSample ( SmartPointer< Mesh< T > > passedMesh)
inline

Set output mesh for sample surface points with distance data.

◆ setOutputMeshTarget()

template<class T, int D = 2>
void viennals::CompareChamfer< T, D >::setOutputMeshTarget ( SmartPointer< Mesh< T > > passedMesh)
inline

Set output mesh for target surface points with distance data.


The documentation for this class was generated from the following file: