Skip to content

romi/romicgal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CGAL Python Bindings for Skeletonization

Anaconda-Version Anaconda-Platforms Anaconda-License Anaconda-Downloads

Python bindings to use: CGAL/extract_mean_curvature_flow_skeleton.

This algorithm extracts a curve skeleton for a triangulated polygonal mesh without borders, based on mean curvature flow. Source: Tagliasacchi et al., _Mean Curvature Skeletons_. **Computer Graphics Forum** (2012).

Reference

Andrea Tagliasacchi, Ibraheem Alhashim, Matt Olson, and Hao Zhang. Mean Curvature Skeletons.
Computer Graphics Forum (Proceedings of the Symposium on Geometry Processing), 31(5):1735–1744, 2012.
10.1111/j.1467-8659.2012.03178.x.

Free PDF.

CGAL Reference manual for Surface mesh skeletonization.

Getting Started

The recommended way to install this library is by using the conda package.

Conda Package

In your activated environment of choice, install the conda package by running:

conda install romicgal -c romi-eu

Install from Source

Requirements

To build and install from source, the following dependencies are required:

  • C++ build tools (e.g., cmake and make)
  • A C++ Compiler compliant with C++ standard 11 or later (e.g., gcc or clang)
  • The CGAL library (CGAL)
  • The Eigen library (Eigen3)
  • The GMP library (GMP)
  • The MPFR library (MPFR)

Example: On Ubuntu 22.04, you can install these dependencies with:

sudo apt install \
    build-essential \
    gcc \
    libcgal-dev \
    libeigen3-dev \
    libgmp-dev \
    libmpfr-dev

Cloning the Repository

First, clone the source code and navigate to the project directory:

git clone https://github.com/romi/romicgal.git
cd romicgal

Setting Up a Virtual Environment

We recommend creating a dedicated conda environment to install the package and its dependencies. Use the provided YAML file to create an environment named romicgal as shown below:

conda env create --file conda/env/romicgal.yaml

Building and Installing

Activate your newly created environment and install the sources using pip:

conda activate romicgal
python -m pip install .

Usage

A quick usage example:

import romicgal
from open3d import open3d

mesh = open3d.io.read_triangle_mesh('sample/TriangleMesh.ply')
points, lines, skelcorres = romicgal.skeletonize_mesh_with_corres(mesh.vertices, mesh.triangles)

l = open3d.geometry.LineSet()
l.points = open3d.utility.Vector3dVector(points)
l.lines = open3d.utility.Vector2iVector(lines)
open3d.visualization.draw_geometries([l])

Conda Packaging

Install Requirements for Packaging

To package the library, follow the official Anaconda documentation on Conda Packages.

First, install anaconda-client and conda-build in the base environment:

conda install anaconda-client conda-build

⚠️ WARNING ⚠️

These steps must be performed in the base conda environment.

Building Conda Packages

From the root romicgal/ directory and within the base environment, build the conda packages using the following command:

conda build conda/recipe/ -c conda-forge -c open3d-admin

The built packages will be stored in the folder ~/miniconda3/conda-bld/linux-64/.

⚠️ WARNING ⚠️

This process must be completed in the base conda environment.

Uploading Conda Packages

After successfully building the package, you can upload it with the command:

anaconda upload --user romi-eu --label main ~/miniconda3/conda-bld/linux-64/romicgal*.tar.bz2

⚠️ WARNING ⚠️

This process must be completed in the base conda environment.