Correa is a C++ library, you can choose to build Python bindings and/or executables. It is a package for analysing simple closed curves in
If you use this software in your research, please cite it as: Bokor Bleile, Y., Koehl, P., 'Correa', https://zenodo.org/badge/latestdoi/609015232, 2023.
Correa is released under the BSD 3-Clause License, which you should have received a copy of.
First clone the repository with recursive submodules, and ensure you have CMake, BLAS and LAPACK installed.
Then, use cmake from the directory to build Correa with the options you would like. The options are
CORREA_BUILD_EXECUTABLES
(default OFF)CORREA_BUILD_PYTHON_BINDINGS
(default ON)
To build the Python bindings:
git clone --recurse-submodules https://github.com/yossibokor/correa.git
cd correa
cmake -S . -B build
cd build
make
and then ether launch python from .../correa/build
or add .../correa/build
to your PYTHONPATH
.
Once installed, you can load import a polygon from file using either correa.create_polygon
or correa.create_polygon_focal_point
. To create a polygon and use the center of mass of the vertices as the focal point, use correa.create_polygon
:
poly = correa.create_polygon(".../correa/exmaples/contour1.csv")
and if you want to specify the focal point, use correa.create_polygon_focal_point
:
poly = correa.create_polygon_focal_point(".../correa/exmaples/contour1.csv", focal_point)
where focal_point
is either the path a file containing the two coordinates of the focal point, or a list containing the two coordinates. The focal point (either automatic or user specified) forms the base point for the persistent homology computations. The persistence diagram for a polygon is the
You can then print the properties of such a polygon (including the persistence diagram via the radial distance function from the focal point) using `print_polygon:
correa.print_polygon(poly)
For a pair of polygons poly1
and poly2
, we can compare them using a varitey of metrics:
- Wassterstein distance between the persistence diagrams (
correa.wasserstein_distance
) - Frechet distance (
correa.frechet_distance
) - max ellipse distance (
correa.max_ellipse_distance
) - min ellipse distance (
correa.min_ellipse_distance
) - least square ellipse distance (
correa.lsq_ellipse_distance
) - Willmore distance (
correa.willmore_distance
)
For more information about these distances, see distances
which can be done individually or all at the same time. To calculate all the distances at once, use compare_polygons
, otherwise use the corresponding function.
correa.compare_polygons(poly1, poly2, q=2, verbose=False)
Using correa.compare_polygons
returns the distances
dWasserstein, dFrechet, dMax, dMin, dLSQ, dWillmore, dCurvOT
Please use issues to report any bugs.