Correa 1
C++ library with Python bindings to analyse the shape of simple closed curves in R^2
Loading...
Searching...
No Matches
correa Namespace Reference

Classes

class  Comp
 
class  Convex
 
class  Curvature
 
class  Ellipse
 
class  Frechet
 
class  INOUT
 
class  PersistenceDiagram
 
class  PersistencePoint
 
class  PH0
 
class  Polygon
 
class  PolygonBuilder
 
class  PyPolygon
 
class  Vector
 
class  Vector2D
 
class  Vertex
 

Typedefs

typedef std::vector< Vertex >::iterator VertexIter
 
typedef std::vector< Vertex >::const_iterator VertexCIter
 

Functions

 create_polygon (str poly_path, bool clean_points=True, bool scale_by_area=False, float convert_to_microns_factor=1.0)
 Read a polygon from file.
 
 create_polygon_focal_point (str poly_path, list[float] focal_point, bool clean_points=True, bool scale_by_area=False, float convert_to_microns_factor=1.0)
 Read a polygon from file, and specify a focal point.
 
 print_polygon (poly)
 Print information about the polygon.
 
 plot_polygon (_correa.PyPolygon poly)
 Plot a polygon.
 
 compare_polygons (_correa.PyPolygon poly1, _correa.PyPolygon poly2, q=2, verbose=False)
 Given two polygons (poly1, poly2), compare them.
 
 curv_ot_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2)
 Given two polygons (poly1, poly2), calculate the curv_ot distance between them.
 
 frechet_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2)
 Given two polygons (poly1, poly2), calculate the frechet distance between them.
 
 max_ellipse_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2)
 Given two polygons (poly1, poly2), calculate the max ellipse distance between them.
 
 min_ellipse_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2)
 Given two polygons (poly1, poly2), calculate the min ellipse distance between them.
 
 lsq_ellipse_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2)
 Given two polygons (poly1, poly2), calculate the least square ellipse distance between them.
 
 wasserstein_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2, q=2)
 Given two polygons (poly1, poly2), calculate the wasserstein distance between them via their persistence diagrams.
 
 willmore_distance (_correa.PyPolygon poly1, _correa.PyPolygon poly2)
 Given two polygons (poly1, poly2), calculate the willmore distance between them.
 
 plot_persistence_diagram (_correa.PyPolygon poly)
 Plot the persistence diagram of a polygon.
 
 only_persistence_polygon (str poly_path, list[float] focal_point, bool clean_points, bool scale_by_area, float convert_to_microns_factor=1.0)
 Given a polygon, calculate the persistence diagram.
 
 test_sensitivity_polygon (str poly_path, list[float] focal_point, bool scale_by_area=False, float convert_to_microns_factor=1.0)
 
auto hera_wasserstein_distance (const std::vector< std::pair< double, double > > pd1, const std::vector< std::pair< double, double > > pd2, int q=2)
 
auto initialise_polygon (std::string path_to_vertices, bool clean_points, bool scale_by_area, double convert_to_microns_factor)
 
auto initialise_polygon (std::string path_to_vertices, std::string path_to_focal_point, bool clean_points, bool scale_by_area, double convert_to_microns_factor)
 
auto initialise_polygon (std::string path_to_vertices, std::vector< double > focal_point, bool clean_points, bool scale_by_area, double convert_to_microns_factor)
 
auto load_polygon (std::string file_path, bool clean_points, bool scale_by_area, double convert_to_microns_factor=1.0)
 
auto load_polygon (std::string path_to_vertices, std::string path_to_focal, bool clean_points, bool scale_by_area, double convert_to_microns_factor)
 
auto load_polygon (std::string path_to_vertices, std::vector< double > focal, bool clean_points, bool scale_by_area, double convert_to_microns_factor=1.0)
 
std::vector< double > compare_polygons (PyPolygon poly1, PyPolygon poly2, int q, bool verbose)
 
double wasserstein_distance (PyPolygon poly1, PyPolygon poly2, int q)
 
double frechet_distance (PyPolygon poly1, PyPolygon poly2)
 
double max_ellipse_distance (PyPolygon poly1, PyPolygon poly2)
 
double min_ellipse_distance (PyPolygon poly1, PyPolygon poly2)
 
double lsq_ellipse_distance (PyPolygon poly1, PyPolygon poly2)
 
double willmore_distance (PyPolygon poly1, PyPolygon poly2)
 
double curv_ot_distance (PyPolygon poly1, PyPolygon poly2)
 
void print_polygon (PyPolygon P)
 
Vector operator* (double s, const Vector &v)
 
double dot (const Vector &u, const Vector &v)
 
Vector cross (const Vector &u, const Vector &v)
 
double dot (const Vector2D &u, const Vector2D &v)
 
void dcopy_ (int *n, double *X, int *incx, double *Y, int *incy)
 
double ddot_ (int *n, double *u, int *incu, double *v, int *incv)
 
double dnrm2_ (int *n, double *X, int *incx)
 
void daxpy_ (int *n, double *alpha, double *X, int *incx, double *Y, int *incy)
 
void dscal_ (int *n, double *alpha, double *X, int *incx)
 
void dgemv_ (char *trans, int *m, int *n, double *alpha, double *A, int *lda, double *X, int *incx, double *beta, double *Y, int *incy)
 
void dgemm_ (char *transa, char *transb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int *ldb, double *beta, double *C, int *ldc)
 
