Correa 1
C++ library with Python bindings to analyse the shape of simple closed curves in R^2
Loading...
Searching...
No Matches
Comp2DShapesFocal.h File Reference
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <fstream>
#include <cmath>
#include <ctime>
#include <unistd.h>
#include <cstdlib>
#include <limits>
#include <assert.h>
#include "hera/wasserstein.h"
#include "InOut.h"
#include "PolygonBuilder.h"
#include "Polygon.h"
#include "Frechet.h"
#include "Ellipse.h"
#include "Curvature.h"
#include "PH0.h"

Macros

#define NUM_THREADS   32
 

Typedefs

using PersistenceDiagram = std::vector<std::pair<double,double>>
 

Functions

bool parse_args (int argc, char **argv, std::string *file1, std::string *focal1, std::string *file2, std::string *focal2, int *disttype, double *microns_per_pixel1, double *microns_per_pixel2, bool *verbose)
 Parse command-line arguments for Comp2DShapesFocal.
 

Variables

int threadids [NUM_THREADS]
 
pthread_t threads [NUM_THREADS]
 
INOUT inout
 
Polygon poly
 
PolygonBuilder pbuilder
 
Frechet frechet
 
Ellipse ellipse
 
Curvature curv
 

Detailed Description

Author
Patrice Koehl
Yossi Bokor Bleile
Date
December 2025
Version
1.2

Function Documentation

◆ parse_args()

bool parse_args ( int argc,
char ** argv,
std::string * file1,
std::string * focal1,
std::string * file2,
std::string * focal2,
int * disttype,
double * microns_per_pixel1,
double * microns_per_pixel2,
bool * verbose )

Parse command-line arguments for Comp2DShapesFocal.

Parses command-line arguments for the Comp2DShapesFocal program, extracting input files, focal points, distance type, microns per pixel settings, and verbose flag.

Parameters
argcArgument count from main()
argvArgument vector from main()
[out]file1Path to first input polygon file (set by -i1 flag)
[out]focal1Focal point for first polygon - file path or "x,y" format (set by -f1 flag)
[out]file2Path to second input polygon file (set by -i2 flag)
[out]focal2Focal point for second polygon - file path or "x,y" format (set by -f2 flag)
[out]disttypeDistance type flag (set by -d flag):
  • 0: Fréchet distance - measures similarity between curves, representing the minimum leash length needed for a person walking a dog along each curve
  • 1: Ellipse-based distances - compares aspect ratios of inscribed, inscribing, and least-squares fitted ellipses
  • 2: Curvature-based distances - includes Willmore energy (bending energy) and Wasserstein distance between curvature distributions
  • 3: 2-Wasserstein distance between persistence diagrams - topological shape descriptor based on persistent homology
  • 4: All distances - computes all of the above metrics
[out]microns_per_pixel1Microns per pixel conversion for polygon 1 (set by -mpp1 or -mpp flag, default: 1.0)
[out]microns_per_pixel2Microns per pixel conversion for polygon 2 (set by -mpp2 or -mpp flag, default: 1.0)
[out]verboseEnable verbose output (set by -v or –verbose flag, default: false)
Returns
true if arguments were parsed successfully, false otherwise