lapy.conformal

Computes spherical conformal mappings of triangle meshes.

Functions are adopted from Matlab code at https://github.com/garyptchoi/spherical-conformal-map with this Copyright (c) 2013-2020, Gary Pui-Tung Choi https://math.mit.edu/~ptchoi and has been distributed with the Apache 2 License.

Notes

If you use this code in your own work, please cite the following paper:

[1] P. T. Choi, K. C. Lam, and L. M. Lui, “FLASH: Fast Landmark Aligned Spherical Harmonic Parameterization for Genus-0 Closed Brain Surfaces.” SIAM Journal on Imaging Sciences, vol. 8, no. 1, pp. 67-94, 2015.

lapy.conformal.beltrami_coefficient(tria, mapping)[source]

Compute the Beltrami coefficient of a mapping.

Parameters:
triaTriaMesh

Genus-0 closed triangle mesh. Should be planar mapping on complex plane.

mappingarray

3D coordinates of the spherical conformal parameterization.

Returns:
muarray

Complex Beltrami coefficient per triangle.

lapy.conformal.inverse_stereographic(u)[source]

Map from complex plane to sphere via inverse stereographic projection.

Parameters:
uarray_like

Can be complex array, or two columns (real, img) for coordinates on complex plane.

Returns:
v: array of shape (n, 3)

Coordinates on sphere in 3D.

lapy.conformal.linear_beltrami_solver(tria, mu, landmark, target, use_cholmod=False)[source]

Linear Beltrami solver.

Parameters:
triaTriaMesh

Genus-0 closed triangle mesh. Should be planar mapping on complex plane.

muarray_like

Complex Beltrami coefficients.

landmarkarray_like

Fixed vertex indices.

targetarray

3d array with 2d landmark target coordinates (3rd coordinate is zero).

use_cholmodbool, default=False
Which solver to use:
  • True : Use Cholesky decomposition from scikit-sparse cholmod.

  • False: Use spsolve (LU decomposition).

Returns:
mappingarray

3d vertex coordinates of new mapping.

lapy.conformal.mobius_area_correction_spherical(tria, mapping)[source]

Find an improved Mobius transformation to reduce distortion.

This helps reducing the area distortion of a spherical conformal parameterization using the method in Choi et al, SIAM Journal on Imaging Sciences, 2020.

Parameters:
triaTriaMesh

Genus-0 closed triangle mesh.

mappingarray

Vertex coordinates of the spherical conformal parameterization.

Returns:
map_mobius: array

Vertex coordinates (3d) of the updated spherical conformal parameterization.

result: array

Optimal parameters (x) for the Mobius transformation, where

\[f(z) = \frac{az+b}{cz+d} = \frac{(x(1)+x(2)*1j)*z+(x(3)+x(4)*1j)}{(x(5)+x(6)*1j)*z+(x(7)+x(8)*1j)}.\]
lapy.conformal.spherical_conformal_map(tria, use_cholmod=False)[source]

Linear method for computing spherical conformal map of a genus-0 closed surface.

Parameters:
triaTriaMesh

Triangle mesh.

use_cholmodbool, default=False
Which solver to use:
  • True : Use Cholesky decomposition from scikit-sparse cholmod.

  • False: Use spsolve (LU decomposition).

Returns:
mapping: array

Vertex coordinates (3d) of the spherical conformal parameterization.

lapy.conformal.stereographic(u)[source]

Map sphere to complex plane via stereographic projection.

Parameters:
uarray of shape (n, 3)

Represents the three vertex coordinates.

Returns:
v: array of n complex numbers

Stereographic map of u in complex plane.