void dgeev_ (char *JOBVL, char *JOBVR, int *N, double *A, int *LDA, double *WR, double *WI, double *VL, int *LDVL, double *VR, int *LDVR, double *WORK, int *LWORK, int *INFO)
 
void dsyevd_ (char *JOBZ, char *UPLO, int *N, double *A, int *LDA, double *W, double *WORK, int *LWORK, int *IWORK, int *LIWORK, int *INFO)
 
void dgetrf_ (int *M, int *N, double *A, int *LDA, int *IPIV, int *INFO)
 
void dgetrs_ (char *Trans, int *N, int *Nrhs, double *A, int *LDA, int *IPIV, double *B, int *LDB, int *INFO)
 
void dgetri_ (int *N, double *A, int *LDA, int *IPIV, double *WORK, int *LWORK, int *INFO)
 
bool HeightComparison (tuple< int, double > &x, tuple< int, double > &y)
 

Variables

Convex convexhull
 

Detailed Description

Correa 

Documentation for the Python functions in Correa.

Function Documentation

◆ compare_polygons() [1/2]

correa.compare_polygons ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2,
q = 2,
verbose = False )

Given two polygons (poly1, poly2), compare them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
qq for the Wasserstein distance,.
verbosesetting for verbose output.
Returns
dWasserstein, dFrechet, dMax, dMin, dLSQ, dWillmore, dCurvOT.

◆ compare_polygons() [2/2]

std::vector< double > correa::compare_polygons ( PyPolygon poly1,
PyPolygon poly2,
int q,
bool verbose )

wrapper to compare pairs of polygons.

Has a variety of methods to calculate the distances between a pair of polygons.

Prints their comparisons

◆ create_polygon()

correa.create_polygon ( str poly_path,
bool clean_points = True,
bool scale_by_area = False,
float convert_to_microns_factor = 1.0 )

Read a polygon from file.

This will recenter the polygon to the center of mass of the vertices, so be careful.

Parameters
poly_pathpath to the file you want to read in.
Returns
PyPolygon object.

◆ create_polygon_focal_point()

correa.create_polygon_focal_point ( str poly_path,
list[float] focal_point,
bool clean_points = True,
bool scale_by_area = False,
float convert_to_microns_factor = 1.0 )

Read a polygon from file, and specify a focal point.

Parameters
poly_pathpath to the file containing the polygon.
focal_pointeither a path to the file containing the focal point, or a list with the coordinates.
Returns
PyPolygon object

◆ curv_ot_distance()

correa.curv_ot_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2 )

Given two polygons (poly1, poly2), calculate the curv_ot distance between them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.

◆ frechet_distance()

correa.frechet_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2 )

Given two polygons (poly1, poly2), calculate the frechet distance between them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.

◆ hera_wasserstein_distance()

auto correa::hera_wasserstein_distance ( const std::vector< std::pair< double, double > > pd1,
const std::vector< std::pair< double, double > > pd2,
int q = 2 )

Caculate the Wasserstein distance between two persistence diagrams using Hera.

Parameters
pd1first persistence diagram
pd2second persistence diagram
qthe qth power to use, default is 2
Returns
qth wasserstein distance between the two persistence diagrams

◆ lsq_ellipse_distance()

correa.lsq_ellipse_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2 )

Given two polygons (poly1, poly2), calculate the least square ellipse distance between them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.

◆ max_ellipse_distance()

correa.max_ellipse_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2 )

Given two polygons (poly1, poly2), calculate the max ellipse distance between them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.

◆ min_ellipse_distance()

correa.min_ellipse_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2 )

Given two polygons (poly1, poly2), calculate the min ellipse distance between them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.

◆ only_persistence_polygon()

correa.only_persistence_polygon ( str poly_path,
list[float] focal_point,
bool clean_points,
bool scale_by_area,
float convert_to_microns_factor = 1.0 )

Given a polygon, calculate the persistence diagram.

Parameters
poly_pathpath to the file containing the polygon.
focal_pointeither a path to the file containing the focal point, or a list with the coordinates.
clean_pointswhether to clean the points.
scale_by_areawhether to scale by area.
convert_to_microns_factorscale factor for pixel to micrometer conversion.
Returns
persistence diagram.

◆ plot_persistence_diagram()

correa.plot_persistence_diagram ( _correa.PyPolygon poly)

Plot the persistence diagram of a polygon.

Parameters
polythe polygon you want to plot the persistence diagram of.
Returns
a plotly.express figure.

◆ plot_polygon()

correa.plot_polygon ( _correa.PyPolygon poly)

Plot a polygon.

Parameters
polythe polygon you want to plot.
Returns
a matplotlib.pyplot figure.

◆ print_polygon() [1/2]

correa.print_polygon ( poly)

Print information about the polygon.

Parameters
polythe polygon you want information about.

◆ print_polygon() [2/2]

void correa::print_polygon ( PyPolygon P)

print the information about a PyPolygon

◆ wasserstein_distance()

correa.wasserstein_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2,
q = 2 )

Given two polygons (poly1, poly2), calculate the wasserstein distance between them via their persistence diagrams.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.

◆ willmore_distance()

correa.willmore_distance ( _correa.PyPolygon poly1,
_correa.PyPolygon poly2 )

Given two polygons (poly1, poly2), calculate the willmore distance between them.

Parameters
poly1first polygon to compare.
poly2second polygon to compare.
Returns
distance.